Reputation: 1
On my project I need to create a chart, in which user should be able to point-click on series data, but the points should not be highlighted when the cursor is moved elswhere in the chart - they should be highlighted only when cursor is exacly over a series point. Is it possible to achieve such behavior?
Here there are two options, which HighchartsGPT is proposing: 1)
Highcharts.chart('container', {
chart: {
type: 'line'
},
tooltip: {
enabled: false // Disable tooltip entirely
},
plotOptions: {
series: {
point: {
events: {
click: function() {
alert('Point clicked: ' + this.y);
}
}
}
}
},
series: [{
name: 'Sample Data',
data: [1, 3, 2, 4, 6, 5]
}]
});
Highcharts.chart('container', {
chart: {
type: 'line'
},
plotOptions: {
series: {
enableMouseTracking: false, // Disable mouse tracking
point: {
events: {
click: function() {
alert('Point clicked: ' + this.y);
}
},
marker: {
enabled: true // Ensure markers are enabled for clicking
}
}
}
},
series: [{
name: 'Sample Data',
data: [1, 3, 2, 4, 6, 5]
}]
});
Both options will not do, because with the first option points are still highlighted when the cursor moves elsewhere, and with the second option point-click events are not working when clicking on any point.
Upvotes: 0
Views: 21
Reputation: 3703
You can disable this behaviour via series.stickyTracking
option set to false
.
API Reference: https://api.highcharts.com/highcharts/series.line.stickyTracking
Upvotes: 0