css - 更改 Highmap 的颜色

标签 css highcharts highmaps

我正在使用 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/

相关文章:

css - 围绕子 div 元素居中父 Div(反向继承?)

css - 创建 Bootstrap 响应式布局时如何设置容器 div 的宽度?

javascript - Highcharts 百分比计算不正确

colors - 仅为多 Pane Highstock 图表中的一个 Pane 设置背景颜色

highcharts - Highmaps:县的代码是什么?

html - 使包装器 div 覆盖内部所有定位的 div

css - 如何在 ScalaFX 中使用 CSS 设置自定义 TreeCell 的样式?

javascript - 如何在 Angular 8.1 中隐藏 Highcharts 的 "showInLegend"?

javascript - Highmaps 中可以使用 "value"以外的其他列名吗?

javascript - 三级下钻 Highcharts