php - Converting json data do google chart -


so i'm using curl in php, access json object , data it. getting data, not understand how can draw chart information.

here php script:

<?php // generated curl-to-php: http://incarnate.github.io/curl-to-php/ $ch = curl_init(); curl_setopt($ch, curlopt_url, " https://xxx.xxx.pt/api/objgroupinfo/16jcr05g37kplklz"); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_customrequest, "get"); $headers   = array(); $headers[] = "x-apikey: xxxxxxxxxxxxxxxxxxxxxxxx"; curl_setopt($ch, curlopt_httpheader, $headers); curl_setopt($ch, curlopt_ssl_verifypeer, false); $result = curl_exec($ch); if (curl_errno($ch)) {     echo 'error:' . curl_error($ch); } curl_close($ch); // generated curl-to-php: http://incarnate.github.io/curl-to-php/ $ch = curl_init(); curl_setopt($ch, curlopt_url, " https://xxx.xxxxx.pt/api/dataout/iafhaftiuzrcje5q.json"); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_customrequest, "get"); $headers   = array(); $headers[] = "x-apikey: xxxxxxxxxxxxxxxxxxxx"; $headers[] = "x-startdate: 2016-10-01 00:00:00"; $headers[] = "x-enddate: 2016-10-10 15:00:00"; $headers[] = "x-channelnum: 0"; $headers[] = "x-reclimit: 200"; $headers[] = "user-agent: xxxx/1.0"; curl_setopt($ch, curlopt_httpheader, $headers); curl_setopt($ch, curlopt_ssl_verifypeer, false); $result = curl_exec($ch); if (curl_errno($ch)) {     echo 'error:' . curl_error($ch); } $json = json_decode($result, true); print_r($json); echo "<h1> loll </h1>"; echo $json['location']; echo "<br>"; echo $json['object_name']; echo $json['channels']; ($i = 0; $i < count($json['channels']); $i++) {     echo $json['channels'][$i]; } curl_close($ch); ?> 

i getting this:

enter image description here

i used json_decode transform data php array, how can used data build graph it?

demo below ,let me know if doubts.

you have choose anular js quicker implementation.

 <div>  <div google-chart chart="chart" style="{{chart.cssstyle}}"/> 

demo


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -