2014-01-06 133 views
1

以下代碼使水平堆疊的條形圖,看起來像這樣:設置上水平堆積條形圖垂直軸的垂直高度

enter image description here

如果更改高度屬性50和groupWidth到40%,圖例消失,圖表看起來像這樣:enter image description here

問題1:如何設置酒吧的高度並仍然顯示圖例?
問題2:我怎樣才能讓水平和垂直軸消失?

什麼我真的想做到的是這樣一幅畫面:

enter image description here

<html> 
    <head> 
    <script type="text/javascript" src="https://www.google.com/jsapi"></script> 
    <script type="text/javascript"> 
     google.load("visualization", "1", {packages:["corechart"]}); 
     google.setOnLoadCallback(drawChart); 
     function drawChart() { 
     var data = google.visualization.arrayToDataTable([ 
      [' ', 'Sales', 'Expenses'], 
      [0 , 1000,  400], 
     ]); 

     var options = { 
      isStacked: true, 
      width: 200, 
      height: 60, 
      vAxis: {gridlines: {count: 0}},      
      hAxis: {gridlines: {count: 0}},   
      bar: {groupWidth: "90%"}, 
      legend: {position: 'top'} 

     }; 

     var chart = new google.visualization.BarChart(document.getElementById('chart_div')); 
     chart.draw(data, options); 
     } 
    </script> 
    </head> 
    <body> 
    <div id="chart_div" ></div> 
    </body> 
</html> 

回答

1

設置chartArea.top選項向下移動圖表區域,並賦予傳奇房間畫:

chartArea: { 
    top: 15 
} 

jsfiddle

+0

每這一點 - 回答了關於這個傳說的部分。你偶然知道如何擺脫垂直和水平軸線? –

+1

其實只是自己找到了:** baselineColor:'none'** –