It looks like Table visualizations have a problem with setSelection when
you pass them an object containing a "column" property. It looks like it
is trying to selection the specific cell in the table, even though
selecting cells isn't supported. Lets try this a slightly different way:
function dothetrick (event) {
var chartSelection = wykresall.getChart().getSelection();
var tableSelection = [];
for (var i = 0; i < chartSelection.length; i++) {
tableSelection.push({row: chartSelection[i].row});
}
tableall.getChart().setSelection(tableSelection);
alert("Event!");
}
On Sunday, January 6, 2013 11:55:59 AM UTC-5, Patryk D wrote:
>
> [Object]
>
> 1. 0: Object
> 1. column: 2
> 2. row: 0
> 3. __proto__: Object
> 2. length: 1
> 3. __proto__: Array[0]
>
>
> Both _proto_ contain multiple categories. I am not really sure what does
> that mean and what am I looking for.
>
> W dniu niedziela, 6 stycznia 2013 17:30:51 UTC+1 użytkownik asgallant
> napisał:
>>
>> Add "console.log(wykresall.getChart().getSelection()); to the event
>> listener, open the page in Chrome or Firefox, and see what gets logged in
>> the developer's console when you select something in the chart.
>>
>> On Sunday, January 6, 2013 8:05:16 AM UTC-5, Patryk D wrote:
>>>
>>> Yes, I did. Stupid mistake :) Still it is not working. The alert is
>>> shown, so there is no error, but no row is selected. If any row had been
>>> selected before event, it is deselected,
>>>
>>> W dniu sobota, 5 stycznia 2013 23:38:36 UTC+1 użytkownik asgallant
>>> napisał:
>>>>
>>>> "table" is not defined in your code, did you mean to have "tableall"
>>>> there?
>>>>
>>>> On Saturday, January 5, 2013 4:59:18 PM UTC-5, Patryk D wrote:
>>>>>
>>>>> Thank you for the answer, yet I am still missing something. Current
>>>>> code still doesn't get to the alert:
>>>>> google.visualization.events.addListener(wykresall, 'select',
>>>>> dothetrick);
>>>>> function dothetrick(event){
>>>>>
>>>>> table.getChart().setSelection(wykresall.getChart().getSelection(event));
>>>>>
>>>>>
>>>>> alert("Event!");
>>>>> };
>>>>> The code: page.
>>>>> <http://dydaktyk.ue.katowice.pl/~doroszp/wad/wad.php>Function
>>>>> is lines 330-335, dashboard: 253-255, table: 138-146, barchart:
>>>>> 99-116. They are showing the same data, because they are in the same
>>>>> dashboard. It is in same order, some other function is doing the trick.
>>>>>
>>>>> W dniu sobota, 5 stycznia 2013 22:15:50 UTC+1 użytkownik asgallant
>>>>> napisał:
>>>>>>
>>>>>> You need to get the chart objects to work on from the ChartWrappers,
>>>>>> so it would look more like this:
>>>>>>
>>>>>> thechartname.getChart().setSelection(thetablename.getChart().
>>>>>> getSelection());
>>>>>>
>>>>>> which should work, provided that both the chart and table are showing
>>>>>> the same rows of data in the same order. It gets more complicated if
>>>>>> they
>>>>>> are not.
>>>>>>
>>>>>> Your chart that has the min value from grouped data may or may not be
>>>>>> able to tie in with other charts, depending on whether or not you can
>>>>>> reverse the grouping to find out which row had the min value. If you
>>>>>> can't
>>>>>> identify which row had the min value, then you can't tie into the other
>>>>>> charts.
>>>>>>
>>>>>> On Saturday, January 5, 2013 2:52:13 PM UTC-5, Patryk D wrote:
>>>>>>>
>>>>>>> Hello!
>>>>>>> I am trying to achieve same effect as Events >> Interaction Using
>>>>>>> Events<https://code.google.com/apis/ajax/playground/?type=visualization#interaction_using_events>,
>>>>>>>
>>>>>>> but with two chartwrappers - table and barchart. So, choosing a bar in
>>>>>>> chartwrapper:barchart sets a corresponding row in chartwrapper:table
>>>>>>> selected. They are both in same dashboard, so I guess it should be
>>>>>>> possible, yet "thechartname.setSelection(thetablename.getSelection()
>>>>>>> );" is not working. Does anyone have any clue how to fix it? My
>>>>>>> project may be found
>>>>>>> here<http://dydaktyk.ue.katowice.pl/~doroszp/wad/wad.php>
>>>>>>> .
>>>>>>> I also wanted another chart to do the same thing, but it is a
>>>>>>> columnchart containing min value of grouped data. Is it possible?
>>>>>>> Would be grateful for any advices,
>>>>>>> Patryk
>>>>>>>
>>>>>>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/Lfzx3YfZct0J.
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.