legend filled when it is not supposed to

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

legend filled when it is not supposed to

Post by David Novo » Fri Dec 16, 2005 11:42 pm

Hello,

I have created an area series that has a no fill, and only the hatch marks from the fill are visible. This worked out just great.

Problem is that in the legend, a background color is coming up. So even though the series is red hatched lines on a clear background, in the legend it is coming up as black lines on a red background.

here is a picture Image

Is there a property I can set to make the legend symbol look like the plot?

The code for the form is below:

object Form1: TForm1
Left = 325
Top = 110
Width = 334
Height = 287
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Chart1: TChart
Left = 8
Top = 8
Width = 313
Height = 233
Legend.Brush.Color = clWhite
Legend.Brush.Style = bsClear
Legend.LegendStyle = lsSeries
Title.Text.Strings = (
'TChart')
View3D = False
TabOrder = 0
object Series2: TAreaSeries
Marks.Callout.Brush.Color = clBlack
Marks.Visible = False
SeriesColor = clRed
AreaBrush = bsDiagCross
AreaChartBrush.Color = clNone
AreaChartBrush.Style = bsDiagCross
AreaColor = clRed
AreaLinesPen.Visible = False
DrawArea = True
Pointer.InflateMargins = True
Pointer.Style = psRectangle
Pointer.Visible = False
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Y'
YValues.Order = loNone
end
end
end

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Dec 19, 2005 9:38 am

Hi David,

I've been able to reproduce this issue and added it to our defect list (TV52011128) to be fixed for future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

Post by David Novo » Wed Dec 21, 2005 7:58 am

Thanks for the prompt reply.

I will be glad to modify the source myself, I have done so many times myself, if you can quickly point me to the method that actually draws the shape in the legend.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 21, 2005 9:45 am

Hi David,

I'd say it's on TLegendSymbol.Draw method at Chart.pas.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

Post by David Novo » Wed Dec 21, 2005 11:26 pm

Hello,

As far as I can tell, it seems that someone has forgotten to override the TChartSeries.legendItemColor method for an Area Series. The default behaviour in TChartSeries is to use the seriesColor, but for areaSeries, the seriesColor is not necessarily used.

So I think that will work for this bug, however, since the AreaBrush is introduced in tCustomSeries, I think the checking for the legend color (depending on the area brush) should be done at that level. However, that code is complicated, so I will leave that for the experts....

David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

Post by David Novo » Thu Dec 22, 2005 12:18 am

Unfortunately, its actually a bit of a mess. In different parts of the code, different pens and brushes are being used to draw the area and draw the legend for the area.

I am thoroughly confused because the brushes and pens get set over and over again :D

However, I think that if I create my own AreaSeries and override prepareLegendCanvas, I should be okay.

Post Reply