I have a line-chart
on my angular app. What I need to do is when I click on any point of the chart to mark that point to distinguish it from the rest. Below is my chart configuration:
highcharts = Highcharts;
chartOptions = {
chart: {
type: "line"
},
credits: {
enabled: false
},
title: {
enabled: true,
text: "Reach +1/" + this.xAxis.name,
verticalAlign: "top",
align: "left"
},
tooltip: {
formatter: function (data) {
return data.chart.userOptions.xAxis.title.text + ": " + this.x.toFixed(4) + "<br/>" +
"Reach: " + this.y.toFixed(4);
}
},
xAxis: {
title: {
text: this.xAxis.name
},
},
yAxis: {
title: {
text: "Reach"
}
},
series: [
{
name: this.xAxis.name,
data: null,
allowPointSelect: true,
point: {
events: {
click: function(event) {
this.yPoint = event.point.y;
this.xPoint = event.point.x;
this.filterOptimizationResults(this.xPoint, this.yPoint);
}.bind(this)
},
},
state: {
select: {
enabled: true
}
}
}
]
};
Below I'm sharing a screen of the chart for reference:
So for example if y select the point (25,75)
I need that point to be circled.
Here is a basic example of how to implement the point toggling by using the point.update and events.click features.
Demo: https://jsfiddle.net/BlackLabel/sh4o3enL/
point: {
events: {
click() {
let point = this;
if (point.marker && point.marker.enabled) {
point.update({
marker: {
enabled: false
}
})
} else {
point.update({
marker: {
enabled: true
}
})
}
}
}
}
API: https://api.highcharts.com/class-reference/Highcharts.Point#update
API: https://api.highcharts.com/highcharts/series.line.point.events.click