Frage

I read now this tutorial fo developers: https://developers.google.com/chart/interactive/docs/gallery/columnchart

Using object hAxis and parametr direction i try to show only positive axis of my chart. Also i wanna, that my axis be only integer numbers, now it is 0.5, 1, 1.5 Thanks!

War es hilfreich?

Lösung

vAxis: {viewWindowMode: "explicit", viewWindow:{ min: 0 }}

Andere Tipps

The direction option only controls the direction of the axis (left-to-right, or right-to-left), not what values are shown. Use the hAxis.viewWindow.min and hAxis.viewWindow.max options to control the range of values displayed on the axis. Setting hAxis.viewWindow.min to 0 will prevent any negative numbers from showing up.

Keep in mind that the columns are centered on their axis values, so if you have any columns at 0, you have to give them a bit of space to the left of 0 to draw all of the columns. Similarly, they need a bit of space to the right of the max value to fit all of the columns.

By default, the ColumnChart will try to place 5 axis tick marks (which you can change by setting the hAxis.gridlines.count option), evenly spaced throughout your data. This can end up with some rather odd results. Sometimes you end up with decimals in the labels that can be safely ignored (this is especially true when your axis spans a large numeric distance); in this case, you can set the hAxis.format option to drop decimals (eg, '#,###'). If your data spans a smaller range, you might be better served specifying the hAxis.ticks option, which takes an array of values to place tick marks at.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top