微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何将php变量放入FusionCharts数据集中

如何解决如何将php变量放入FusionCharts数据集中

$sql = "SELECT * FROM ypo2019 WHERE description = 'DPR Prepared'";
    $data = MysqLi_query($con,$sql);
    while($row = MysqLi_fetch_assoc($data) )
    {
        
        echo $lundra1 = $row['lundra'];
        $ghargoda1 = $row['ghargoda'];
        $shankargadh1 = $row['shankargarh'];
        $pratappur1 = $row['pratappur'];
        $charma1 = $row['charama'];
        $bharatpur1 = $row['bharatpur'];
        $carmdaksh1 = $row['carmdaksh'];
        $pali1 = $row['pali'];
        $magarload1 = $row['magarload'];
        $bodla1 = $row['bodla'];
        $chhindgarh1 = $row['chhindgarh'];
        $dantewada1 = $row['dantewada'];
        $bakawand1 = $row['bakawand'];
        $narharpur1 = $row['narharpur'];
        $total1 = $row['total'];
                                
    }

以上,我已经从数据库提取了要放入图表中的值 在下面,我想用存储在我的PHP变量中的值替换认值

$columnChart = new FusionCharts("overlappedbar2d","ex1","100%",400,"chart-1","json",'{
  "chart": {
    "caption": "DPR Prepared vs DPR Approved","animation": "true","animationDuration" : "2","labelBinSize" :"0","subcaption": "DPR Data","yaxisname": "Number of DPR","numberprefix": "","labelFontSize":"13","drawcrossline": "1","canvasBgColor" : "#001c38","theme": "fusion","showvalues": "0"
  },"categories": [
    {
      "category": [
        {
          "label": "Lundra"
        },{
          "label": "Ghargoda"
        },{
          "label": "Shankargarh"
        },{
          "label": "Pratappur"
        },{
          "label": "Charama"
        },{
          "label": "Bharatpur"
        },{
          "label": "Carmdaksh"
        },{
          "label": "Pali"
        },{
          "label": "Magarload"
        },{
          "label": "Bodla"
        },{
          "label": "Chhindgarh"
        },{
          "label": "dantewada"
        },{
          "label": "Bakawand"
        },{
          "label": "Narharpur"
        }
      ]
    }
  ],"dataset": [
    {
      "color":"#001c38","seriesname": "Target","data": [
        {
          "value": $lundra1 
        },{
          "value": "200000"
        },{
          "value": "300000"
        },{
          "value": "270000"
        },{
          "value": "350000"
        },{
          "value": "250000"
        },{
          "value": "150000"
        },{
          "value": "200000"
        }
      ]
    },{
      "seriesname": "Achieved","color":"#f67712","data": [
        {
          "value": "$lundra2"
        },{
          "value": "180000"
        },{
          "value": "290000"
        },{
          "value": "195000"
        },{
          "value": "380000"
        },{
          "value": "210000"
        }
      ]
    }
  ]
}');

$columnChart->render();

但是当我简单地放置变量时,我的图表无法呈现。我认为不能正确输入值,有人可以告诉我我做错了什么,如何将PHP变量替换为认值

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。