在這裏,我使用堆疊柱狀圖。在這張圖表中,我試圖顯示註釋值。註釋值顯示在欄頂部。但我需要顯示在底部的值。如何在谷歌api圖表的堆積列圖表中使用底部欄中的註釋顯示軸值?
實際:
除外:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Line chart for DAR</title>
<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 =new google.visualization.DataTable();
data.addColumn({type: 'string', label: 'label'});
data.addColumn({type: 'number', label: 'No visits'});
data.addColumn({type: 'number', label: 'All members'});
data.addColumn({type: 'number', role: 'annotation'});
data.addRows([['<2', 25, 23, 23],
['2-5', 36, 37, 37],
['6-8', 18, 19, 19],
['9-11', 25, 26, 26],
['12-15', 25, 24, 24],
['16-19', 25, 21, 21],
['20-34', 25, 22, 22],
['35-49', 25, 28, 28],
['50-64', 25, 29, 29],
['65-74', 25, 30, 30],
['75+', 25, 25, 25]
]);
var options = {
isStacked: true,
vAxis: {
baselineColor: '#fff',
gridlineColor: '#fff',
textPosition: 'none'
},
tooltip: {
trigger: 'none'
},
series: {
0: {
color: '#4169E1'
},
1: {
color: '#87CEFA'
}
}
};
var chart = new google.visualization.ColumnChart(document.getElementById('columnchart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="columnchart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
沒有辦法來控制註釋的位置。 – asgallant