TPieSeries: Fill patterns in legend and markers

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Windwalker
Newbie
Newbie
Posts: 14
Joined: Mon Apr 20, 2009 12:00 am

TPieSeries: Fill patterns in legend and markers

Post by Windwalker » Thu Jun 18, 2009 1:01 pm

Hello,

I am working on a TPieSeries chart.
If I set

Code: Select all

mySeries.usePatterns := true
then symbols in the chart's legend adopt the patterns according to the slice they refer to.
But unfortunately the markers do not behave the same. The symbols in the markers keep the normal coloring as before triggering the patterns by the usePatterns property.

Could someone please give me a hint on how I can make the symbols in the markers take on the patterns?

Thanks!

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

Re: TPieSeries: Fill patterns in legend and markers

Post by Yeray » Thu Jun 18, 2009 3:21 pm

Hi Windwalker,

Yes, you could use OnGetSeriesMarkText to define the brush for each mark like in the following example.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues(8);
  Series1.UsePatterns := true;
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
  Series1.Marks.Brush.Color := clNone;
  Series1.Marks.Brush.Style := TBrushStyle((ValueIndex mod 6)+2);
  Series1.Marks.Color := Series1.ValueColor[ValueIndex];
end;
Note that TBrushStyle has 8 elements but the two first aren't used when UsePatterns is true. That's the reason of the "mod 6" and the "+2"

Code: Select all

TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical,
    bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross);
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

Windwalker
Newbie
Newbie
Posts: 14
Joined: Mon Apr 20, 2009 12:00 am

Re: TPieSeries: Fill patterns in legend and markers

Post by Windwalker » Fri Jun 19, 2009 12:22 pm

Yeray, thanks a lot!

Post Reply