From 8033e87029ed1ab1dcd58194b43e9ab1e79f2825 Mon Sep 17 00:00:00 2001 From: ask Date: Tue, 18 Jan 2011 05:45:22 +0000 Subject: [PATCH] TAChart: Add rotated function series to the demo git-svn-id: trunk@29092 - --- components/tachart/demo/func/main.lfm | 17 +++++++++++++++-- components/tachart/demo/func/main.pas | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/components/tachart/demo/func/main.lfm b/components/tachart/demo/func/main.lfm index 72bda13558..814ecc2635 100644 --- a/components/tachart/demo/func/main.lfm +++ b/components/tachart/demo/func/main.lfm @@ -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' diff --git a/components/tachart/demo/func/main.pas b/components/tachart/demo/func/main.pas index a7d23e3106..6891f46491 100644 --- a/components/tachart/demo/func/main.pas +++ b/components/tachart/demo/func/main.pas @@ -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);