The series index is the order of data series that the chart sees.  If you 
set the columns like this:

columns: [x, y, z]

x -> the domain column
y -> series 0
z -> series 1

If you set the columns like this:

columns: [z, x, y]

z -> the domain column
x -> series 0
y -> series 1

The chart has no knowledge of the column in your original DataTable; all it 
sees is the DataView that you specify in the "view" parameter.  You could 
create a map of columns to colors like this:

var colorMap = ['red', 'green', 'blue'];

where colorMap[columnIndex] gives the color of the series.  You can then 
build the series option given a specific view:

var view = chartWrapper.getView();
var series = [];
for (var i = 1; i < view.columns.length; i++) {
    series.push({
        color: colorMap[view.columns[i]];
    });
}
chartWrapper.setOption('series', series);

On Friday, May 16, 2014 9:20:40 AM UTC-4, cyb wrote:
>
> Hi,
>
> but if i set the series options like this:
>
> chartWrapper.setOption('series',{
>>                                 0: { color: 'red' },
>>                                 1: { color: 'green' },
>>                                 2: { color: 'blue' }
>>                             });
>
>
> and if i set my view like this :
>
> view : {columns: [2,0,1]}
>
> is then column 0 from my view column 1 in my series options ? or is 
> column 0 from my view every time column 0 from the series options ?
>
> the problem is, i use  checkboxes where users can click which xSeries the 
> want to show.
>
> so one user selects the first time 2,1,0 and the colors are for example 1=
> green and 0=red then he deselects for example column 1 from the view so 
> the new view array looks like this: view: {columns :[2,0]}  and now i want 
> that 0 is already red an not an other color..
>
> hope you understand what i mean..
>
>
> Am Montag, 5. Mai 2014 18:11:24 UTC+2 schrieb cyb:
>>
>> Hi,
>>
>> i use a chartWrapper to display different charts (Line,Colum,Area,Pie and 
>> so on) and i can filter dates and numbers without any problem but if i 
>> switch to discrete mode then the filtering did no longer work..
>>
>> i build the filter view for my DataWrapper like this:
>>
>> Data:
>>
>>> date,New York,San Francisco,Austin,Country
>>> 20111001,10,20,30,A
>>> 20111002,40,50,60,B
>>> 20111003,70,80,90,C
>>> 20111004,100,110,120,D
>>
>>
>> var dataTable=new google.visualization.DataTable(DATA);
>>>  var filteredView ={columns : 1,2,3, rows : 
>>> dataTable.getFilteredRows([{column:1, minValue: 40, maxValue: 70}])};
>>
>>
>> For example  i want filter on the xAxis (New York) all values between 40 
>> and 70.. this works if i have no discrete mode..
>>
>> but if i change the Column "New York" from type number to string (is this 
>> the only method to activate the discrete mode? or is there an option where 
>> i must not change the type ? ) the filtering did not work. I do the 
>> switching to discrete mode like that:
>>
>> var View =[
>>>                             {
>>>                                 type: 'string',
>>>                                 label: dataTable.getColumnLabel(1),
>>>                                 calc: function (dt, row) {
>>>                                     return dt.getFormattedValue(row, 1);
>>>                                 }
>>>                             }
>>>                         ];
>>>                         View .push.apply(View ,[2,3]); //Adds the values 
>>> from a second array to the first array
>>>                         var newView={columns: View }; /
>>
>>
>>
>>
>> i have the same problem with the PieChart, there is per default the first 
>> column a string so i can not do any filtering.
>>
>> how can i solve this problem ?
>>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to