Click here to Skip to main content
15,860,972 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have written a code like below, my problem was sometimes I am getting same color for different segments in the piechart if the value came from the same range.

my code sample

VB
=SWITCH(Fields!ID__Share_of_Costs.Value <= 0.99, "Yellow",
Fields!ID__Share_of_Costs.Value <= 30, "Teal",
Fields!ID__Share_of_Costs.Value <= 60, "SteelBlue",
Fields!ID__Share_of_Costs.Value <= 100, "Crimson",
 )

for eg: suppose my chart value is dynamic and it will come like 22 and 29, in this case the segment will show the same color (<= 30, "Teal",) as it is difficult to differntiate. Is there is any way to give different colors for each segment like no repeated color ?

Thanks in advance...cheers
Posted

1 solution

A pre-defined enumeration? Not that I know of.
You could create your own.
Or find a way to use the struct System.Drawing.Color. It contains many pre-defined colours.
Or you could process colours from their (R)ed (G)reen and (B)lue fractions in some fashion that subsequent colours are far enough from each other while, at the same time, using byte overflow creatively to ensure a large enough amount of total colours.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900