Hi,
In my page I have a pie ChartView, and I am using the palette = "Windows8".
If this graph has more than 8(number of colors in palette) DataPoints, will repeat the colors.
To avoid this I am using a class to generate colors, but are left with a very different tone.
It would be possible to use more than one pallet, ie the element 9 would be a different color palette.
Thank you.
Regards,
Marcelo
In my page I have a pie ChartView, and I am using the palette = "Windows8".
If this graph has more than 8(number of colors in palette) DataPoints, will repeat the colors.
To avoid this I am using a class to generate colors, but are left with a very different tone.
public
class
RandomPastelColorGenerator
{
private
readonly
Random _random;
public
RandomPastelColorGenerator()
{
const
int
RandomSeed = 2;
_random =
new
Random(RandomSeed);
}
public
SolidColorBrush GetNextBrush()
{
SolidColorBrush brush =
new
SolidColorBrush(GetNext());
return
brush;
}
public
Color GetNext()
{
byte
[] colorBytes =
new
byte
[3];
colorBytes[0] = (
byte
)(_random.Next(0 , 245) + 127);
colorBytes[1] = (
byte
)(_random.Next(91, 223) + 127);
colorBytes[2] = (
byte
)(_random.Next(0 , 169) + 127);
Color color =
new
Color();
color.A = 255;
color.R = colorBytes[0];
color.B = colorBytes[1];
color.G = colorBytes[2];
return
color;
}
}
It would be possible to use more than one pallet, ie the element 9 would be a different color palette.
Thank you.
Regards,
Marcelo