2nd legend not visible

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
TestAlways
Newbie
Newbie
Posts: 12
Joined: Mon Mar 09, 2015 12:00 am

2nd legend not visible

Post by TestAlways » Wed Nov 11, 2015 11:16 pm

In a previous version of TChart, I used the following code to create a second legend:

Code: Select all

          lsrs := CreateBarSeries('none', lChart, clNone, 0);
          lsrs.Active := false;
          lsrs.AddNull('Pre-Tax');
          lsrs.AddNull('Roth');

          lChart.Legend.Symbol.Width := 45;

          lExtraLegend := TExtraLegendTool.Create(self);
          lExtraLegend.ParentChart := lChart;
          lExtraLegend.Legend.CustomPosition := True;
          lExtraLegend.Legend.LegendStyle := lsValues;
          lExtraLegend.Legend.Transparent := True;
          lExtraLegend.Legend.Symbol.OnDraw := AccumChartLegendDrawAccountSymbols;
          lExtraLegend.Legend.TextStyle := ltsPlain;
          lExtraLegend.Series := lsrs;
          lExtraLegend.Active := True;
          lExtraLegend.Legend.Symbol.Width := 45;

          lChart.OnGetLegendText  := BPAccumChartLegendText;
          lExtraLegend.Legend.Title.Text.Text := 'Accounts';

          lChart.OnBeforeDrawSeries := BPAccumChartBeforeDrawSeries;
And I got the following result (which is what I want):

Image

But this does not work in the current version I am using--it only shows one legend symbol (the blue ones). (And, as you might expet, the BPAccumChartBeforeDrawSeries event is never called).

Here is the original post from which I got this answer from:

http://www.teechart.net/support/viewtop ... end#p58861

How do I add the second column of legend symbols?

Thank you,

Ed Dressel

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

Re: 2nd legend not visible

Post by Yeray » Thu Nov 12, 2015 9:26 am

Hello Ed,

The code above is incomplete. Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Ie, I read "Rates of Return" in the image you posted with the desired result but I don't find that text in the code you posted.

The project here looks like this for me here:
legend.png
legend.png (29.1 KiB) Viewed 10289 times
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

TestAlways
Newbie
Newbie
Posts: 12
Joined: Mon Mar 09, 2015 12:00 am

Re: 2nd legend not visible

Post by TestAlways » Thu Nov 12, 2015 4:03 pm

I was using v. 15 and have changed to v. 16 and get the same results you do from the demo

But in a previous version of TChart, I got the two different symbols under "Rates of Return" in my first image. How can I get the second column of symbols?

Image

Thank you,

Ed Dressel

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

Re: 2nd legend not visible

Post by Yeray » Fri Nov 13, 2015 3:47 pm

Hello,
TestAlways wrote:But in a previous version of TChart, I got the two different symbols under "Rates of Return" in my first image. How can I get the second column of symbols?
Could you please post an example showing how did you achieve that result with v2015.15?
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

TestAlways
Newbie
Newbie
Posts: 12
Joined: Mon Mar 09, 2015 12:00 am

Re: 2nd legend not visible

Post by TestAlways » Fri Nov 13, 2015 5:17 pm

The attached demo can create the following image in 2013.09.131119:

Image

FYI--this is what I need (it would be nice to have less margin between the two legends).
Attachments
Legend Custom Draw Symbol.zip
(3.25 KiB) Downloaded 625 times

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

Re: 2nd legend not visible

Post by Yeray » Mon Nov 16, 2015 10:45 am

Hello,

From v2014.10 to v2015.15 the ExtraLegend wasn't shown (id=755).

Regarding the symbols you are manually drawing, note before v2014.11 the Legend.Symbol.Square property was false by default and we moved it to true from that version. This makes your symbols to be squared and the width is incorrect for your purpose.
Add these lines to your TForm1.Create to fix that:

Code: Select all

  Chart1.Legend.Symbol.Squared:=false;
  FExtraLegend.Legend.Symbol.Squared:=false;
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