Created
March 16, 2020 00:33
-
-
Save kw0006667/4b6794d235da012a784c60c5f5a3da7d to your computer and use it in GitHub Desktop.
Select points by changing opacity of points in Highcharts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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