I think the best way to handle this is to add a column to the DataTable for 
the color of the bar in each row.  You can use this to dynamically build 
the colors option whenever the state of the control changes:

function getColors (dt) {
    var colors = [];
    for (var i = 0, length = dt.getNumberOfRows(); i < length; i++) {
        colors.push(dt.getValue(i, <color column index>));
    }
    return colors;
}
chart.setOption('colors', getColors(data));

google.visualization.events.addListener(control, 'statechange', function () 
{
    var dt = chart.getDataTable();
    chart.setOption('colors', getColors(dt));
    chart.draw();
});

I made a proof-of-concept version based on your code (I replaced the data 
to make it easier to see the effect): http://jsfiddle.net/asgallant/5hN5V/

On Thursday, October 31, 2013 6:28:44 AM UTC-4, letyqueta wrote:
>
> I'm using a timeline and a changeRangeFilter to filter by date over the 
> x-axis timeline chart.
>
> I need to use the colors array because the color depends of status and 
> this field is not present in the main chart so I need to specify the color 
> as you can see in the code.
> At filtering time, It filter correctly the dates range, but it also change 
> the bars colors because it associates the color to the position in the 
> array.
>
> How can I mantain for each bar the color asigned in the color's array 
> after the filtering action?
>
> Thank you very much!!!
>
>
>

-- 
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/groups/opt_out.

Reply via email to