Setting Legend.VertSpacing causes wider Symbol

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Test Always
Posts: 16
Joined: Mon Dec 05, 2016 12:00 am

Setting Legend.VertSpacing causes wider Symbol

Post by Test Always » Tue Aug 22, 2017 8:14 pm

TChart 2016.18.160504

In the attached demo, a bitmap created from a TChart is copied to a TImage. The problem is the legend' symbol for each series is not square. They are too long.

Remove this line:

lChart.Legend.VertSpacing := 40;

and it works fine--except the vertical spacing is too tight.

Is this fixed in the latest version? (The latest version breaks our existing code so it is not easy to test).

Thank you,

Ed Dressel
Square Symbols for
(3.56 KiB) Downloaded 179 times

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

Re: Setting Legend.VertSpacing causes wider Symbol

Post by Yeray » Wed Aug 23, 2017 11:22 am


I could reproduce the problem you reported with the latest version, v2017.22 so I've added it to the public tracker:

I've also fixed it, so the ticket is already closed (the next maintenance release will include the fix).

Since you own the sources, you can apply the fix to your copy of the sources and recompile. The fix consists on modifying the TLegendSymbol.CalcWidth at Chart.pas to this:

Code: Select all

Function TLegendSymbol.CalcWidth(Value:Integer):Integer;
  if Visible then
     if Squared then

        if Assigned(Parent) and (Parent is TCustomChart) then
           result:=result - TCustomChart(Parent).Legend.VertSpacing;
     if FWidthUnits=lcsPercent then result:=Round(Width*Value*0.01)
                               else result:=Width
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