Page 1 of 1

Only seeing a legend

Posted: Thu Oct 17, 2019 4:50 pm
by 16585021
I create software for retirement planning. I have one scenario where two charts (2 TChart objects) are shown (both on the screen and in a report) that shows income on the top and balances down below (see below).

Image

There is no need to have two legends showing--I only need one at the bottom, but the bottom chart may not have all of the accounts.

1) Is there a way to show a single legend with elements from both charts?

2) You may answer this in the question above, but just in case you don't: I also output my charts to images that I put in a report (ReportBuilder). I have one page that shows both retirement--can I create an image of just a legend?

Much appreciated,

Ed Dressel

Re: Only seeing a legend

Posted: Mon Oct 21, 2019 1:09 pm
by yeray
Hello,

You can hide the legend in the chart on the top and make sure the chart on the bottom has as many series as you want to be shown in the legend. Note some of these series may have no points but the series title.

Re: Only seeing a legend

Posted: Tue Oct 22, 2019 2:04 pm
by 16585021
Thank you for your reply.

I would like to "balance" the two charts--so they are the same height. If the second one has the legend, is this possible?

Re: Only seeing a legend

Posted: Wed Oct 23, 2019 6:59 am
by yeray
Hello,

I see two options.
You could modify the height of the TChart components so the heights of both ChartRects (automatically calculated) match.
Alternatively, if you need to have the same height in both TChart components, or if the ChartRects automatically generated can give different height for different runs/data, you could use a CustomChartRect in one of your charts. Something similar to this:

Code: Select all

Chart1.CustomChartRect := True;
Chart1.ChartRect := Chart2.ChartRect;