我确实有一个问题,那就是我想在一年内进行几项活动。

function drawVisualization() {
// Create and populate the data table.
  var data = google.visualization.arrayToDataTable([
  ['Year', 'Austria'],
  ['2003',  1336060],
  ['2004',  1538156],
  ['2005',  1576579],
  ['2006',  1600652],
  ['2007',  1968113],
  ['2007',  1968113],
  ['2007',  1968113],
  ['2007',  1968113],
  ['2008',  1901067]
]);


// Create and draw the visualization.
new google.visualization.BarChart(document.getElementById('visualization')).
    draw(data,
         {title:"Yearly Coffee Consumption by Country",
          width:600, height:400,
          vAxis: {title: "Year"},
          hAxis: {title: "Cups"}}
    );
}


该代码的结果是这样的:



是否有可能对此进行自定义以获得此结果?



如果使用Google Visualization API无法获得此结果,是否有一个具有此功能的JS框架?

最佳答案

尝试这个:

var data = google.visualization.arrayToDataTable([
['Year', 'Austria'],
['2003',  '', '', '1336060'],
['2004',  '', '', '1538156'],
['2005',  '', '', '1576579'],
['2006',  '', '', '1600652'],
['2007',  '1968113', '1968113', '1968113'],
['2008',  '', '', 1901067]
]);

07-24 17:40