Legend, show Series Name and Series Total Value
Legend, show Series Name and Series Total Value
I have attached my chart. How can I change the legend to show the Series Name along with the Total value of the Series?
- Attachments
-
- 2017-03-15_1212.png (43.43 KiB) Viewed 21992 times
Re: Legend, show Series Name and Series Total Value
Hello,
You could use OnGetLegendText event. Ie:
You could use OnGetLegendText event. Ie:
Code: Select all
procedure TForm1.Chart1GetLegendText(Sender: TCustomAxisPanel;
LegendStyle: TLegendStyle; Index: Integer; var LegendText: string);
var i: Integer;
begin
if Index<Chart1.SeriesCount then
LegendText:=LegendText + ' $' + FormatFloat('#,##0.##', Chart1[Index].YValues.Total);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend, show Series Name and Series Total Value
Thank you. I'll give it a shot.
Re: Legend, show Series Name and Series Total Value
I have another question along this same lines. I have a pie chart of categories (Attached). If transactions don't have any assigned category, the legend just displays the amount. I would like to add the text 'No Categories' in front of the amount but I can't seem to format it the way it is in the legend (Text left justified and amount right justified).
Thanks.
Thanks.
- Attachments
-
- 2017-07-13_1028.png (29.42 KiB) Viewed 21791 times
Re: Legend, show Series Name and Series Total Value
Hello,
In case you are adding the values connecting the series to a dataset, you can loop your values and set the label at those points with empty labels. Ie:
I'm not sure to understand why don't you add the uncategorized value as you do with the others, with the "No Categories" label. Ie:realsol wrote:I have another question along this same lines. I have a pie chart of categories (Attached). If transactions don't have any assigned category, the legend just displays the amount. I would like to add the text 'No Categories' in front of the amount but I can't seem to format it the way it is in the legend (Text left justified and amount right justified).
Code: Select all
Series1.Add(316560, 'No Categories');
Code: Select all
for i:=0 to Series1.Count-1 do
if Series1.Labels[i] = '' then
Series1.Labels[i]:='No Categories';
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend, show Series Name and Series Total Value
Thanks. I ended up using the OnGetLegendText for the Chart and added
Worked perfectly. Thanks.
Code: Select all
if Series1.Labels[Index] = '' then
Series1.Labels[index]:='No Categories';