简体   繁体   English

Google Geochart中不同范围的颜色

[英]Distinct, ranged colors in google geochart

I'm trying to make a google geochart with a range of values set as a specific, solid color. 我正在尝试使用一组值设置为特定的纯色的google geochart。

Example: number of cookies- 0-10: red 11-20: yellow 21-30:green 示例:饼干数-0-10:红色11-20:黄色21-30:绿色

I'm trying to use the colorAxis.values object to do this like this: 我正在尝试使用colorAxis.values对象这样做:

var options = {
        colorAxis: {values:[0, 10], colors:['red', 'red'],
                    values:[11, 20], colors:['yellow', 'yellow'],
                    values:[21, 30], colors:['green', 'green']}
                  };

Is it possible to do what I'm trying here? 可以做我在这里尝试的事情吗?

Use a single values array and a single colors array: 使用单个values数组和单个colors数组:

colorAxis: {
    values:[0, 10, 11, 20, 21, 30],
    colors:['red', 'red', 'yellow', 'yellow', 'green', 'green']
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM