Setting Legend.VertSpacing causes wider Symbol

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Test Always
Newbie
Newbie
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
Attachments
Square Symbols for Legend.zip
(3.56 KiB) Downloaded 679 times

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

Re: Setting Legend.VertSpacing causes wider Symbol

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

Hello,

I could reproduce the problem you reported with the latest version, v2017.22 so I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1908

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;
begin
  if Visible then
     if Squared then
     begin
        result:=CalcHeight;

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

Post Reply