Google Charts - Changing the Axis Name Orientation

I am using a simple line chart from google charts.

I have two problems:

  • The vertical and horizontal axes have a header. But I can’t change my orientation. I want the vertical name to be written horizontally, not vertically. Does vAxis and hAxis seem to have no orientation options, no tips?

  • The same goes for the horizontal legend. it is written horizontally and transformed diagonally when there is a lot of information. I want to write diagonally every time.

So basically the two questions are the same. How to change the orientation of the text?

Thanks!

+4
source share
3 answers

There is a workaround for this. There is already a question regarding this. You look at Vertical Labels with the Google Maps API . Hope this helps you.

+2
source

Now it’s possible:

var options = { title: "Test", hAxis: { direction: -1, slantedText: true, slantedTextAngle: 90 // here you can even use 180 } }; 
+7
source

There is currently no way to rotate the name of the vertical axis, sorry.

Regarding the conversion of headings in the horizontal axis, you are in the extreme case of whether your graph is continuous or discrete. If your data is discrete, you can use the slantedText option. So, to summarize, make sure you have discrete data and set the above option.

+1
source

Source: https://habr.com/ru/post/1492335/


All Articles