问题
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
回答1:
This is what you need: http://jsfiddle.net/meFgf/
回答2:
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 callevent.preventDefault()
to prevent actually zooming
- Grab the
来源:https://stackoverflow.com/questions/12595575/draw-rectangle-in-the-selection-highcharts