Page 1 of 1

TeeChart - Dynamic (Custom) Colors for PieChart

Posted: Thu Apr 07, 2022 6:43 am
by 16590985
Hi

I have a piechart linked to a dataset. (Dynamic) I need to change the colors of the PieChart at runtime within the Report itself based on a specific set of colors for the report (which is dependent on the specifc organization - each organization wants to define their specific colors). None of the standard colors is acceptable to my client.

For instance the colors colors are blue/orange (Only two values) but I need to make each slice (Value) of the Pie Chart a very specific color - it might or might not have to relate to the specific value in that slice.

Re: TeeChart - Dynamic (Custom) Colors for PieChart

Posted: Fri Apr 08, 2022 2:45 pm
by Marc
Hello,

You can set the colour as you add the data, using an rgb colour that matches the colour you require.

eg.

Code: Select all

Series1.AddXY(50,50,'',rgb(128,107,45));
or change the colour after adding the data.

Series1.ValueColor[1] := rgb(108,107,245);

alternatively, if you're working with a datasource, you can set the colour source for the Series from a field containg the colour definition.

ie.
Series1.ColorSource := dbColorField;
Regards,
Marc Meumann