How have I to modify the following example to get the point value in the first series even when clicking on a point in the second series? It suffices to me to get the chart
object but I don't know how to do (inside point mouseOut
function this
refers to point
object and not to chart
object).
$(function () {
$('#container').highcharts({
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
// here I want the y value of the point in the
// first series even in this function
// is invoked for the point in the second series
alert('value: ' + this.y);
}
}
}
}
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0]
},{
data: [135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
});
JSfiddle page
According to the docs:
The this keyword refers to the Point object.
Point
in turn has series
property that holds chart
:
series: {
cursor: 'pointer',
point: {
events: {
click: function() {
var chart = this.series.chart;
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With