In order to make this work, both ATL chart objects have to be in the same 
scope, which can be accomplished in different ways, but the simplest in 
your case would involve combining your data queries into one: since they 
both query the same set of data but different columns, you can make one 
query and sort out the columns of data afterwards using DataViews. 
 Synchronizing the ranges of the ATL charts is done by using a 
"rangechange" event handler on each chart, each of which sets the range of 
the other chart.  Here's an example: http://jsfiddle.net/asgallant/wxMgK/

On Thursday, February 14, 2013 11:18:48 AM UTC-5, Miracles... wrote:
>
> I have two separate annotated time series on a page. If I change the range 
> for 1st time series then it should set the range of 2nd time series same as 
> 1st one automatically. Can anyone help me on how to do this?
>
>
> *Check the webpage where below code is working: *
> http://mysensex.weebly.com/sensex-analysis-part-iiia---nifty-chart.html
>
>
> *Below is the current code we have:*
>
> <!--
> You are free to copy and use this sample in accordance with the terms of 
> the
> Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
> -->
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
>   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
>   <title>Google Visualization API Sample</title>
>   <script type="text/javascript" src="http://www.google.com/jsapi
> "></script>
>   <script type="text/javascript">
>     google.load('visualization', '1', {packages: ['annotatedtimeline']});
>
> function drawVisualization() {
>   // To see the data that this visualization uses, browse to
>   // http://spreadsheets.google.com/ccc?key=pCQbetd-CptGXxxQIG7VFIQ  
>   var query2 = new google.visualization.Query(
>       '
> https://docs.google.com/spreadsheet/tq?key=0AlrIEZoufmNPdERqMlVtLXE0d3BKV0o2S1p3aE8tQ1E'
> );
>   var query1 = new google.visualization.Query(
>       '
> https://docs.google.com/spreadsheet/tq?key=0AlrIEZoufmNPdERqMlVtLXE0d3BKV0o2S1p3aE8tQ1E'
> );
>
>   // Apply query language.
>   query1.setQuery('SELECT A,O,T,U');
>   
>   // Send the query with a callback function.
>   query1.send(handleQueryResponse1);
>
>   
>   // Apply query language.
>   query2.setQuery('SELECT A,H,J,K');
>   
>   // Send the query with a callback function.
>   query2.send(handleQueryResponse2);
> }
>
> function handleQueryResponse2(response) {
>   if (response.isError()) {
>     alert('Error in query: ' + response.getMessage() + ' ' + 
> response.getDetailedMessage());
>     return;
>   }
>   
>   var data1 = response.getDataTable();  
>   var annotatedtimeline = new google.visualization.AnnotatedTimeLine(
>       document.getElementById('visualization1'));
>   annotatedtimeline.draw(data1, 
>                          {'displayAnnotations': false,
>                           'scaleType': 'maximized',
>                           'thickness': 2,
>                           'zoomStartTime': new Date(2009,0, 0),
>                           'displayExactValues': false
>                          });
> }
>   
> function handleQueryResponse1(response) {
>   if (response.isError()) {
>     alert('Error in query: ' + response.getMessage() + ' ' + 
> response.getDetailedMessage());
>     return;
>   }
>
>   
>   var data2 = response.getDataTable();  
>   var annotatedtimeline = new google.visualization.AnnotatedTimeLine(
>       document.getElementById('visualization2'));
>   annotatedtimeline.draw(data2, 
>                          {'displayAnnotations': false,
>                           'scaleType': 'maximized',
>                           'thickness': 2,
>                           'zoomStartTime': new Date(2009,0, 0),
>                           'displayExactValues': false
>                          });
>
> }
>     
>     
>     google.setOnLoadCallback(drawVisualization);
>   </script>
> </head>
> <body style="font-family: Arial;border: 0 none;">
> <b>S&P CNX Nifty Index</b>
> <div id="visualization2" style="width: 900px; height: 320px;"></div>   
> <br>
> <b>McClellan Summation Index</b> (modified)
> <br> 
> <div id="visualization1" style="width: 900px; height: 320px;"></div>
> </body>
> </html>
>
>
>

-- 
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 
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to