You have to build the colors array to match your data. If you have 4
elements A, B, C, and D, where A is green, B is red, C is blue, and D is
yellow, then you will have to check your data before you draw the chart to
see what elements are present and what order they are in. If the data
contains C, B, D, then you will have to set your colors to array to
['blue', 'red', 'yellow'].
On Wednesday, December 12, 2012 4:22:33 AM UTC-5, Manish Kumar wrote:
>
> Hello,
> Actually what i am facing i am elaborating it bit more. If i have 4 data
> elements and for each these four colors are assigned. All these four
> elements are elaborating counts for 4 features.
> When the data regarding any of the elements changes then after some
> changes if A element was green and B was red like that, then color sequence
> changes now A is showing red B as green. I need to make colors for each
> elements to be constant. Like A should always be red what ever may be data
> for it. Even if it is 0 when it comes it should be always red.
> If A is not there no other element should be red. Like that all colors for
> other elements should be specific.
>
> Thanks.
>
>
>
>
>
> On Tuesday, December 11, 2012 10:38:32 PM UTC+5:30, asgallant wrote:
>>
>> What do you mean by "it keeps changing randomly"? Does it change when
>> you change the data? The way the colors work in PieCharts is that they are
>> assigned in the row order of the data (so in your case, whatever data is in
>> the first row will always have the color '#C1D558'). If you want to assign
>> specific colors to specific data elements, you have to change the colors
>> array to fit your data set.
>>
>> On Tuesday, December 11, 2012 9:29:27 AM UTC-5, Manish Kumar wrote:
>>>
>>> Hello Every body,
>>> I am using Google pie chart where i have maximum 4 sectors and the data
>>> for them are coming from my database.
>>> The code i used for colors is
>>>
>>> var options = {
>>> chartArea: {width:300, height:135},
>>> height:165,
>>> margin:10,
>>> colors: ['#C1D558', '#22297A', '#C21536', '#996ab2'],
>>> is3D: false
>>>
>>>
>>> };
>>>
>>> I want fix color for each element of the pie chart. It keep on changing
>>> randomly. Please suggest me how to get that.
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/S38omc-zpUQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.