admin管理员组文章数量:1391947
I have a columnrange series in my highchart, and I want to be able to set a specific color for each range in a series. As long as I just used one color, this worked fine:
data: [[1, 5, 10], [2, 10, 20]]
Here the first value in each list is the X and the next two is the start and the end of the Y range. In order to have a separate color for each range I figured I needed to use the "object notation" instead of the array notation, so I tried this:
data: [{
x: 1,
y: [5,10],
fillColor: "red"
},{
x: 2,
y: [10,20],
fillColor: "blue"
}]
This did however not work (got invalid values). I cannot see that this case is covered by the API doc: .data
Does anyone know how I can have ranges (two Y values) with the object notation, or if there is another way I can color the ranges differently? PS: My Y values are actually date ranges, but I just simplified it for the example above.
Edit: Here is a jsfiddle showing what I try to achieve: / . If you change the type to "column", and change the y-values to just single integers, you see that it works fine. But with columnrange I cannot get it working.
I have a columnrange series in my highchart, and I want to be able to set a specific color for each range in a series. As long as I just used one color, this worked fine:
data: [[1, 5, 10], [2, 10, 20]]
Here the first value in each list is the X and the next two is the start and the end of the Y range. In order to have a separate color for each range I figured I needed to use the "object notation" instead of the array notation, so I tried this:
data: [{
x: 1,
y: [5,10],
fillColor: "red"
},{
x: 2,
y: [10,20],
fillColor: "blue"
}]
This did however not work (got invalid values). I cannot see that this case is covered by the API doc: http://api.highcharts./highcharts#series.data
Does anyone know how I can have ranges (two Y values) with the object notation, or if there is another way I can color the ranges differently? PS: My Y values are actually date ranges, but I just simplified it for the example above.
Edit: Here is a jsfiddle showing what I try to achieve: http://jsfiddle/Q2JMF/1/ . If you change the type to "column", and change the y-values to just single integers, you see that it works fine. But with columnrange I cannot get it working.
Share Improve this question edited Mar 11, 2013 at 8:15 Knut Marius asked Mar 8, 2013 at 14:52 Knut MariusKnut Marius 1,6281 gold badge21 silver badges40 bronze badges 2- 1 Could you make a JSFiddle with your code? – MatthewKremer Commented Mar 8, 2013 at 14:53
- Sure! Updated the question with a jsfiddle – Knut Marius Commented Mar 11, 2013 at 8:16
1 Answer
Reset to default 6Proper options are low
and high
, see: http://jsfiddle/Q2JMF/2/
data: [{
x: 1,
low: 7,
high: 8,
color: "red"
}, {
x: 2,
low: 6,
high: 7,
color: "blue"
}]
本文标签: javascriptIndividually colored data ranges in highchartsStack Overflow
版权声明:本文标题:javascript - Individually colored data ranges in highcharts - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744677765a2619216.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论