0

我想在谷歌可视化图表中使用函数值。但这不起作用,为什么?我正在使用以下代码:

 google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses'],
          ['2004',  200,    <script language="Javascript">display('2')</script>],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2004',  200,      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);
      }
4

0 回答 0