Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Charts - change axis title orientation

I'm using a simple Line Chart from Google Charts.

I have two problems:

  • Vertical and horizontal axis have a title. But I can't change their orientation. I want the vertical title written horizontally instead of vertically. vAxis and hAxis don't seem to have orientation options, any tips?

  • The same for horizontal legend. it is written horizontally and transforming en diagonal when there are a lot of info. I want to writes it everytime en diagonal.

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

Thank!

like image 719
Yoann Augen Avatar asked Dec 15 '22 08:12

Yoann Augen


2 Answers

It is possible now:

var options = { 
    title: "Test", 
    hAxis: { 
        direction: -1, 
        slantedText: true, 
        slantedTextAngle: 90 // here you can even use 180 
    } 
};
like image 140
Mehul Gayate Avatar answered Jan 28 '23 19:01

Mehul Gayate


There is a workaround for this. Already there is a question regarding this. You take a look at this Vertical labels with google charts API?. Hope this will help you.

like image 24
Abinaya Selvaraju Avatar answered Jan 28 '23 21:01

Abinaya Selvaraju