Javascript 在条形图上添加颜色渐变色
我尝试在海图上为条形图添加渐变 我试试这个Javascript 在条形图上添加颜色渐变色,javascript,highcharts,Javascript,Highcharts,我尝试在海图上为条形图添加渐变 我试试这个 colors: [{ linearGradient: perShapeGradient, stops: [ [0, '#c2352b'], [1, '#f44336 '] ] }, { linearGradient: perShapeGradient, stops: [ [0, '#1b75bf'], [1, '#2196f3'] ] }, {
colors: [{
linearGradient: perShapeGradient,
stops: [
[0, '#c2352b'],
[1, '#f44336 ']
]
}, {
linearGradient: perShapeGradient,
stops: [
[0, '#1b75bf'],
[1, '#2196f3']
]
}, {
linearGradient: perShapeGradient,
stops: [
[0, '#cc7a00'],
[1, '#ff9800']
]},
]
但我所有的酒吧的颜色都变得一样(甚至有渐变色)。
这里是完整代码的链接。您的代码没有问题。问题是,您为整个系列设置了颜色,并且所有数据都来自同一系列。如果放置另一个系列,可以看到它采用了另一种颜色: 要为每个
类别设置不同的颜色,可以将plotOptions
中的colorByPoint
属性设置为true
:
plotOptions: {
colorByPoint: true
}
下面是一个示例:您的代码没有问题。问题是,您为整个系列设置了颜色,并且所有数据都来自同一系列。如果放置另一个系列,可以看到它采用了另一种颜色:
要为每个类别设置不同的颜色,可以将plotOptions
中的colorByPoint
属性设置为true
:
plotOptions: {
colorByPoint: true
}
下面是一个例子:Hi@vandi,我下面的答案为您解答了吗?Hi@vandi,我下面的答案为您解答了吗?抱歉,耽误了太长时间