TAChart: Add rotated function series to the demo

git-svn-id: trunk@29092 -
This commit is contained in:
ask 2011-01-18 05:45:22 +00:00
parent 2429f7c9cf
commit 8033e87029
2 changed files with 30 additions and 2 deletions

View File

@ -13,9 +13,9 @@ object Form1: TForm1
Height = 362
Top = 0
Width = 461
ActivePage = tsColorMap
ActivePage = tsDomain
Align = alClient
TabIndex = 1
TabIndex = 0
TabOrder = 0
object tsDomain: TTabSheet
Caption = 'Domain'
@ -50,8 +50,11 @@ object Form1: TForm1
ParentColor = False
object Chart1FuncSeries1: TFuncSeries
Extent.XMin = -6.28
Extent.YMin = -2
Extent.XMax = 6.28
Extent.YMax = 2
Extent.UseXMin = True
Extent.UseYMin = True
Extent.UseXMax = True
Title = '1 / Sin(x)'
OnCalculate = Chart1FuncSeries1Calculate
@ -89,6 +92,16 @@ object Form1: TForm1
OnChange = cbDomainChange
TabOrder = 1
end
object cbRotate: TCheckBox
Left = 388
Height = 17
Top = 274
Width = 53
Anchors = [akRight, akBottom]
Caption = 'Rotate'
OnChange = cbRotateChange
TabOrder = 2
end
end
object tsColorMap: TTabSheet
Caption = 'Color map'

View File

@ -14,6 +14,7 @@ type
TForm1 = class(TForm)
cbDomain: TCheckBox;
cbRotate: TCheckBox;
cbInterpolate: TCheckBox;
cbMultLegend: TCheckBox;
Chart1: TChart;
@ -38,6 +39,7 @@ type
procedure cbDomainChange(Sender: TObject);
procedure cbInterpolateChange(Sender: TObject);
procedure cbMultLegendChange(Sender: TObject);
procedure cbRotateChange(Sender: TObject);
procedure Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
procedure Chart1UserDrawnSeries1Draw(ACanvas: TCanvas; const ARect: TRect);
procedure ChartColorMapColorMapSeries1Calculate(const AX, AY: Double; out
@ -86,6 +88,19 @@ begin
Multiplicity := lmSingle;
end;
procedure TForm1.cbRotateChange(Sender: TObject);
begin
with Chart1FuncSeries1 do
if cbRotate.Checked then begin
AxisIndexX := 0;
AxisIndexY := 1;
end
else begin
AxisIndexX := 1;
AxisIndexY := 0;
end;
end;
procedure TForm1.Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
begin
AY := 1 / Sin(AX);