10000) { echo "google.visualization.Query.setResponse({ version:'0.6', reqId:'$reqId', status:'error', errors:[{reason:'not_supported', message:'Maximum number of datapoints exceeded'}] });"; exit; } // output the header part of the response echo "google.visualization.Query.setResponse({ version:'0.6', reqId:'$reqId', status:'ok', table:{ cols:[ {id:'x', label:'x', type:'number'}, {id:'y', label:'y', type:'number'}, {id:'value', label:'', type:'number'} ], rows:["; // output the actual values $first = true; $xstep = ($xmax - $xmin) / $xstepnum; $ystep = ($ymax - $ymin) / $ystepnum; for ($x = $xmin; $x < $xmax; $x+=$xstep) { for ($y = $ymin; $y < $ymax; $y+=$ystep) { $value = custom($x,$y); if (!$first) { echo ",\n"; } else { echo "\n"; } echo " {c:[{v:$x}, {v:$y}, {v:$value}]}"; $first = false; } } // output the end part of the response echo " ] } }); "; /** * Retrieve the request id from the get/post data * @return {number} $reqId The request id, or 0 if not found */ function getReqId() { $reqId = 0; foreach ($_REQUEST as $req) { if (substr($req, 0,6) == "reqId:") { $reqId = substr($req, 6); } } return $reqId; } ?>