You can't refer to the columns by name, only by column index.  You can 
search through the DataTable to find the index of a column with a given 
name, if that helps:

var index, name = 'my column name';
for (var i = 0, count = data.getNumberOfColumns(); i < count; i++) {
    if (data.getColumnLabel(i) == name) {
        index = i;
        break;
    }
}

On Tuesday, March 25, 2014 11:46:55 AM UTC-4, cyb wrote:
>
> Hi,
>
>  
>
> ok great this works, but i have another question :)
>
>  
>
> When i use the line chart example from my first post, i use the 
> "dataView.setColumns(0,1);" to show or hide specific Columns..
>
> At the moment is use the column ID´s 0,1 or whatever.. But can i use 
> instead of the Column numbers the name of the columns ?
>
> If i have this Data:
>
>  
>
> var data = new google.visualization.arrayToDataTable([
>
>                     ['date','New York,'Austin'],
>
>                     [20111001,2,3],
>
>                     [20111002,5,6],
>
>                     [20111003,8,9],
>
>                     [20111004,11,12]  ]);
>
>  
>
>  
>
> var dataView = new google.visualization.DataView(data);
>
>  
>
> can i say dataView.setColumns('date','Austin'); ?? 
>
>
> I have dynamic data, the headers are on every file different.. At the 
> moment i have 'date', 'New Yowk', 'Austin' but it can be anything like 'A', 
> 'B', 'C' and so on..
>  
>
>  
>
> Best regards
>
> cyb
>

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