For coloring columns, you have two options: you can either color columns 
individually, or color data series.  Coloring data series is the easiest to 
do: you can set the colors option or the series.<series index>.color 
options to change the colors of the columns:

colors: ['#f39bc7', '#75a7e2']

and:

series: {
    0: {
        // options for the first data series
        color: '#f39bc7'
    },
    1: {
        // options for the second data series
        color: '#75a7e2'
    }
}

produce equivalent colors for a chart with two data series.  If you want to 
color each bar individually, then you need to use a "style" role column in 
the DataTable, and assign a color as the value:

var data = new google.visualization.arrayToDataTable([
    ['date', 'column1', {type: 'string', role: 'style'}, 'column2', {type: 
'string', role: 'style'}],
    [20111001, 2, '#f39bc7', 3, '#75a7e2'],
    [20111002, 5, '#f7a3cf', 6, '#75a7e2'],
    [20111003, 8, '#fbbbd7', 9, '#75a7e2'],
    [20111004, 11, '#ffc3df', 12, '#75a7e2']
]);

On Tuesday, March 25, 2014 9:02:40 PM UTC-4, cyb wrote:
>
> Hi,
>
> first thx for your answer`s this helped me alot :)
>
> I have two other questions..
>
>
> First:
>
> how can i chance the color of every column in a line or bar chart ?
>
> can i use the my "var dataView = new google.visualization.DataView(data);"
> to set the color? I have found the setProperties() Option but this needs a 
> rowIndex.. is there an option for my dataView opject that i can say i want 
> that column 1 is red and column 2 is green ?
>
> and second question:
>
> I want implement a filtering on the X-Achis
> i want that i can say show only values beteen value A and B. How can i do 
> that ?
>
> Best regards
> cyb
>
>
>
> Am Montag, 24. März 2014 17:03:13 UTC+1 schrieb cyb:
>>
>> Hi,
>>
>> i have the following code:
>>
>>
>> var data = new google.visualization.arrayToDataTable([
>>                     ['date','column1','column2'],
>>                     [20111001,2,3],
>>                     [20111002,5,6],
>>                     [20111003,8,9],
>>                     [20111004,11,12]  ]);
>>
>>
>> var dataView = new google.visualization.DataView(data);
>>
>> var chart = new 
>> google.visualization.LineChart(document.getElementById('chart_div'));
>>
>> chart.draw(dataView, options); 
>>
>>  
>> This draws me a line chart but if i replace the LineChart with this: 
>> chart = new 
>> google.visualization.PieChart(document.getElementById('chart_div'));
>> i get this error: "Pie chart should have a first column of type string"
>> What is now the best an easiest way to convert the data from a line in a 
>> pie chart? I want switch between a pie and a line chart and all should use 
>> the same data-array. Or can i disable the check that the first value must 
>> be a string !?
>> And then i want select different values with dataView.setColumns(); so 
>> that i can determine which data is showing in my chart.
>>
>> And second question can i convert the date- column to a real date !? 
>> 20111001 is Year 2011 Month: 10 and Day: 01 ?
>>
>>
>>
>> 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