jqPlot step chart not plotting in series order

六月ゝ 毕业季﹏ 提交于 2019-12-02 13:51:31

Use CategoryAxisRenderer, it will solve your problem and then you dont have to supply min and max.

You can keep on adding as much data you want it will always plot it correctly.

Jsfiddle link

var line1 = [['2014-01-15 15:10:01', 21],
             ['2014-01-15 15:10:12', 21],
             ['2014-01-15 15:10:12', 22],
             ['2014-01-15 15:10:14', 22],
             ['2014-01-15 15:10:14', 21],
             ['2014-01-15 15:10:17', 21],
             ['2014-01-15 15:10:17', 22],
             ['2014-01-15 15:10:23', 22],
             ['2014-01-15 15:10:23', 18],
             ['2014-01-15 15:10:28', 18],
             ['2014-01-15 15:10:28', 21]];

        var plot1 = $.jqplot('chart1', [line1], {
            title: 'Default Date Axis',
            axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer } },
            series: [{ lineWidth: 1, markerOptions: { style: 'square' } }]
        });

You need to set the sort attribute to false, look:

http://www.jqplot.com/docs/files/jqplot-core-js.html#jqPlot.sortData

With this you can make your own sequence.

I am working in a irrigation project, and need circulate irrigate area dynamically, sorry but I don't have reputation to post a picture of it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!