yoleg
yoleg

Reputation: 381

High charts: Set Each Bar In a Multi-Series Bar Graphs To a Different Color

I'm trying to set the color of each individual bar to a different color in a multi series highCharts graphs.

here is the data as it comes in:

{
    "yAxisText": "",
    "yAxisUnit": "%",
    "statusCode": "OK",
    "chartType": "column",
    "categories": [
        "Basic",
        "1",
        "2",
        "3+",
        "4+"
    ],
    "options": [
        {
            "name": "test1",
            "data": [
                56.6,
                17.3,
                8.6,
                17.5,
                12
            ]
        },
        {
            "name": "test2",
            "data": [
                46.5,
                16,
                15.4,
                22.1,
                33
            ]
        }
    ]
}

I'm able to make each data set a different color or each category a different color, but I can't figure out how to make each individual bar a different color.
So essentially for this data there would be 8 bars with 8 different colors. Thanks in advance!

Upvotes: 0

Views: 101

Answers (1)

Sebastian Bochan
Sebastian Bochan

Reputation: 37588

You can set array of colors and then apply each color per poiny by colorByPoint option.

{
   colors:['blue','red','green']
},
series:[{
   colorByPoint: true,
   data:[1,2,3]
}]

Upvotes: 1

Related Questions