Google Chart Gauge with multiple color zones

1,197 views
Skip to first unread message

Danny Woodman

unread,
Jun 1, 2012, 12:33:34 PM6/1/12
to Google Visualization API
I'm using Google Charts API to create a gauge chart. It is a very
simple and effective API to create charts on-the-fly.

Now, I need to customize a litte bit this chart adding more than a
green zone. For example I need a green zone that goes from 0 to 10,
one from 20 to 30 and another from 40 to 50, but it doesn't seems
possible.

Here is the options to pass to the draw() method for setting up the
green zone
var options = {
greenFrom: 0, greenTo: 10
};

I tried to pass an array as an option, but it obviously doesn't
works. Here is what I tried.
var options = {
greenFrom: [0, 20, 40], greenTo: [10, 30, 50]
};

Has anyone got the same problem?

Any help is appeciated.

Thanks

asgallant

unread,
Jun 1, 2012, 12:59:08 PM6/1/12
to google-visua...@googlegroups.com
You can create up to three zones ('red', 'yellow', and 'green').  Use each one, and then set the color of each to green, ie:

var options {
    redFrom0,
    ​redTo10,
    yellowFrom20,
    yellowTo30,
    greenFrom40,
    greenTo50,
    redColor'green',
    yellowColor'green',
    greenColor'green'
Reply all
Reply to author
Forward
0 new messages