Draw rectangle in the selection, Highcharts

2019-09-06 18:13发布

I want to draw rectangle or square in selection area to show the selected xAxis min, max and yAxis min max in highchart.

Thanks in Advance

标签: highcharts
2条回答
Explosion°爆炸
2楼-- · 2019-09-06 18:32

Explaining @igor-shastin's example...

  • Set zoomType to "xy"
  • Add a rect to the chart with 0 dimensions and hang onto the reference
  • In the selection event:
    • Grab the event.xAxis[0].min and .max; same for .yAxis
    • Update the rect coordinates so it renders where the selection was made
    • Return false and/or call event.preventDefault() to prevent actually zooming
查看更多
爷的心禁止访问
3楼-- · 2019-09-06 18:36

This is what you need: http://jsfiddle.net/meFgf/

查看更多
登录 后发表回答