Google组合图表的折线图数据点

时间:2014-07-03 13:00:24

标签: javascript charts

我正在使用Google组合图表

<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="//www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load('visualization', '1', { packages: ['corechart'] });
    </script>
    <script type="text/javascript">
        function drawVisualization() {

            var data = google.visualization.arrayToDataTable([
              ['Month', 'Madagascar', 'Rwanda', 'Average'],
              ['2004/05', 165, 938, 614.6],
              ['2005/06', 135, 1120, 682],
              ['2006/07', 157, 1167, 623],
              ['2007/08', 139, 1110, 609.4],
              ['2008/09', 1026, 366, 569.6]
            ]);

            var ac = new google.visualization.ComboChart(document.getElementById('visualization'));
            ac.draw(data, {
                title: 'Monthly Coffee Production by Country',
                width: 600,
                height: 400,
                vAxis: { title: "Cups" },
                hAxis: { title: "Month" },
                seriesType: "bars",
                series: { 2: { type: "line", curveType: "function", pointSize: 8 } }
            });            

        }
        google.setOnLoadCallback(drawVisualization);
    </script>
  </head>
  <body style="font-family: Arial;border: 0 none;">
    <div id="visualization" style="width: 600px; height: 400px;"></div>
  </body>
</html>

现在它正确地创建了Google Combo Chart,但我的要求是折线图必须让每个数据点位于每个蓝色条列的中间,而不是红色条的左上角柱。要查看此内容,请将以上代码复制并粘贴到html页面中,然后在浏览器中查看此页面。

0 个答案:

没有答案