Topic: -SOLVED- Piechart - change color
Hello everyone, I would like to know how to change the color of the sectors of a pie chart, for example instead of blue and yellow, display them green and red.
Thank you.
My Visual Database → General → -SOLVED- Piechart - change color
Hello everyone, I would like to know how to change the color of the sectors of a pie chart, for example instead of blue and yellow, display them green and red.
Thank you.
Hello Madbit71
A long time ago with Delphi 7, I did like this
Form1. Chart1.Series[0].Color := $FF0000; // hexadecimal value of the color
If you have several series:
Form1. Chart1.Series[0].Color := clGreen; // Windows color name
Form1. Chart1.Series[1].Color := clYellow;
It had worked. I would have to find my old app, but Delphi 7 and windows 10 don't go well together (you have to tweak a bit)
JB
Thanks jean.brezhonek and sparrow,
I had read that post but I couldn't apply it to a pie chart.
I tried based on an example from Derek, derekpiechart which I attach, in which only one series is added; if I insert the color at the end of line 35:
...
if ValidInt(cfsexValue) then Chart.Series[0].AddXY(x,strtoint(cfsexValue),sexvalue,clred);
...
all parts of the pie chart are colored red.
Of course, it won't work all at once.
You need to put your hands a little and turn your head on.
Pay attention that you have a cycle and if you put one value RED in the cycle, then it will be red for everything.
It can be done like this.
Thanks sparrow,
it's perfect and I never could have done it without your help...especially in such an elegant way.
My Visual Database → General → -SOLVED- Piechart - change color
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi