我正在使用 Highmaps,这就是我使用的:
http://www.highcharts.com/maps/demo/data-class-ranges
在这张 map 中,不同国家/地区的颜色从白色变为蓝色,我想将其更改为“红色到蓝色”渐变,就像在这个 css 示例中一样:
background: -webkit-linear-gradient(red, yellow, green, blue); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(red, yellow, green, blue); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(red, yellow, green, blue); /* For Firefox 3.6 to 15 */
background: linear-gradient(red, yellow, green, blue); /* Standard syntax (must be last) */
我该怎么做?
最佳答案
您可以在 colorAxis
对象中指定颜色。
colorAxis: {
dataClasses: [{
to: 3,
color: "red"
}, {
from: 3,
to: 10,
color: "yellow"
}, {
from: 10,
to: 30,
color: "green"
}, {
from: 30,
to: 100,
color: "blue"
}, {
from: 100,
to: 300,
color: "pink"
}, {
from: 300,
to: 1000,
color: "purple"
}, {
from: 1000,
color: "black"
}]
},
#FF0000
等十六进制值也适用。
工作示例:http://jsfiddle.net/8wcntpcz/
编辑: 文档:http://api.highcharts.com/highmaps#colorAxis.dataClasses
关于css - 更改 Highmap 的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34466757/