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