I have my livedata.php(the time_stamp(named ts),ph,moist are data values in my database) in json format showing:
[{"ts":"12","ph":736,"moist":92},{"ts":"27","ph":0,"moist":0},{"ts":"21","ph":192,"moist":24},{"ts":"15","ph":0,"moist":0}]
Now my problem is with this code below I found which is working to their example but trying to my php json fails.
function drawChart() {
var jsonData = $.ajax({url: 'livedata.php',dataType: 'json',async: false}).done(function (results) {var data = new google.visualization.DataTable(jsonData);data.addColumn('datetime', 'time_stamp');data.addColumn('number', 'ph');data.addColumn('number', 'moist');$.each(results, function (i, row) {data.addRow([(new Date(row.time_stamp)),parseFloat(row.ph),parseFloat(row.moist)]);});var chart = new google.visualization.LineChart($('#chart').get(0));chart.draw(data, {title: 'Soil Analysis'});});}// load chart libgoogle.load('visualization', '1', {packages: ['corechart']});// call drawChart once google charts is loadedgoogle.setOnLoadCallback(drawChart);