PHP not selecting the JSON Data.

791 views
Skip to first unread message

Spectre

unread,
Jan 26, 2018, 1:51:43 PM1/26/18
to Google Visualization API
So my issue is trying to use Google Charts offline because my client needs to have it entirely offline for purposes of security and possible exploitation and injection purposes using code that is embedded into their security they already built okay. So here is my issue though. I can't get my PHP file to select what data rows I want it to read.  Now mind you I'm just trying to get the PHP Query to read the JSON file. And to be honest this is my first project ever using PHP and JSON. Any help would be appreciated.


<html>
 
<head>
   
<script type="text/javascript" src="loader.js"></script>
     
<script type="text/javascript" src="jquery.min.js"></script>
   
<script type="text/javascript">
 google
.charts.load('current', {
  packages
:['controls', 'corechart', 'table']
}).then(function () {
 
var wrapper = new google.visualization.ChartWrapper( {
    chartType
: 'PieChart',
 

   
//query: 'SELECT A,COUNT(A) WHERE B > 100 GROUP BY A',
    options
: {title: 'Test', legend: 'none'},
    containerId
: 'vis_div'
 
});
  wrapper
.draw()
});
   
var jsonData = $.ajax({
          url
: "getData.php",
          dataType
: "json",
          async
: false
         
}).responseText;
   
</script>
 
</head>
 
<body style="font-family: Arial;border: 0 none;">
   
<div id="vis_div" style="width: 600px; height: 600px;"></div>
 
</body>
</html>

<?php

// This is just an example of reading server side data and sending it to the client.
// It reads a json formatted text file and outputs it.

$string
= file_get_contents("json.JSON");
echo $string
;
$need
= array(
   
'Status Codes',
   
'Purchase Order',
);

// Instead you can query your database and parse into JSON etc etc

?>


/*O_o*/
google
.visualization.Query.setResponse({"version":"0.6","reqId":"0","status":"ok","sig":"308659504","table":{"cols":[{"id":"A","label":"Status Code","type":"string"},{"id":"B","label":"Purchase Order","type":"number","pattern":"General"}],"rows":[{"c":[{"v":"OPEN/NO RECEIPTS"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"PARTIAL RECEIPTS"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"PARTIAL RECEIPTS"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/MATL RCPT"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/MATL RCPT"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/MATL RCPT"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/MATL RCPT"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/MATL RCPT"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/MATL RCPT"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/RELEASED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/PACKED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]},{"c":[{"v":"COMPLETE/DELIVERED"},{"v":1.11899737E8,"f":"111899737"}]}]}});


Alexandre Rodrigues

unread,
Jul 23, 2019, 5:34:05 PM7/23/19
to Google Visualization API
Estou com a mesma duvida;
Reply all
Reply to author
Forward
0 new messages