1

I would like to plot two sets of values on a bar chart, that have different scales. For example, for each day of the week, I have a proportion (say the proportion of colleagues that were late that day) and a value (how late they were, on average).

These two values can be plot on two separate charts, but it would be useful to have them on the same, for better comparison. The problem is that they don't have the same scale, thus it's not possible to use one common scale for the Y axis. The solution is to have two separate scales for the Y axis.

Is it possible to do this using Google Chart Tools? I am using the JS api to generate interactive SVG charts, not the "still image" version.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Wookai
  • 20,883
  • 16
  • 73
  • 86

2 Answers2

3

This is possible with defining two axis:

 vAxis: {
     0: {
         viewWindow: {
             min: 0,
             max: 1000
         }
     },
     1: {
         viewWindow: {
             min: 0,
             max: 200
         }
     }
 }

This will plot the chart with two vertical axes, both with their own scale from min to max.

Jason Sturges
  • 15,855
  • 14
  • 59
  • 80
Postie
  • 43
  • 6
  • 2
    For anybody else who stumbled on this answer and has struggled with it, you'll probably need to also set the `series` attribute according to the chart instructions. It didn't seem to do anything for me without series specified. – Phil May 15 '13 at 22:57
  • 1
    @Phil and whoever else runs into this, see the answer to [this question](http://stackoverflow.com/questions/7256672/can-google-charts-support-dual-y-axis-v-axis). **Side Note:** You must use ColumnChart and not BarChart to do this with bars. – Michael Jun 20 '13 at 21:47
0

I was not able to find a way, so I switched to HighCharts for my plots. It can handle multiple y axes:

http://www.highcharts.com/demo/combo-dual-axes

Wookai
  • 20,883
  • 16
  • 73
  • 86