Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php、mysql和jQueryAjax的谷歌饼图_Php_Jquery_Google Pie Chart - Fatal编程技术网

使用php、mysql和jQueryAjax的谷歌饼图

使用php、mysql和jQueryAjax的谷歌饼图,php,jquery,google-pie-chart,Php,Jquery,Google Pie Chart,我正在创建google piecharts,但这里我必须使用iframe来显示此图表, 但是我想通过ajax展示它,而不使用iframe。。。。 有没有办法在没有iframe的情况下显示google piechart???您可以使用google chart api使用纯javascript显示piechart .您可以使用google图表api用纯javascript显示piechart .由@Grrbrr404提供的链接不再工作,因此,您可以像这样尝试 脚本 <script type="

我正在创建google piecharts,但这里我必须使用iframe来显示此图表, 但是我想通过ajax展示它,而不使用iframe。。。。
有没有办法在没有iframe的情况下显示google piechart???

您可以使用google chart api使用纯javascript显示piechart


.

您可以使用google图表api用纯javascript显示piechart


.

由@Grrbrr404提供的链接不再工作,因此,您可以像这样尝试

脚本

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">

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

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

function drawChart() {
  var jsonData = $.ajax({
      url: "getData.php",
      dataType:"json",
      async: false
      }).responseText;

  // Create our data table out of JSON data loaded from server.
  var data = new google.visualization.DataTable(jsonData);

  // Instantiate and draw our chart, passing in some options.
  var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
  chart.draw(data, {width: 400, height: 240});
}

</script>

显示此

由@Grrbrr404提供的链接不再工作,因此,您可以像这样尝试

脚本

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">

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

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

function drawChart() {
  var jsonData = $.ajax({
      url: "getData.php",
      dataType:"json",
      async: false
      }).responseText;

  // Create our data table out of JSON data loaded from server.
  var data = new google.visualization.DataTable(jsonData);

  // Instantiate and draw our chart, passing in some options.
  var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
  chart.draw(data, {width: 400, height: 240});
}

</script>
显示此