At the moment this only available with the 'barchart' package.

ChartMan

On Thu, Jul 8, 2010 at 4:43 PM, ChartMan <[email protected]> wrote:

> The correct way to set the bar chart selection in the tableHandler is:
> barchart.setSelection([{row:item.row, column:1}]);
>
> Note however that interaction in the new corechart package is still work in
> progress.
> you can see it working if you change the package to 'barchart'.
>
> Stay tuned to the group for when this will be available in the new
> corechart package.
>
>
> On Wed, Jul 7, 2010 at 6:25 PM, Dominic <[email protected]> wrote:
>
>> Thanks ChartMan, here goes:
>>
>> <!--
>>  copyright (c) 2009 Google inc.
>>
>>  You are free to copy and use this sample.
>>  License can be found here:
>> http://code.google.com/apis/ajaxsearch/faq/#license
>> -->
>>
>> <!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: ['corechart',
>> 'table']});
>>    </script>
>>    <script type="text/javascript">
>>    var map;
>>    var table;
>>    var data;
>>
>>    function drawBarChartAndTable() {
>>      var myDataArray = [['Thing01',10],['Thing02',20],['Thing03',30],
>> ['Thing04',40]];
>>      var data = new google.visualization.DataTable();
>>      data.addColumn('string', 'Thing');
>>      data.addColumn('number', 'value');
>>      data.addRows(myDataArray);
>>
>>      window.barchart = new
>> google.visualization.BarChart(document.getElementById('barchart'));
>>      barchart.draw(data, null);
>>      google.visualization.events.addListener(barchart, 'select',
>> barHandler);
>>
>>      window.table = new
>> google.visualization.Table(document.getElementById('table'));
>>      table.draw(data, null);
>>      google.visualization.events.addListener(table, 'select',
>> tableHandler);
>>    }
>>    function barHandler(){
>>      item = barchart.getSelection()[0];
>>      table.setSelection([{row:item.row, column:null}]);
>>    }
>>    function tableHandler(){
>>      item = table.getSelection()[0];
>>      // barchart.setSelection([{row:item.row, column:null}]);
>>      barchart.setSelection([{row:null, column:item.column}]);
>>    }
>>
>>
>>    google.setOnLoadCallback(drawBarChartAndTable);
>>    </script>
>>  </head>
>>  <body style="font-family: Arial;border: 0 none;">
>>    <table>
>>      <tr>
>>        <td>
>>          <div id="barchart" style="width: 300px; height: 300px;"></
>> div>
>>        </td>
>>        <td>
>>          <div id="table" style="width: 300px; height: 300px;"></div>
>>        </td>
>>      </tr>
>>    </table>
>>  </body>
>> </html>
>>
>> Or here:
>>
>>
>> http://savedbythegoog.appspot.com/?id=172fed9e1f9d2ed725b207ada0c6abd41b410f9a
>>
>> Your input is very welcome,
>>
>> Dom
>>
>>
>> On 7 July, 15:04, ChartMan <[email protected]> wrote:
>> > One more request - can you please send a code snippet that reproduces
>> the
>> > problem.
>> > You can use the playground -
>> http://code.google.com/apis/ajax/playground/?type=visualization#inter...
>> >
>> > <
>> http://code.google.com/apis/ajax/playground/?type=visualization#inter...>
>> > Thanks
>> > ChartMan
>> >
>> > On Wed, Jul 7, 2010 at 11:54 AM, Dominic <[email protected]>
>> wrote:
>> > > Hi there,
>> >
>> > > I'm using the corechart package, as well as the pie package and the
>> > > table one
>> >
>> > > Cheers,
>> >
>> > > Dom
>> >
>> > > On Jul 6, 10:37 pm, ChartMan <[email protected]> wrote:
>> > > > What package are you using for the BarChart ?
>> >
>> > > > On Mon, Jul 5, 2010 at 4:26 PM, Dominic <[email protected]>
>> wrote:
>> > > > > Hi there,
>> >
>> > > > > I've a google.visualization.BarChart and a
>> google.visualization.Table
>> > > > > on the same page, both are global variables (window.googleBar and
>> > > > > window.googleTable respectively). I've set up the BarChart so that
>> > > > > when a bar is clicked this happens:
>> >
>> > > > > var item = googleTable.getSelection()[0];
>> > > > > googleBar.setSelection([{row:item.row, column:null}]);
>> >
>> > > > > This means that when the bar is clicked the corresponding row in
>> the
>> > > > > table is highlighted. I'm after something that does the same but
>> the
>> > > > > other way around... such that when a table row is clicked a bar is
>> > > > > highlighted. I tried this:
>> >
>> > > > > var item = googleBar.getSelection()[0];
>> > > > > googleTable.setSelection([{row:item.row, column:null}]);
>> >
>> > > > > but nothing happens :-(
>> >
>> > > > > Anyone any ideas what I'm doing wrong?
>> >
>> > > > > Cheers,
>> >
>> > > > > Dom
>> >
>> > > > > --
>> > > > > 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]>
>> <google-visualization-api%[email protected]<google-visualization-api%[email protected]>
>> ><google-visualization-
>> > > api%[email protected]<api%[email protected]><
>> api%[email protected]<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]<google-visualization-api%[email protected]>
>> <google-visualization-api%[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]<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