TeeChart - Dynamic (Custom) Colors for PieChart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Marinus
Newbie
Newbie
Posts: 1
Joined: Mon Apr 12, 2021 12:00 am

TeeChart - Dynamic (Custom) Colors for PieChart

Post by Marinus » Thu Apr 07, 2022 6:43 am

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.

Marc
Site Admin
Site Admin
Posts: 1266
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TeeChart - Dynamic (Custom) Colors for PieChart

Post by Marc » Fri Apr 08, 2022 2:45 pm

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
Steema Support

Post Reply