user1894102
user1894102

Reputation: 11

Fix color for each sector of google pie chart

I am using Liferay 6.1 and google pie chart in that. For each colour of sector I am using the below code.

var options = {
    chartArea : {
        width : 300,
        height : 135
    },
    height : 165,
    margin : 10,
    colors : [ '#C1D558', '#22297A', '#C21536', '#996ab2' ],
    is3D : false

};

But the problem is that if there are changes in the data, the colour for each sector changes randomly. I wanted to fix the colour for each sector permanently which don't depend on data or their entry.

Upvotes: 1

Views: 768

Answers (1)

Albernazf
Albernazf

Reputation: 378

If someone else is looking for this answer just take a look a the documentation.

Look at the slice part you can do it like

slices: [{color: 'black', {}, {}, {color: 'red'}]
slices: {0: {color: 'black'}, 3: {color: 'red'}}

Upvotes: 1

Related Questions