简体   繁体   English

图表加载后高库存变化xAxis minRange

[英]Highstock change xAxis minRange after chart is loaded

I am truing to change the minRange on xAxis after chart has been loaded. 我正试图在加载图表后更改xAxis上的minRange i have tried these with no success : 我尝试了这些没有成功:

chart.xAxis[0].minRange
chart.xAxis.minRange
chart.xAxis[0].options.minRange
chart.xAxis.options.minRange

none of them works.bu setting the minTickInterval like this works : 它们都不起作用。bu设置minTickInterval像这样工作:

chart.xAxis[0].options.minTickInterval

so how can i change minRange at runtime? 那么如何在运行时更改minRange

UPDATE:I should have mentioned that my axis is type of datetime 更新:我应该提到我的轴是日期时间类型

UPDATE 2: ok i found the problem, i have this in my code : 更新2:好的,我发现了问题,我的代码中有这个问题:

    $.each(Analyzer.chart.series, function (index, item) {
        item.setData([]);
    });

to clear the series data, so i can load new data. 清除系列数据,以便我可以加载新数据。 if i comment this peace of code setting minRange works. 如果我评论此代码设置minRange和平。

so ??? 所以??? how to clear series data so that i can change minRange too ???? 如何清除系列数据,以便我也可以更改minRange

UPDATE 3: ok i moved the cod in update2 to before setting minRange .... and walla it works :D 更新3:好的,我在设置minRange ....和walla之前将minRange的鳕鱼移到了:D

for future references : you should set minRange after you have cleared the series data otherwise it wont works. 供将来参考:清除序列数据后,应设置minRange ,否则它将minRange

Try to set the isDirty flag of the xAxis object, and then run the redraw method: 尝试设置xAxis对象的isDirty标志,然后运行redraw方法:

    chart.xAxis[0].minRange = 20;
    chart.xAxis[0].isDirty = true;
    chart.redraw();

Example: http://jsfiddle.net/d2Zdh/ 示例: http//jsfiddle.net/d2Zdh/

Edit: It should also work when your x axis is of type "datetime". 编辑:当您的x轴的类型为“ datetime”时,它也应该工作。 See updated example: http://jsfiddle.net/NnW5G/ 查看更新的示例: http : //jsfiddle.net/NnW5G/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM