Assuming I understand your question correctly, you can change the DataTable
as much as you want, and when you want to draw that data, call
chart.draw(data, options) again.

On Wed, Jun 30, 2010 at 1:50 AM, Student <[email protected]> wrote:

> Have one more question
>
> http://www.google.com/finance?q=INDEXDJX:.DJI,INDEXSP:.INX,INDEXNASDAQ:.IXIC
> in the above example of google finance we can add new column y
> writting names in the "compare" input box  in the left top most column
> of the chart.
> If i want to do the same stuff  do I have to query all those columns
> in advance or before the user call 's that particular column or is
> there way to add new column altogether in the chart
> at run time to the exsisting dataresult?
> I fell like they have done it by pre processing all the data values
> before hand( or may have used ajax to add column at run time "just a
> thought" )?
> can any one just an idea to do it?
> regards,
> Student
>
> On Jun 29, 6:29 pm, Student <[email protected]> wrote:
> > 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]<google-visualization-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
>
>

-- 
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