mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 07:16:16 +02:00
TAChart: Update funcdemo to demonstrate domain exclusions
git-svn-id: trunk@22375 -
This commit is contained in:
parent
6f487b17a3
commit
39dd7c35bd
@ -1,7 +1,7 @@
|
||||
object Form1: TForm1
|
||||
Left = 290
|
||||
Left = 653
|
||||
Height = 362
|
||||
Top = 152
|
||||
Top = 209
|
||||
Width = 461
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 362
|
||||
@ -26,6 +26,10 @@ object Form1: TForm1
|
||||
Scale = 1
|
||||
end>
|
||||
ExpandPercentage = 10
|
||||
Extent.YMin = -6
|
||||
Extent.YMax = 6
|
||||
Extent.UseYMin = True
|
||||
Extent.UseYMax = True
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Legend.Visible = True
|
||||
@ -38,29 +42,25 @@ object Form1: TForm1
|
||||
ParentColor = False
|
||||
object Chart1FuncSeries1: TFuncSeries
|
||||
Extent.XMin = -6.28
|
||||
Extent.YMin = -1
|
||||
Extent.XMax = 6.28
|
||||
Extent.YMax = 1
|
||||
Extent.UseXMin = True
|
||||
Extent.UseYMin = True
|
||||
Extent.UseXMax = True
|
||||
Extent.UseYMax = True
|
||||
OnCalculate = Chart1FuncSeries1Calculate
|
||||
Pen.Color = clOlive
|
||||
Pen.Width = 2
|
||||
Step = 4
|
||||
Title = 'Sin(x)'
|
||||
Title = '1 / Sin(x)'
|
||||
end
|
||||
object Chart1XAxis: TLine
|
||||
ShowInLegend = False
|
||||
Position = 0
|
||||
SeriesColor = clBlack
|
||||
ShowInLegend = False
|
||||
end
|
||||
object Chart1YAxis: TLine
|
||||
ShowInLegend = False
|
||||
LineStyle = lsVertical
|
||||
Position = 0
|
||||
SeriesColor = clBlack
|
||||
ShowInLegend = False
|
||||
end
|
||||
object Chart1BarSeries1: TBarSeries
|
||||
Title = 'Cos(x)'
|
||||
@ -72,6 +72,16 @@ object Form1: TForm1
|
||||
OnDraw = Chart1UserDrawnSeries1Draw
|
||||
end
|
||||
end
|
||||
object cbDomain: TCheckBox
|
||||
Left = 392
|
||||
Height = 17
|
||||
Top = 316
|
||||
Width = 55
|
||||
Anchors = [akRight, akBottom]
|
||||
Caption = 'Domain'
|
||||
OnChange = cbDomainChange
|
||||
TabOrder = 1
|
||||
end
|
||||
object UserDefinedChartSource1: TUserDefinedChartSource
|
||||
OnGetChartDataItem = UserDefinedChartSource1GetChartDataItem
|
||||
PointsNumber = 14
|
||||
|
@ -1,30 +1,29 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'"'#1#6'Height'#3'j'#1#3'Top'#3#152#0#5'Wi'
|
||||
+'dth'#3#205#1#7'Caption'#6#5'Form1'#12'ClientHeight'#3'j'#1#11'ClientWidth'#3
|
||||
+#205#1#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.29'#0#6'TChar'
|
||||
+'t'#6'Chart1'#4'Left'#2#0#6'Height'#3'j'#1#3'Top'#2#0#5'Width'#3#205#1#8'Axi'
|
||||
+'sList'#14#1#9'Alignment'#7#7'calLeft'#6'Offset'#5#0#0#0#0#0#0#0#0#0#0#5'Sca'
|
||||
+'le'#5#0#0#0#0#0#0#0#128#255'?'#22'Title.Font.Orientation'#3#132#3#0#1#9'Ali'
|
||||
+'gnment'#7#9'calBottom'#6'Offset'#5#0#0#0#0#0#0#0#0#0#0#5'Scale'#5#0#0#0#0#0
|
||||
+#0#0#128#255'?'#0#0#16'ExpandPercentage'#2#10#16'Foot.Brush.Color'#7#9'clBtn'
|
||||
+'Face'#15'Foot.Font.Color'#7#6'clBlue'#14'Legend.Visible'#9#17'Title.Brush.C'
|
||||
+'olor'#7#9'clBtnFace'#16'Title.Font.Color'#7#6'clBlue'#18'Title.Text.Strings'
|
||||
+#1#6#7'TAChart'#0#5'Align'#7#8'alClient'#11'ParentColor'#8#0#11'TFuncSeries'
|
||||
+#17'Chart1FuncSeries1'#11'Extent.XMin'#5#0#248'(\'#143#194#245#200#1#192#11
|
||||
+'Extent.YMin'#5#0#0#0#0#0#0#0#128#255#191#11'Extent.XMax'#5#0#248'(\'#143#194
|
||||
+#245#200#1'@'#11'Extent.YMax'#5#0#0#0#0#0#0#0#128#255'?'#14'Extent.UseXMin'#9
|
||||
+#14'Extent.UseYMin'#9#14'Extent.UseXMax'#9#14'Extent.UseYMax'#9#11'OnCalcula'
|
||||
+'te'#7#26'Chart1FuncSeries1Calculate'#9'Pen.Color'#7#7'clOlive'#9'Pen.Width'
|
||||
+#2#2#4'Step'#2#4#5'Title'#6#6'Sin(x)'#0#0#5'TLine'#11'Chart1XAxis'#12'ShowIn'
|
||||
+'Legend'#8#8'Position'#5#0#0#0#0#0#0#0#0#0#0#11'SeriesColor'#7#7'clBlack'#0#0
|
||||
+#5'TLine'#11'Chart1YAxis'#12'ShowInLegend'#8#9'LineStyle'#7#10'lsVertical'#8
|
||||
+'Position'#5#0#0#0#0#0#0#0#0#0#0#11'SeriesColor'#7#7'clBlack'#0#0#10'TBarSer'
|
||||
+'ies'#16'Chart1BarSeries1'#5'Title'#6#6'Cos(x)'#14'BarBrush.Color'#7#12'clMo'
|
||||
+'neyGreen'#11'SeriesColor'#7#12'clMoneyGreen'#6'Source'#7#23'UserDefinedChar'
|
||||
+'tSource1'#0#0#16'TUserDrawnSeries'#22'Chart1UserDrawnSeries1'#6'OnDraw'#7#26
|
||||
+'Chart1UserDrawnSeries1Draw'#0#0#0#23'TUserDefinedChartSource'#23'UserDefine'
|
||||
+'dChartSource1'#18'OnGetChartDataItem'#7'''UserDefinedChartSource1GetChartDa'
|
||||
+'taItem'#12'PointsNumber'#2#14#4'left'#3#135#0#3'top'#2'r'#0#0#0
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#141#2#6'Height'#3'j'#1#3'Top'#3#209#0#5'W'
|
||||
+'idth'#3#205#1#7'Caption'#6#5'Form1'#12'ClientHeight'#3'j'#1#11'ClientWidth'
|
||||
+#3#205#1#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.29'#0#6'TCh'
|
||||
+'art'#6'Chart1'#4'Left'#2#0#6'Height'#3'j'#1#3'Top'#2#0#5'Width'#3#205#1#8'A'
|
||||
+'xisList'#14#1#9'Alignment'#7#7'calLeft'#6'Offset'#2#0#5'Scale'#2#1#22'Title'
|
||||
+'.Font.Orientation'#3#132#3#0#1#9'Alignment'#7#9'calBottom'#6'Offset'#2#0#5
|
||||
+'Scale'#2#1#0#0#16'ExpandPercentage'#2#10#11'Extent.YMin'#2#250#11'Extent.YM'
|
||||
+'ax'#2#6#14'Extent.UseYMin'#9#14'Extent.UseYMax'#9#16'Foot.Brush.Color'#7#9
|
||||
+'clBtnFace'#15'Foot.Font.Color'#7#6'clBlue'#14'Legend.Visible'#9#17'Title.Br'
|
||||
+'ush.Color'#7#9'clBtnFace'#16'Title.Font.Color'#7#6'clBlue'#18'Title.Text.St'
|
||||
+'rings'#1#6#7'TAChart'#0#5'Align'#7#8'alClient'#11'ParentColor'#8#0#11'TFunc'
|
||||
+'Series'#17'Chart1FuncSeries1'#11'Extent.XMin'#5#195#245'(\'#143#194#245#200
|
||||
+#1#192#11'Extent.XMax'#5#195#245'(\'#143#194#245#200#1'@'#14'Extent.UseXMin'
|
||||
+#9#14'Extent.UseXMax'#9#11'OnCalculate'#7#26'Chart1FuncSeries1Calculate'#9'P'
|
||||
+'en.Color'#7#7'clOlive'#9'Pen.Width'#2#2#4'Step'#2#4#5'Title'#6#10'1 / Sin(x'
|
||||
+')'#0#0#5'TLine'#11'Chart1XAxis'#8'Position'#2#0#11'SeriesColor'#7#7'clBlack'
|
||||
+#12'ShowInLegend'#8#0#0#5'TLine'#11'Chart1YAxis'#9'LineStyle'#7#10'lsVertica'
|
||||
+'l'#8'Position'#2#0#11'SeriesColor'#7#7'clBlack'#12'ShowInLegend'#8#0#0#10'T'
|
||||
+'BarSeries'#16'Chart1BarSeries1'#5'Title'#6#6'Cos(x)'#14'BarBrush.Color'#7#12
|
||||
+'clMoneyGreen'#11'SeriesColor'#7#12'clMoneyGreen'#6'Source'#7#23'UserDefined'
|
||||
+'ChartSource1'#0#0#16'TUserDrawnSeries'#22'Chart1UserDrawnSeries1'#6'OnDraw'
|
||||
+#7#26'Chart1UserDrawnSeries1Draw'#0#0#0#9'TCheckBox'#8'cbDomain'#4'Left'#3
|
||||
+#136#1#6'Height'#2#17#3'Top'#3'<'#1#5'Width'#2'7'#7'Anchors'#11#7'akRight'#8
|
||||
+'akBottom'#0#7'Caption'#6#6'Domain'#8'OnChange'#7#14'cbDomainChange'#8'TabOr'
|
||||
+'der'#2#1#0#0#23'TUserDefinedChartSource'#23'UserDefinedChartSource1'#18'OnG'
|
||||
+'etChartDataItem'#7'''UserDefinedChartSource1GetChartDataItem'#12'PointsNumb'
|
||||
+'er'#2#14#4'left'#3#135#0#3'top'#2'r'#0#0#0
|
||||
]);
|
||||
|
@ -5,8 +5,8 @@ unit main;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
TAGraph, TASeries, TASources;
|
||||
Classes, StdCtrls, SysUtils, FileUtil, LResources, Forms, Controls, Graphics,
|
||||
Dialogs, TAGraph, TASeries, TASources;
|
||||
|
||||
type
|
||||
|
||||
@ -19,7 +19,9 @@ type
|
||||
Chart1UserDrawnSeries1: TUserDrawnSeries;
|
||||
Chart1YAxis: TLine;
|
||||
Chart1XAxis: TLine;
|
||||
cbDomain: TCheckBox;
|
||||
UserDefinedChartSource1: TUserDefinedChartSource;
|
||||
procedure cbDomainChange(Sender: TObject);
|
||||
procedure Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
|
||||
procedure Chart1UserDrawnSeries1Draw(ACanvas: TCanvas; const ARect: TRect);
|
||||
procedure UserDefinedChartSource1GetChartDataItem(
|
||||
@ -37,9 +39,22 @@ uses
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.cbDomainChange(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
with Chart1FuncSeries1.DomainExclusions do begin
|
||||
Clear;
|
||||
Epsilon := 1e-7;
|
||||
if cbDomain.Checked then
|
||||
for i := -10 to 10 do
|
||||
AddPoint(i * Pi);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
|
||||
begin
|
||||
AY := Sin(AX);
|
||||
AY := 1 / Sin(AX);
|
||||
end;
|
||||
|
||||
procedure TForm1.Chart1UserDrawnSeries1Draw(
|
||||
|
Loading…
Reference in New Issue
Block a user