Define legend color for a series?

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

Define legend color for a series?

Post by Windwalker » Tue Apr 28, 2009 9:24 am

Hello,

I have a chart with TBar-Series.
Since the look of the color gradient on my bars, SeriesColor is not the color I would like to represent the respective series in the legend.
Instead I would like to have Gradient.MidColor as the color by which the series is represented in the legend.

Is there a way to achieve this?

Thanks a lot!

BTW: I am running TeeChart 8.04 Pro ond Delphi VCL 2006.

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

Post by Yeray » Tue Apr 28, 2009 10:09 am

Hi Windwalker,

I think you should do something similar to the example at All features/Miscellaneous/Legend/Symbol OnDraw in the new features demo available at TeeChart's program group.

I hope this helps
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

Post by Windwalker » Thu Apr 30, 2009 7:07 am

Thanks for your hint!

Could you please give me some advise, on how I can draw a rectangle with my intended color and then place this rectangle by the use of StretchDraw in the legend?

I tried to do it like this, but StrechtDraw does not accept my Rect-Object.

Code: Select all

procedure TForm_DTM_UmsatzStat.LegendDraw(Sender: TObject; Series:TChartSeries;
                            ValueIndex:Integer; R:TRect);
var
  symbol : TRect;
begin
  Brush.Style := bsSolid;
  Brush.Color := clRed;                          // or any other color
  symbol := Rect(R.Left, R.Top, R.Right, R.Bottom);
  Chart_Umsatz.Canvas.StretchDraw(R, symbol);
end;
Thanks again!

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

Post by Windwalker » Thu Apr 30, 2009 7:30 am

I finally got it work.

Thanks anyway!

Post Reply