26

I can't figure out how to get flot.pie to change the pie slice color, just the series color. Is this possible?

Caveatrob
  • 12,667
  • 32
  • 107
  • 187

2 Answers2

86

You need to specify the color as part of the data array.

So instead of

[1, 2, 3]

you do

[
    {data: 1, color: '#f00'},
    {data: 2, color: '#0f0'},
    {data: 3, color: '#00f'}
]
Tamlyn
  • 22,122
  • 12
  • 111
  • 127
5

You need to create multiple data series and set the color on each series. See the Flot Pie chart examples here: Flot Pie Chart

Prasad Jadhav
  • 5,090
  • 16
  • 62
  • 80
DarrellNorton
  • 3,901
  • 2
  • 21
  • 21
  • 1
    Link is not working. Actual js is always helpful. Current flot pie example link is: http://www.flotcharts.org/flot/examples/series-pie/ but this page does not answer the question. Look below for answer peeps. – Robb Sadler Nov 15 '16 at 19:29