How do I make two y-axis's baseline same line in combo chart?

37 views
Skip to first unread message

Ziming Wang

unread,
Feb 3, 2020, 11:20:17 AM2/3/20
to Google Visualization API
As the screenshot shown, two baseline are two different lines. How can I make them same line in combo chart? Thanks!
Here is the chart's option: 
options={{
  pointsVisible: true,
  vAxes: {
    0: { format: 'decimal', baselineColor: 'red' },
    1: { format: 'percent', baselineColor: 'blue' },
  }​,
  series: {
    0: { type: 'bars', targetAxisIndex: 0 },
    1: { type: 'line', targetAxisIndex: 1 },
  },
}}
combo_chart.png

Daniel LaLiberte

unread,
Feb 3, 2020, 11:40:39 AM2/3/20
to Google Visualization API
Hi Ziming Wang,

Currently, there is no automatic coordination between the two y axes, so it is up to you to constrain the viewWindow for each such that the baselines will be aligned.  You might get the range of values for each axis so that you can then scale one axis range to correspond to the other.  But then you also have to anticipate what the axis tick values and gridlines will be based on the rounding heuristics.   This is non-trivial, I realize, but the complexity of how to do this is also why we haven't offered it as a built-in feature that can be applied in all situations.  I hope that helps.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/e8c16f13-0e4b-4dd4-803d-ae68572e5a84%40googlegroups.com.


--
dlaliberte@Google.com   Cambridge MA
go/gviz-headcount
Reply all
Reply to author
Forward
0 new messages