2009-06-29 194 views

回答

18

是的,垂直對齊現在是可能的。

您可以通過

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

做他們我加入全碼測試

<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> 

我與谷歌最新的圖工作。請檢查他們在https://developers.google.com/chart/