Legend, show Series Name and Series Total Value
Posted: Wed Mar 15, 2017 7:21 pm
I have attached my chart. How can I change the legend to show the Series Name along with the Total value of the Series?
Steema Software - Customer Support Forums
http://teechart.com/support/
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;
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';
Code: Select all
if Series1.Labels[Index] = '' then
Series1.Labels[index]:='No Categories';