1
嗨我想在谷歌條形圖下面的東西。 Google Chart with extended X Axis
以上只是兩個日期兩次擴展X軸的示例。我試着動態設置2日期,輸出如下圖所示。
的代碼如下,但我並沒有設定以下產品「A」日期取得突破,「B」等來做到這一點有什麼建議?我沒有使用 hAxis傾斜是:{title:「時間軸」,textPosition:「走出去」,slantedText:真正}我發現了上述問題的好辦法,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
<script type="text/javascript">
function drawVisualization() {
// Some raw data (not necessarily accurate)
var data = google.visualization.arrayToDataTable([
['product', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua New Guinea', 'Rwanda', 'Average'],
['A', 165, 938, 522, 998, 450, 614.6],
['B', 135, 1120, 599, 1268, 288, 682],
['C', 157, 1167, 587, 807, 397, 623],
['D', 139, 1110, 615, 968, 215, 609.4],
['E', 136, 691, 629, 1026, 366, 569.6],
['product', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua New Guinea', 'Rwanda', 'Average'],
['A', 165, 938, 522, 998, 450, 614.6],
['B', 135, 1120, 599, 1268, 288, 682],
['C', 157, 1167, 587, 807, 397, 623],
['D', 139, 1110, 615, 968, 215, 609.4],
['E', 136, 691, 629, 1026, 366, 569.6]
]);
var options = {
title : 'Monthly Coffee Production by Country',
vAxis: {title: "Cups"},
hAxis: {title: "TIME FRAME"},
seriesType: "bars",
};
var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
多級軸像這樣的不受Visualization API支持。您可以使用多個「域」[列角色](https://developers.google.com/chart/interactive/docs/roles#domainrole)。 – asgallant