Question

How do I vertically align label in google chart say on y or r axis?

Was it helpful?

Solution

There is a question already asking this - Vertical labels with google charts API? - but it seems that no, you cannot put vertical labels on the charts yet.

OTHER TIPS

Yes, vertical Align is possible now.

You can do them by

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

I am adding full codes for testing

 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
          google.load("visualization", "1", {packages:["corechart"]});
          google.setOnLoadCallback(drawChartModeldaily);

          function drawChartModeldaily() {
            var data = google.visualization.arrayToDataTable(
                [
                    ['daily', 'Views', 'Likes'],
                    ['Tue',  4, 19],
                    ['Mon',  22, 16],
                    ['Sat',  3, 1],
                    ['Fri',  15, 34],
                    ['Thu',  27, 44],
                    ['Wed',  17, 23],
                ]
            );

var options = {
  title: "Test",
   hAxis: {
        direction:-1,
        slantedText:true,
        slantedTextAngle:90
    }
};

var chart = new google.visualization.LineChart(document.getElementById("chart_div_daily"));
chart.draw(data, options);
          }
        </script>
     <div id="chart_div_daily" style="width: 900px; height: 500px;"></div>

I am working with latest Google Chart. Please check them at https://developers.google.com/chart/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top