legend properties

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
JimR
Newbie
Newbie
Posts: 36
Joined: Tue Dec 05, 2017 12:00 am

legend properties

Post by JimR » Wed Apr 04, 2018 12:08 am

I have asked related questions earlier but I am still having problems. Current one is how to control the relative sizes in the legend of the symbol and the line for a lineseries. Here is a sample of the problem:
legend.PNG
legend.PNG (1.24 KiB) Viewed 11389 times
The red line is too short (or the symbol too large) for the first item. The second correctly has no line and the third no symbol. Same problem if I have the legend on the right. I would in general prefer the lines to be a little longer rather than reducing the symbol size in the legend. Is that possible?

Somewhat unrelated: in some of my charts the lines in the legend are all black even though they are different colors in the chart. I don't see much difference in my code. Might I have accidentally turned off some option to suppress the colors in the legend?

Thanks,

Jim

JimR
Newbie
Newbie
Posts: 36
Joined: Tue Dec 05, 2017 12:00 am

Re: legend properties

Post by JimR » Wed Apr 04, 2018 6:55 am

I seem to have found a solution but it seems illogical. By increasing the variable chart.legend.symbol.width it makes the line (not the symbol) larger. Is that a feature or a bug?

Jim

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

Re: legend properties

Post by Yeray » Wed Apr 04, 2018 1:09 pm

Hello Jim,

Have you tried incrementing the symbols width?
By default, WidthUnits is set to lcsPercent and Width is set to 20. Changing WidthUnits to lcsPixels looks better for this example:
Project3_2018-04-04_15-10-41.png
Project3_2018-04-04_15-10-41.png (5.09 KiB) Viewed 11361 times

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=False;

  for i:=0 to 2 do
    with Chart1.AddSeries(TLineSeries) as TLineSeries do
    begin
      FillSampleValues;
      Pointer.Style:=psCircle;
      Pointer.Visible:=i<2;
      LinePen.Visible:=i<>1;
    end;

  Chart1.Legend.Symbol.Squared:=False;
  Chart1.Legend.Symbol.WidthUnits:=lcsPixels;
end;
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

JimR
Newbie
Newbie
Posts: 36
Joined: Tue Dec 05, 2017 12:00 am

Re: legend properties

Post by JimR » Wed Apr 04, 2018 6:08 pm

That works but why does making the symbol wider make the line longer? Perhaps the "symbol" means the display of both the marker and the line and not just the marker symbol?

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

Re: legend properties

Post by Yeray » Thu Apr 05, 2018 8:21 am

JimR wrote:That works but why does making the symbol wider make the line longer? Perhaps the "symbol" means the display of both the marker and the line and not just the marker symbol?
Yes, the legend symbol refers to the space / column in the legend reserved for the symbol to be drawn. The symbol can be a pointer (circle, square,...), a pointer with a line, or a line.
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

Post Reply