doufulian4076 2018-03-10 20:36
浏览 64


What I am doing is : I have written a javascript code that will plot a Google Visualization piechart in my webpage. Script uses ajax to get the data from php file and php performs database operations and displays the required data in json format.

The problem is I am unable to get the exact chart, instead I get a chart with 100% written in the piechart and other written besides. Please see the attached image.

<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});  
function drawChart() 
  var jsonData = $.ajax({
                          url: "getdata.php?tab=Cr",
                          dataType: "json",
                          async: false
  var data = new google.visualization.DataTable(jsonData);
  var options = {'title':'Numbers', 'width':500, 'height':350};
  var chart = new 
  chart.draw(data, options);

output of getdata.php?tab=Cr

        [  {"id":"Department","type":"string"},

Please help me to get the expected chart with department names beside the chart.

enter image description here

  • 写回答



      相关推荐 更多相似问题


      • ¥15 使用DWY100k数据集对UEA进行测试,出现报错:IndexError: index 125000 is out of bounds for axis 0 with size 95500
      • ¥15 前端vue实现根据图片url生成pdf文件
      • ¥15 RfidReader资源Q个
      • ¥20 user-agent是否是唯一的,有没有可能相同
      • ¥15 关于#开会#的问题,如何解决?(语言-c++)
      • ¥15 关于#二十四点问题#的问题
      • ¥15 运行kitex的demon出错(求大家解决)
      • ¥15 开发一个类似 typora 这样的软件需要多少钱?
      • ¥15 clearcase7.0安装包
      • ¥15 断点回归模型月度核密度检验不连续