Javascript examples for highcharts:Chart Label
show/hide multiple data labels on mouseOver and mouseOut
<html> <head> <title>Highcharts Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.js"></script> <script type="text/javascript"> $(function() {// www . j a va 2 s . c o m Highcharts.chart('container', { xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], crosshair: { color: '#eaeaea' } }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], }, { data: [216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5], }], tooltip: { shared: true }, plotOptions: { series: { dataLabels: { enabled: false, align: 'center', states: { hover: { enabled: true, } } }, marker: { radius: 10, symbol: 'circle', states: { hover: { radius: 20, symbol: 'circle' } } }, events: { mouseOut: function() { this.chart.hoverPoints.forEach(p => { p.update({ dataLabels: { enabled: false } }, false, false); }); } }, point: { events: { mouseOver: function(e) { this.series.data.forEach(p => { p.update({ dataLabels: { enabled: false } }, false, false) }); this.update({ dataLabels: { enabled: true } }); } } } } } }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <div id="container" style="height: 400px"></div> </body> </html>