2016-09-02 50 views
2

在我的項目中我需要顯示特定地點的圖表,我用谷歌條形圖比較,我得到的圖形,但它出現在水平,但我需要垂直圖,我從早上在病房嘗試,但沒有運氣,請幫助。提前致謝。下面是我的代碼如何垂直顯示谷歌比較圖

<script type="text/javascript">  
google.charts.setOnLoadCallback(drawChart); 
imagepath_comparison=""; 
function drawChart() { 
var data = google.visualization.arrayToDataTable([<?=$data;?>]); 
var options = { 
title: 'GRAPH ANALYSIS', 
vAxis: {title: "SUBJECTS"}, 
hAxis: { 
title: "MARKS" 

} 
}; 

var chart3 = new google.visualization.BarChart   (document.getElementById("columnchart_material")); 
google.visualization.events.addListener(chart3, 'ready', function() { 
imagepath_comparison=chart3.getImageURI(); 
drawChart1(); 
}); 
chart3.draw(data, options); 
} 
</script> 
+1

你爲什麼不使用'ColumnChart'的縱向比較? –

回答

1

這是非常簡單的事情,需要改變顯示結果,我用ColumnChart代替條形圖當時我的問題得到解決。

我改變後的代碼是

<script type="text/javascript">  
google.charts.setOnLoadCallback(drawChart); 
imagepath_comparison=""; 
function drawChart() { 
var data = google.visualization.arrayToDataTable([<?=$data;?>]); 
var options = { 
title: 'GRAPH ANALYSIS', 
vAxis: {title: "SUBJECTS"}, 
hAxis: { 
title: "MARKS" 

} 
}; 

var chart3 = new google.visualization.BarChart    (document.getElementById("columnchart_material")); 
google.visualization.events.addListener(chart3, 'ready', function() { 
imagepath_comparison=chart3.getImageURI(); 
drawChart1(); 
}); 
chart3.draw(data, options); 
} 
</script>