TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
Windwalker
- Newbie
- Posts: 14
- Joined: Mon Apr 20, 2009 12:00 am
Post
by Windwalker » Thu Jun 18, 2009 1:01 pm
Hello,
I am working on a TPieSeries chart.
If I set
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
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
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);