I think I see the problem here: this code tests the series' column index in 
the base data against the number of selected series, which will give you 
bad results when you remove data series from the selection.  I think the 
easiest fix would be to set a variable with the number of series in the 
base data set (referenced as "baseNumberOfSeries" below), and compare with 
that instead of the "numberOfSeries" varable:

var series = {};
var numberOfSeries = columnIndices .length - 1; 
for ( var i = 0; i < numberOfSeries; i++) {
series[i] = {
targetAxisIndex: (columnIndices [i + 1] <= baseNumberOfSeries / 2) ? 0 : 1
};
}
chart.setOption('series', series);

You can set that base number at the time the join is performed, so you 
don't have to recalculate every time.  It would be something like:

var baseNumberOfSeries = joinedDataTable.getNumberOfColumns() - 1;

Assuming that you have 1 domain column and the rest are the doubled up data 
columns.

On Monday, February 25, 2013 11:32:17 AM UTC-5, Workaholic wrote:
>
> Hi,
> I have two pivoted table, as in previous pics, that I joined.
> The columns labels are doubled(for example : Date, Australia, Japan, 
> Korea, Australia, Japan, Korea).
> So the columnIndices contains when all are chosen: 0,1,2,3,4,5,6.
> I want it to draw each y axis to each group of countries. 
> In that case defining the chart series as:
> var series = {};
> var numberOfSeries = columnIndices .length - 1; 
> for ( var i = 0; i < numberOfSeries; i++) {
> series[i] = {
> targetAxisIndex: (columnIndices [i + 1] <= numberOfSeries / 2) ? 0 : 1
> };
> }
> chart.setOption('series', series);
> works good.
> But when the filter state changes(for example not choosing Japan), the 
> columnIndices contains 0,1,3,4,6,
> and in that case I don't know how to define the series(I tried to define 
> it the same way, but it is not working, I'm not sure I understood your
> condition on the targetAxisIndex).
>
> Thanks a lot.
>
>
> On Thursday, February 14, 2013 10:34:36 AM UTC+2, Workaholic wrote:
>>
>> Hi,
>> I've 2 tables with the same labels as attached.
>> I've a chart displaying only one of them for now("chart.jpg").
>> Is it possible  to mix them to one chart with two y axis, each displaying 
>> different table?
>>
>> Thanks.
>>
>

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