The xAxis of my charts is represented with days (xAxisType=dateTime).
I modify the selection event (zooming) and depend on the amount of days which are selected in the selection, the chart data is recalculated and the xAxis change to hours (instead of days). And the same process happens if we do another selection in the new chart (data recalculation and xAxis change to ten minutes, instead of hours).
Imagine that we have dates from 1st of February to 25th of February in the chart. If we select the 2nd and 3rd of February, the new recalculated data is shown with hours in the xAxis (now we have in the xAxis from 2nd February 00:00 to 3rd February 23:00, 48 ticks). And if we select again a new period (for example from 2nd February 07:00 to 2nd February 10:00) the new recalculated data is shown but in the xAxis appear ten minutes ticks. Important about this last thing, all the day is shown (24 hours divided in ten minutes ticks) not only the selected period.
The question is, is it any way of launching the regular Highcharts zooming with the selected period (from 2nd February 07:00 to 2nd February 10:00) after this last selection (programmatically)?
With this, appears directly the selected period instead the whole day, and I have the chance to push the button “reset the zoom” and get the whole day (what I have now).
I use Highcharts with Dojo.
The xAxis of my charts is represented with days (xAxisType=dateTime).
I modify the selection event (zooming) and depend on the amount of days which are selected in the selection, the chart data is recalculated and the xAxis change to hours (instead of days). And the same process happens if we do another selection in the new chart (data recalculation and xAxis change to ten minutes, instead of hours).
Imagine that we have dates from 1st of February to 25th of February in the chart. If we select the 2nd and 3rd of February, the new recalculated data is shown with hours in the xAxis (now we have in the xAxis from 2nd February 00:00 to 3rd February 23:00, 48 ticks). And if we select again a new period (for example from 2nd February 07:00 to 2nd February 10:00) the new recalculated data is shown but in the xAxis appear ten minutes ticks. Important about this last thing, all the day is shown (24 hours divided in ten minutes ticks) not only the selected period.
The question is, is it any way of launching the regular Highcharts zooming with the selected period (from 2nd February 07:00 to 2nd February 10:00) after this last selection (programmatically)?
With this, appears directly the selected period instead the whole day, and I have the chance to push the button “reset the zoom” and get the whole day (what I have now).
I use Highcharts with Dojo.
Share Improve this question asked Sep 26, 2013 at 12:36 Iker AguayoIker Aguayo 4,1154 gold badges40 silver badges53 bronze badges 2 |3 Answers
Reset to default 20To set extremes use:
this.xAxis[0].setExtremes(min,max);
this.showResetZoom();
Im guessing you need to programaticaly reset the zoom. This is a better option than enabling the default highcharts zoom reset label. Since that would require an extra redundant step.
this.zoom()
Thanks.
Looks like this.zoom()
does not trigger chart.events.selection
event.
In case you need to reset zoom and trigger all events along the way click on "Reset button" programmatically
$('.highcharts-button').click();
this.xAxis[0].setExtremes(min, max);
doesn't work? Also see this example. – Paweł Fus Commented Sep 26, 2013 at 13:03