Page 1 of 1

Define legend color for a series?

Posted: Tue Apr 28, 2009 9:24 am
by 10052955
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.

Posted: Tue Apr 28, 2009 10:09 am
by yeray
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

Posted: Thu Apr 30, 2009 7:07 am
by 10052955
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!

Posted: Thu Apr 30, 2009 7:30 am
by 10052955
I finally got it work.

Thanks anyway!