Search code examples
flot

Flot bar chart highlight color per series


I have a bar chart with a few series. How can I control what color the highlight color will be on a per series basis? (each of my series is a different colour so I need to highlight them each differently).

I've seen how to do this for a single color throughout the entire chart but I'm needing it specific for each series.


Solution

  • You need to set the highlightColor option for each series in your data array:

    var data = [{
        data: [
            [1, 5],
            [2, 3]
        ],
        highlightColor: "#00FF00"
    }, {
        data: [
            [1, 2],
            [2, 8]
        ],
        highlightColor: "#FF0000",
    }];
    

    JSFiddle Example