Highcharts - 使用JSON传递颜色

时间:2014-06-12 04:57:41

标签: json highcharts

目前,我正在使用后端流程为包含HighCharts的3d条形图创建JSON文件。

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

我想知道的是 - 你能为每个数据点传递颜色吗?例如:

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

我已经尝试过没有运气了。这可能不受支持,但我想我会问。

1 个答案:

答案 0 :(得分:1)

尝试类似

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

A sample with line chart