TAChart: Initial support for legend multiplicity

git-svn-id: trunk@27557 -
This commit is contained in:
ask 2010-10-04 08:21:46 +00:00
parent 643fc88dfa
commit 84bb112a07
3 changed files with 20 additions and 2 deletions

View File

@ -93,6 +93,7 @@ type
TChartSeries = class(TCustomChartSeries)
private
FBuiltinSource: TCustomChartSource;
FLegendMultiplicity: TLegendMultiplicity;
FListener: TListener;
FMarks: TChartMarks;
FOnGetMark: TChartGetMarkEvent;
@ -102,6 +103,7 @@ type
function GetSource: TCustomChartSource;
function IsSourceStored: boolean;
procedure SetLegendMultiplicity(AValue: TLegendMultiplicity);
procedure SetMarks(const AValue: TChartMarks);
procedure SetOnGetMark(const AValue: TChartGetMarkEvent);
procedure SetSource(AValue: TCustomChartSource);
@ -156,6 +158,8 @@ type
read GetSource write SetSource stored IsSourceStored;
published
property Active default true;
property LegendMultiplicity: TLegendMultiplicity
read FLegendMultiplicity write SetLegendMultiplicity default lmSingle;
property Marks: TChartMarks read FMarks write SetMarks;
property ShowInLegend;
property Title;
@ -595,6 +599,13 @@ begin
Source[AIndex]^.Color := AColor;
end;
procedure TChartSeries.SetLegendMultiplicity(AValue: TLegendMultiplicity);
begin
if FLegendMultiplicity = AValue then exit;
FLegendMultiplicity := AValue;
UpdateParentChart;
end;
procedure TChartSeries.SetMarks(const AValue: TChartMarks);
begin
if FMarks = AValue then exit;

View File

@ -28,6 +28,8 @@ const
DEF_LEGEND_SYMBOL_WIDTH = 20;
type
TLegendMultiplicity = (lmSingle, lmPoint);
{ TLegendItem }
TLegendItem = class

View File

@ -952,8 +952,13 @@ procedure TPieSeries.GetLegendItems(AItems: TChartLegendItems);
var
i: Integer;
begin
for i := 0 to Count - 1 do
AItems.Add(TLegendItemColorRect.Create(SliceColor(i), FormattedMark(i)));
case LegendMultiplicity of
lmSingle:
AItems.Add(TLegendItemColorRect.Create(SliceColor(0), Title));
lmPoint:
for i := 0 to Count - 1 do
AItems.Add(TLegendItemColorRect.Create(SliceColor(i), FormattedMark(i)));
end;
end;
procedure TPieSeries.SetExploded(const AValue: Boolean);