jQuery Flot line chart with month,year in x-axis

后端 未结 2 824
广开言路
广开言路 2021-01-07 00:16

I\'m trying to generate a graph with month,year in x-axis. Please check below for ex:

\"enter

2条回答
  •  佛祖请我去吃肉
    2021-01-07 00:51

    In the options:

    xaxis: {mode: "time", timeformat: "%b %m"}
    

    Using the time plugin.

    The data has to be converted to timestamps as explained in the link. As you have 0 in the day, maybe something like:

    tstamp = new Date(dat[0]*1000*3600*24*30*12+dat[1]*1000*3600*24*30)
    

提交回复
热议问题