Frage

I am using the annotated time line chart in google charts API. I have a long time line of data (20 years) and range of the data goes from about 0 to 900,000 (see picture) If you zoom on the most recent year, the max from this set is only about 400,000. So when we zoom in, I don't need the y-axis to go all the way to 900,000, but only to 400,000. This way the chart would be easier to read.

What I would like to achieve is the chart to re-adjust the maximum vertical axis value every time I adjust the zoom.

enter image description here

Zoom in on most recent year:

enter image description here

Before I start hacking my way through this, does anyone know a good way to do this?

Thanks!

War es hilfreich?

Lösung

Use the scaleType configuration option. Specify value of maximized if you have one series. Specify allmaximized if you have more than one series. This snippet works on the code playground:

  var annotatedtimeline = new google.visualization.AnnotatedTimeLine(
      document.getElementById('visualization'));
  annotatedtimeline.draw(data, {'scaleType':'allmaximized'});
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top