How do I detect a zoom event in highcharts?

后端 未结 3 1295
清歌不尽
清歌不尽 2021-02-05 10:57

Is it possible to detect a zoom event in Highcharts? My use case is that I have some state external to the chart, and when the user zooms in on part of it I want to detect what

3条回答
  •  不思量自难忘°
    2021-02-05 11:31

    I found a way using redraw global event:

    {
      redraw: function(event) {
        if (
          (event ? .target ? .axes[0] && event ? .target ? .axes[0].max !== event ? .target ? .axes[0].oldMax) || 
          (event ? .target ? .axes[1] && event ? .target ? .axes[1].max !== event ? .target ? .axes[1].oldMax)) {
            // Here you can be sure the this is closer to a zoom event... almost, because it also detect drag on the map :(
          }
      }
    }

    I just want to leave this here because I decide to use something else but my future self might need it :D

提交回复
热议问题