1

这是我的图表的简化版本:

<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 jsonData = '{"cols":[{"id":"","label":"date","type":"string"},{"id":"","label":"a","type":"number"},{"id":"","label":"b","type":"number"}],"rows":[{"c":[{"v":"2012-05-01"},{"v":"1"},{"v":"8"}]},{"c":[{"v":"2012-05-02"},{"v":"1"},{"v":"7"}]},{"c":[{"v":"2012-05-03"},{"v":"1"},{"v":"38"}]}]}';

                    var data = new google.visualization.DataTable(jsonData);    
                    var options = {
                        title       : 'Company Performance',
                        pointSize   : 5,
                        chartArea: {width: 800, height: 800},
                        width: 800+300, height: 800+600,
                        legend:{position: 'bottom',maxLines: 3},
                        vAxis:  {direction:-1, minValue: 1, viewWindowMode: 'explicit', viewWindow:{min:1}},
                        colors      : ['#0E9DFF','#9616F3']
                    };

                var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
                chart.draw(data, options);
              }
        </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

我的目标是将 vAxis 的最小值设置为 0。
它有效,但如何使其显示?
以及如何将水平轴移动到底部?

4

0 回答 0