Skip to content

Instantly share code, notes, and snippets.

@kw0006667
Created March 16, 2020 00:33
Show Gist options
  • Save kw0006667/4b6794d235da012a784c60c5f5a3da7d to your computer and use it in GitHub Desktop.
Save kw0006667/4b6794d235da012a784c60c5f5a3da7d to your computer and use it in GitHub Desktop.
Select points by changing opacity of points in Highcharts
let searchInput = document.getElementById('search');
searchInput.oninput = function(event) {
currentSearch = this.value;
chart.series.forEach(serie => {
serie.points.forEach(point => {
point.update({ color: Highcharts.theme.colors[point.colorIndex] }, false);
});
});
chart.redraw();
if (currentSearch !== '') {
chart.series.forEach(serie => {
serie.points.forEach(point => {
if (point.name.includes(currentSearch)) {
// We don't need too select any point here because we only fade out other points.
// point.select(true, true);
} else {
point.update({ color: Highcharts.theme.colors[point.colorIndex] + '11' }, false);
}
});
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment