Daniel, thanks for help. Here is answer:
php script
$return = array();
while ($row = pg_fetch_array($result)) {
$return[] = array((int)$row[0],(int)$row[1]);
}
pg_close($db);
//var_dump($return);
echo $data=json_encode($return);
?>
Result is: [[6,4],[6,5],[7,6],[9,8],[5,9]]
and part of HTML code
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'ph');
data.addColumn('number', 'number');
var jsonData = $.ajax({
url: "getData2.php",
dataType: "json",
async: false
}).responseText;
var obj = JSON.parse(jsonData);
data.addRows(obj);
I am still having problems with format 'date', because I want to display
date on hAxis, JSON with date(as string) looks like:
[[6,"2017-11-05"],[6,"2017-10-30"],[7,"2017-10-29"],[9,"2017-10-28"],[5,"2017-10-27"]]
*How to format dates now in google charts?*
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/1a19711c-704c-4005-a8db-a95e98e4db98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.