javascript - Emulating multiple click functions or have separate clicked values based on specific areas below or above dataMin and dataMax - highcharts -
i using highstock highcharts.
i want capture min , max values based on area of chart clicked.
let's current instance of graph have min of 15 , max of 80 range of 1-100 data set. now, if click on area below 15 should able set min value in code. want
click: function(e) { ctrl.minselected = e.yaxis[0].value; }
similarly if click on area above value 80, want fire same or click handler capture max value.
first, possible in highcharts? please guide if yes else let me know hwo can achieve ? thanks!
i made basic example showing how values need. actual code , logic should not hard figure out here.
the following code give clicked yvalue, , current extreme values in console. working fiddle
chart: { events: { click: function (event) { console.log(event.yaxis[0].value); console.log(chart.yaxis[0].getextremes()); this.update({yaxis: {max: event.yaxis[0].value}}) } } }
to explain bit more:
event.yaxis[0].value
gives yvalue according yaxis, see api on chart.events.click.
chart.yaxis[0].getextremes()
gives yaxis extremes, both graph area extremes , data(points) extremes, see api on axis.getextremes
this.update
refers chart, update lets update whatever may want on chart, see api on chart.update. here use set yaxis max value of location clicked.
Comments
Post a Comment