Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to connect the zoom on two Highcharts graphs?

I have a line graph and an area graph from the Highcharts API on my page that are x zoom-able like so:

chart: {
   type: 'line',
   zoomType: 'x'
}

Is it possible to make it so if I zoom in on one graph, it will apply the same zoom to the other graph? And vice versa?

I've looked online and in the API and I can't find anything but I feel like it should be possible.

like image 469
aadu Avatar asked Jun 04 '13 17:06

aadu


1 Answers

This fiddle helped figure it out:

jsfiddle.net/Gv7Tg/27/

It basically overwrites the setExtremes method with a custom one to propagate the event to the other graphs.

 events:{
    afterSetExtremes:function(){
      ...
    }
 }
like image 198
aadu Avatar answered Nov 07 '22 00:11

aadu