Hi all,
This may be quite simple but I cant figure out on how to change the slice colours in a pie chart any ideas?
Your Items property is the data for the chart. It will not contain colors.
The ItemColorSet is a table of colors that will govern how the slices look.
For example, this default pie chart and changing it's colors:
To accomplish this is very simple. The dropdown control in the image has an items property of:
Table(
{Disp: "Original Colors", ColorSet:
[RGBA(49, 130, 93, 1),RGBA(48,166,103, 1), RGBA(94,193,108,1),
RGBA(246,199,144,1), RGBA(247,199,114,1), RGBA(247,180,91,1),
RGBA(246,143,100,1), RGBA(212,96,104,1), RGBA(148, 110, 176, 1),
RGBA(118, 154, 204, 1), RGBA(96, 197, 234, 1)]
},
{Disp: "Wild Colors", ColorSet:
[Red, Green, Yellow, Blue, DarkGreen, LightBlue, urple, DarkGray,
DarkMagenta, LightSteelBlue]
},
{Disp: "Crazy Colors", ColorSet:
[Magenta, Purple, DarkMagenta, Crimson, DarkOrchid, DeepPink, GreenYellow,
MediumSpringGreen, SlateBlue, Yellow]
}
)
You will see in this that the first record "Original Colors" has a column called ColorSet that is a table of all the colors that were found in the default PieChart.
The second and third records just have different names and ColorSet tables.
For the Pie Chart, the ItemColorSet is set to: drpColorSelector.Selected.ColorSet (where drpColorSelector is the name of the Dropdown mentioned above).
That is all there is to it!
So, you obviously don't need a dropdown to change colors and this was JUST a demonstration, but the key point here is that the ItemsColorSet table determines the colors used in the Pie Chart. The order of the colors in the table will correspond to the order of the items in the table supplied to the Items property of the Pie Chart.
Hi @RandyHayes So it can be changed and I have to had in item property? Can even specify the slice colour? (if this makes sense)
Colors are controlled by the ItemColorSet property. It expects a table of color values. The order of the colors in that table correlates to the order of the items in your Items property.
I hope this is helpful for you.
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,075
Most Valuable Professional