TAChart: Add per-point legend to the color map demo

git-svn-id: trunk@27741 -
This commit is contained in:
ask 2010-10-17 10:03:04 +00:00
parent bdeebef80a
commit beb0cdf7fe
2 changed files with 23 additions and 2 deletions

View File

@ -133,7 +133,7 @@ object Form1: TForm1
end
end
object cbInterpolate: TCheckBox
Left = 360
Left = 352
Height = 17
Top = 298
Width = 74
@ -142,6 +142,16 @@ object Form1: TForm1
OnChange = cbInterpolateChange
TabOrder = 1
end
object cbMultLegend: TCheckBox
Left = 352
Height = 17
Top = 274
Width = 91
Anchors = [akRight, akBottom]
Caption = 'Expand legend'
OnChange = cbMultLegendChange
TabOrder = 2
end
end
end
object UserDefinedChartSource1: TUserDefinedChartSource

View File

@ -15,6 +15,7 @@ type
TForm1 = class(TForm)
cbDomain: TCheckBox;
cbInterpolate: TCheckBox;
cbMultLegend: TCheckBox;
Chart1: TChart;
Chart1BarSeries1: TBarSeries;
Chart1FuncSeries1: TFuncSeries;
@ -33,6 +34,7 @@ type
UserDefinedChartSource1: TUserDefinedChartSource;
procedure cbDomainChange(Sender: TObject);
procedure cbInterpolateChange(Sender: TObject);
procedure cbMultLegendChange(Sender: TObject);
procedure Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
procedure Chart1UserDrawnSeries1Draw(ACanvas: TCanvas; const ARect: TRect);
procedure ChartColorMapColorMapSeries1Calculate(const AX, AY: Double; out
@ -48,7 +50,7 @@ var
implementation
uses
TAChartUtils;
TAChartUtils, TALegend;
{$R *.lfm}
@ -72,6 +74,15 @@ begin
ChartColorMapColorMapSeries1.Interpolate := cbInterpolate.Checked;
end;
procedure TForm1.cbMultLegendChange(Sender: TObject);
begin
with ChartColorMapColorMapSeries1.Legend do
if cbMultLegend.Checked then
Multiplicity := lmPoint
else
Multiplicity := lmSingle;
end;
procedure TForm1.Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
begin
AY := 1 / Sin(AX);