Reputation: 2364
I am working with HighCharts, in particular the line graph.
Using an Aspx
button click I wish to retrieve the values of the first
and last
points on the graph.
When I click on a particular point I can retrieve the value like -
click: function() {
X = Highcharts.dateFormat('%A, %b %e, %Y, %H:%M', this.x);
Y = this.y;
document.getElementById('MainContent_dateTB').value = X;
document.getElementById('MainContent_countTB').value = Y;
}
Because the graph has a zoom function, this means the first and last point values can be different, so when a user clicks on the Aspx button (not the point on the graph), I need to retrieve the values of the current first and last values on the page.
Upvotes: 0
Views: 282
Reputation: 19093
You should try the 'getExtremes' api call.
http://api.highcharts.com/highcharts#Axis.getExtremes()
yextremes = chart.yAxis[0].getExtremes();
xextremes = chart.yAxis[0].getExtremes();
yMax = yextremes.dataMax;
xMax = xextremes.dataMax;
yMin = yextremes.dataMin;
xMin = xextremes.dataMin;
Once you have the min/max x value, you can look through your series data looking for the first/last point within that range.
Upvotes: 1