Sorry Frnds,
 var Query should be  global.... bad mistake :(

On Jun 29, 5:32 pm, Student <[email protected]> wrote:
> I draw diagram with 4 column say D ,A ,B ,C
> when i user clicks a button i want the annoted chart to draw the
> diagram with the same dataset on column D, A, B only and remove C in
> the diagram
> How can I do it
> I was tyring with the code below but failed
>
> <html>
> <head>
>
>   <script type="text/javascript" src="http://www.google.com/jsapi";></
> script>
>   <script type="text/javascript">
>
>   google.load('visualization', '1', {'packages':
> ['annotatedtimeline']});
>
>   google.setOnLoadCallback(init);
>
>   .
>   function init() {
>
>     // Specify the data source URL.
>     var query = new google.visualization.Query('MyServlet');      //by
> default column D,A,B,C are selected to draw the chart
>
>     // Send the query with a callback function.
>     query.send(handleQueryResponse);
>   }
>
>   // Handle the query response.
>   function handleQueryResponse(response) {
>     if (response.isError()) {
>       alert('Error in query: ' + response.getMessage() + ' ' +
> response.getDetailedMessage());
>       return;
>     }
>
>     // Draw the visualization.
>     var data = response.getDataTable();
>     var chart = new
> google.visualization.AnnotatedTimeLine(document.getElementById('chart_div') );
>     chart.draw(data, {scaleType: 'allmaximized' ,displayAnnotations:
> true});
>   }
>
> function itemSelect(){
>
>            query.setQuery('select D,A,B');         /// I want to
> select D,A,B column only on button click
>
>           query.send(handleQueryResponse);
>
> }
>
>   </script>
> </head>
> <body >
>
>   <div id="chart_div" style='width: 700px; height:240px;'></div>
>
>   <input type="submit" value="see" name="see" onclick="itemSelect()" />  
> <--select function to requery
>
> </body>
> </html>
>
> Can you suggest the best way to do it?
> thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to