highcharts中单个系列的颜色

时间:2016-04-04 09:28:01

标签: charts highcharts

我正在尝试实现图片中显示的内容。

  • 我的代码在下面,因为“90”​​,“130”和“110”我想给出单独的颜色,有什么方法(修复)

The Visual of the expected output

series: [{
    name: 'Historic <br/> $850,000' ,
    title: 'Historic',
    data: [90, 130,110],
    pointWidth: 60,
    color: '#0066FF'
}]
提前谢谢!

1 个答案:

答案 0 :(得分:3)

您可以将每个点初始化为对象而不仅仅是一个值,然后提供color属性。例如(JSFiddle):

series: [{
    data: [{ y: 7.0, color: 'orange' }, { y: 6.9, color: 'green' }, { y: 9.5, color: 'blue' }]
}]

或者您可以将系列设置为colorByPoint并使用colors数组,例如(JSFiddle):

colors: ['orange', 'green', 'blue'],
series: [{
    colorByPoint: true,
    data: [7.0, 6.9, 9.5]
}]