jqPlot resizing

橙三吉。 提交于 2019-11-27 15:49:07
Boro

To sort out your problem you must first set the 'min' and 'max' dates for the date axis (i.e. axis X). Apparently only when the 'min' and 'max' values are set the renderer will use the value of 'tickInterval'. That sort of problem was actually already solved on stack --- please see this answer.

Therefore using this suggestion you will need to set the following parameters as below:

tickInterval: "3 months",   
min: chLines[0][0][0],
max: chLines[0][0][chLines[0].length-1]

As it goes for the resizing bit you need to use the below:

$(window).bind('resize', function(event, ui) {    
    if (plot) {
        plot.replot();
    }
});

Here is a working code sample made for your code.


EDIT: After fiddling with the sample for a while I observed that there was still a little bit of a problem thought not visible cause the format was covering it. As it appears the setting of min, max and tickInterval is not enough as the values are still not every 3 months as each tick shows 30th day and it should sometimes be 31.

The only solution then I figured out was to set the ticks myself. In this case you do not need min, max and tickInterval any more.

acSlater

For me updating jqplot solved the issue with tick labels running into each other, to address the problem of tickinterval not working see the accepted answer here:

jqPlot DateAxis tickInterval not working

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