0
我想在谷歌图表中自定义垂直轴的值。在他们的文档中,我找到了属性this.It被放置在代码中的注释(// --- additionaly added ..)之间,但该图形没有被绘制。有谁知道可能是什么问题?谷歌图表不能正常工作的viewWindow属性
<link rel="shortcut icon" href="images/superGear.ico">
<link rel="icon" type="image/png" href="images/superGear.png">
<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([
['Year', 'Sales', 'Expenses'],
['2013', 1000, 400],
['2014', 1170, 460],
['2015', 660, 1120],
['2016', 1030, 540]
]);
var options = {
title: 'Company Performance',
hAxis: {title: 'Year', titleTextStyle: {color: '#333'}},
// ADDITIONALY ADDED--------------
vAxis: {
viewWindowMode:'explicit',
viewWindow:{ min:90, max :100 }
//---------------------------------
};
var chart = new google.visualization.AreaChart(document.getElementById('lastMonth'));
chart.draw(data, options);
}
</script>
和DIV放入体内,用于显示图形
<div id="lastMonth" style="height: 500px;"></div>