谷歌列图表中没有列数

时间:2014-02-13 10:50:23

标签: jquery charts google-visualization

我正在使用Google柱形图,但是使用给定代码,垂直条的数量等于x轴和y轴上的数据的数量。但我正在尝试实现这样的图表http://www.teluguinvestor.com/live/nifty-live-open-interest-tracker.php,它只有5个X轴数据和4个Y轴数据,但没有垂直条纹更多

<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 data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses'],
          ['2004',  1000,      400],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2007',  1030,      540]
        ]);

        var options = {
          title: 'Company Performance',
          hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
        };

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

0 个答案:

没有答案