/** * addErrorFromQueryResponse * * @desc Pass a query response and error message container to this method: * if the query response indicates a query error, displays an error message * in the specified page element. If the query response is null, the method * will throw a Javascript error. Pass your QueryResponse received in your * query handler to this message to display an error. <br/> * It will also set the style of the display appropriate to the type (error * or warning, similar to addError(opt_options.type))<br/><br/> * <b>container</b> - The DOM element into which to insert the error message. * If the container cannot be found, the function will throw a JavaScript * error.<br/> * <b>response</b> - A QueryResponse object received by your query handler in * response to a query. If this is null, the method will throw a Javascript * error.<br/><br/> * * @param Google_Container $container * @param Google_Data_QueryResponse $response * @return string String ID value that identifies the error object created, * or null if the response didn't indicate an error. <br/> * This is a unique value on the page, and can be used to remove the error * or find its containing element.<br/> */ public function addErrorFromQueryResponse($container, $response) { $this->numOfArg = 2; $signature = array(); if (!$container instanceof Google_Container) { throw new InvalidArgumentException("expecting an instance of Google_Container"); } $signature[] = $container->getErrorContainer(); if (!$response instanceof Google_Data_QueryResponse) { throw new InvalidArgumentException("expecting an instance of Google_Data_QueryResponse"); } $signature[] = $response->getResponse(); $this->signature = array(); $this->signature = $signature; }
$chart = new Google_Chart($chartType, Google_Base::getElementById($id)); $options = new Google_Config($chartType); $options->setProperty("width", 550); $chart->draw("data", $options); # init functions $f1 = new Google_Function('drawVisualization'); $f2 = new Google_Function('handleQueryResponse', array('response')); # setup query $q = new Google_Data_Query($url); $q->setQuery($query); $q->send($f2->getName()); $f1->add($q); $f1->setCallBack(); $v->setFunction($f1); # setup response $qr = new Google_Data_QueryResponse(); $qr->asVar($chart->getDataTable())->getDataTable(); $f2->add($qr->render(true)); $chart->setDataTable("visualization"); $f2->add($chart->render()); $v->addFunction($f2); echo $v->render(); ?> </head> <body style="font-family: Arial;border: 0 none;"> <h1>Data Source Requests > Using The Query Language</h1> <div> <form method="post"> <select name="chartType"> <?php foreach ($chartTypes as $name) {