How to add another data series to a Google chart

前端 未结 1 856
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-06 02:08

I have setup a simple Google Chart by following the example on this page: http://code.google.com/apis/chart/interactive/docs/gallery/linechart.html

 google.l         


        
相关标签:
1条回答
  • 2021-01-06 02:32

    You need to add new data to 'data' variable and call the chart.draw() method again. See the DataTable docs or play a bit at http://code.google.com/apis/ajax/playground/?type=visualization#line_chart

    Example:

      // Add columns
      data.addColumn('string', 'Employee Name');
      data.addColumn('date', 'Start Date');
    
      // Add empty rows
      data.addRows(6);
      data.setCell(0, 0, 'Mike');
      data.setCell(0, 1, {v:new Date(2008,1,28), f:'February 28, 2008'});
      data.setCell(1, 0, 'Bob');
      data.setCell(1, 1, new Date(2007, 5, 1));
      data.setCell(2, 0, 'Alice');
      data.setCell(2, 1, new Date(2006, 7, 16));
      data.setCell(3, 0, 'Frank');
      data.setCell(3, 1, new Date(2007, 11, 28));
      data.setCell(4, 0, 'Floyd');
      data.setCell(4, 1, new Date(2005, 3, 13));
      data.setCell(5, 0, 'Fritz');
      data.setCell(5, 1, new Date(2007, 9, 2));
    
    0 讨论(0)
提交回复
热议问题