Different gradient colors for different slices

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Tom
Newbie
Newbie
Posts: 4
Joined: Fri Mar 06, 2009 12:00 am

Different gradient colors for different slices

Post by Tom » Mon Apr 06, 2009 10:31 am

Hi,

Is it possible to have a different gradient color for different slices?
For example: a pie chart with 3 slices:
slice 1: 30% red gradient,
slice 2: 50% green gradient,
slice 3: 20% orange gradient

also, is this possible with donuts?

another solution might be to have a third dimension for each slice.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon Apr 06, 2009 2:02 pm

Hi Tom,

I'm afraid that it wouldn't be easy to define custom gradients for each slice. But it would be easy if you could start with a shared color, white for example:

Code: Select all

uses Series, TeCanvas;

var pie1: TPieSeries;

procedure TForm1.FormCreate(Sender: TObject);
begin
  pie1 := TPieSeries.Create(nil);
  Chart1.AddSeries(pie1);

  pie1.Add(30,'',clRed);
  pie1.Add(50,'',clGreen);
  pie1.Add(20,'',RGB(255,128,64));

  pie1.Gradient.Visible := true;
  pie1.Gradient.StartColor := clWhite;
  pie1.Gradient.Balance := 100;
  pie1.Gradient.Direction := gdFromBottomLeft;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply