user3732568
user3732568

Reputation: 1

Highcharts - Passing in Color with JSON

Currently, I'm using a back end process to create a JSON file for a 3d bar chart with HighCharts.

[{
     "name": "Town",
     "data": ["NorthCentral","NorthEast","SouthCentral","SouthEast","West"]
}, {
     "name": "Population",
     "data": [99.47,82,89,82,82]
}]

What I would like know is - can you pass in colors with each data point? for example:

[{
     "name": "Town",
     "data": ["NorthCentral","NorthEast","SouthCentral","SouthEast","West"]
}, {
     "name": "Population",
     "data": [{color: 'red',99.47},82,89,82,82]
}]

I have tried already with no luck. This might not be supported but I thought I would ask.

Upvotes: 0

Views: 998

Answers (1)

Okky
Okky

Reputation: 10466

Try something like

data: [{
    name: 'Point 1',
    color: '#00FF00',
    y: 0
}, {
    name: 'Point 2',
    color: '#FF00FF',
    y: 5
}]

A sample with line chart

Upvotes: 1

Related Questions