Search code examples
highmaps

How to provide dynamic hover color in highmaps?


see the below code:

states :{
    hover: {
        color: <dynamic color for each location>
    }
}

Solution

  • You can alter point.pointAttr.hover.fill after creating the chart to give specific points their own hover color. For example:

    var points = $('#container').highcharts().series[0].data;
    
    for(var i = 0; i < points.length; i++) {
        if(points[i].options.code == 'RU' || points[i].options.code == 'US')
            points[i].pointAttr.hover.fill = 'pink';
    }
    

    See this JSFiddle demonstration which has special colors for Russia and the United States.