相关疑难解决方法(0)

用JSON绘制谷歌图表

如果它是一个单独的JSON文件,我如何检索和使用谷歌图表的数据集?我试过jQuery getJSON但是无法让它工作..谷歌Viz应该使用JSON绘制条形图是否有原生的谷歌API方式?或者我可以找到使用jQuery的方法以及如何使用?谢谢

      // Load the Visualization API and the piechart package.
  google.load('visualization', '1.0', {'packages':['corechart']});

  // Set a callback to run when the Google Visualization API is loaded.
  google.setOnLoadCallback(drawChart);

  // Callback that creates and populates a data table, 
  // instantiates the pie chart, passes in the data and
  // draws it.
  function drawChart() {

      // Create the data table.
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Products');
      data.addColumn('number', 'Automated');
      data.addRows([
        ['Product 1', 85],
        ['Product 2', 75],
        ['Product 3', 90], 
        ['Product 4', 40], …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery google-visualization

10
推荐指数
1
解决办法
5万
查看次数

标签 统计

ajax ×1

google-visualization ×1

javascript ×1

jquery ×1