谷歌图表添加红线(平均)

时间:2016-11-21 21:09:12

标签: javascript html

我正在尝试使用php为avg添加一条红线,所以已经得到了值而不是确定如何在此图表中创建红线

我的代码:

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
 google.charts.load('current', {packages: ['corechart', 'bar']});
    google.charts.setOnLoadCallback(drawBasic);

    function drawBasic() {

          var data = google.visualization.arrayToDataTable([
            ['id', 'AVG',],
     ['12',30635],['54/951',25294],['60',29459],['61',30375],['69',33683],['84/907',24753],['94',26092],['121',34589],['293',36305],['400/460',44068],['401/461',43907],['412/220',34667],['459',48254],['462',43613],['654',32764],['657',39062],['670',36084],['671',34099],['672',31909],['673',35626],['674',32898],['704',31877],['908',24972]              ]);

          var options = {
            title: '2016 AVG',
            'width':800,
                 'height':900,
            hAxis: {
              title: 'avg',
              minValue: 0
            },
            vAxis: {
              title: 'P.S.D'
            }

          };

          var chart = new google.visualization.BarChart(document.getElementById('chart_div'));

          chart.draw(data, options);
        }   


</script>

0 个答案:

没有答案