Question

I am truing to change the minRange on xAxis after chart has been loaded. 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 :

chart.xAxis[0].options.minTickInterval

so how can i change minRange at runtime?

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 :

    $.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.

so ??? how to clear series data so that i can change minRange too ????

UPDATE 3: ok i moved the cod in update2 to before setting minRange.... and walla it works :D

for future references : you should set minRange after you have cleared the series data otherwise it wont works.

Was it helpful?

Solution

Try to set the isDirty flag of the xAxis object, and then run the redraw method:

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

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

Edit: It should also work when your x axis is of type "datetime". See updated example: http://jsfiddle.net/NnW5G/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top