change line color when hovering a scatterplot series in scatter chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

change line color when hovering a scatterplot series in scatter chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function () {/*  w  w w  .j a va 2 s  .  c o  m*/
    $('#container').highcharts({
        chart: {
            type: 'scatter',
        },
        plotOptions: {
            scatter: {
            lineWidth:1,
                marker: {
                    radius: 1,
               symbol:'circle',
               fillColor: '#800000',
                    states: {
                        hover: {
                            enabled: true,
                     radius:0,
                     radiusPlus:2,
                     lineColor: '#ff0000',
                     fillColor: '#ff0000'
                        }
                    }
                },
                events: {
                    mouseOver: function () {
                        this.chart.series[this.index].update({
                           color: 'red'
                        });
                    },
                    mouseOut: function () {
                        this.chart.series[this.index].update({
                           color: "#b0b0b0"
                        });
                    }
                }
            }
        },
        series: [{
            name: 'A',
            color: "#b0b0b0",
            data: [[38,42],[39,39],[35,45],[35,54],{x:36,y:35,marker:{radius:8,symbol:'circle'}}
            ]
        }, {
            name: 'B',
            color: "#b0b0b0",
            data: [[46,56],[47,67],[48,69],[50,55],{x:52,y:57,marker:{radius:8,symbol:'circle'}}
            ]
        }]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div>  
   </body>
</html>

Related Tutorials