Page 1 of 1

Incorrect Legend totals

Posted: Mon Apr 03, 2017 3:31 pm
by 16880166
I have a two series bar chart that displays Income and Expenses. I was given some code (i think on another ticket) that calculated my two series for the legend. But now, it only works when Income or Income and Expenses are displayed, but not when income is displayed by itself.

Here is the code I am using in the Charts GetLegendText event:

Code: Select all

if Index < DBChart2.SeriesCount then
    LegendText:= ' $' + FormatFloat('#,##0.00', DBChart2[Index].YValues.Total) + '   ' + LegendText;
It hits the code. Otherwise, there wouldn't be a dollar sign. So a few questions regarding this chart:

1. How can I fix the about code to calculate the legend correctly?
2. I would like to click on the X Labels if possible. Is there a way I can use an event when a user clicks on the dates below the chart?

Re: Incorrect Legend totals

Posted: Tue Apr 04, 2017 9:34 am
by yeray
Hello,
realsol wrote:I have a two series bar chart that displays Income and Expenses. I was given some code (i think on another ticket) that calculated my two series for the legend
It was here:
http://www.teechart.net/support/viewtop ... 266#p73266
realsol wrote:But now, it only works when Income or Income and Expenses are displayed, but not when income is displayed by itself.
I'm not sure to understand the problem. Could you please arrange a simple example project we can run as-is to reproduce the problem here?