TAChart: Add chart extent demo.

In particular, it is useful to test issue #13681.

git-svn-id: trunk@20091 -
This commit is contained in:
ask 2009-05-21 07:55:56 +00:00
parent ff15f8408c
commit a0897c76f4
6 changed files with 347 additions and 0 deletions

5
.gitattributes vendored
View File

@ -1539,6 +1539,11 @@ components/tachart/demo/basic/demo.lpr svneol=native#text/plain
components/tachart/demo/basic/unit1.lfm svneol=native#text/plain
components/tachart/demo/basic/unit1.lrs svneol=native#text/plain
components/tachart/demo/basic/unit1.pas svneol=native#text/plain
components/tachart/demo/extent/extentdemo.lpi svneol=native#text/plain
components/tachart/demo/extent/extentdemo.lpr svneol=native#text/plain
components/tachart/demo/extent/main.lfm svneol=native#text/plain
components/tachart/demo/extent/main.lrs svneol=native#text/plain
components/tachart/demo/extent/main.pas svneol=native#text/plain
components/tachart/demo/func/funcdemo.lpi svneol=native#text/plain
components/tachart/demo/func/funcdemo.lpr svneol=native#text/plain
components/tachart/demo/func/main.lfm svneol=native#text/plain

View File

@ -0,0 +1,71 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="7"/>
<General>
<Flags>
<SaveClosedFiles Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
<UseXPManifest Value="True"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="TAChartLazarusPkg"/>
<MinVersion Major="1" Valid="True"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="extentdemo.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="extentdemo"/>
</Unit0>
<Unit1>
<Filename Value="main.pas"/>
<ComponentName Value="Form1"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="main"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)\"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@ -0,0 +1,20 @@
program extentdemo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, main, TAChartLazarusPkg
{ you can add units after this };
{$IFDEF WINDOWS}{$R extentdemo.rc}{$ENDIF}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,129 @@
object Form1: TForm1
Left = 319
Height = 397
Top = 165
Width = 396
Caption = 'Form1'
ClientHeight = 397
ClientWidth = 396
OnCreate = FormCreate
LCLVersion = '0.9.27'
object Chart1: TChart
Left = 0
Height = 307
Top = 0
Width = 396
BottomAxis.Grid.Style = psDot
BottomAxis.Grid.Visible = False
Extent.XMin = -1.7
Extent.YMin = -1.7
Extent.XMax = 1.7
Extent.YMax = 1.7
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
LeftAxis.Grid.Style = psDot
LeftAxis.Grid.Visible = False
LeftAxis.Title.Angle = 90
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlue
Title.Text.Strings = (
'TAChart'
)
Align = alClient
ParentColor = False
object Chart1LineSeries: TLineSeries
Pointer.Brush.Color = clRed
Pointer.Pen.Color = clRed
SeriesColor = clRed
ShowPoints = True
end
object clRight: TLine
LineStyle = lsVertical
Pen.Color = clGreen
Pen.Style = psDot
Position = 1.7
SeriesColor = clGreen
UseBounds = False
end
object clLeft: TLine
LineStyle = lsVertical
Pen.Color = clGreen
Pen.Style = psDot
Position = -1.7
SeriesColor = clGreen
UseBounds = False
end
object clTop: TLine
Pen.Color = clGreen
Pen.Style = psDot
Position = 1.7
SeriesColor = clGreen
UseBounds = False
end
object clBottom: TLine
Pen.Color = clGreen
Pen.Style = psDot
Position = -1.7
SeriesColor = clGreen
UseBounds = False
end
end
object Panel1: TPanel
Left = 0
Height = 90
Top = 307
Width = 396
Align = alBottom
ClientHeight = 90
ClientWidth = 396
TabOrder = 1
object lblBoundValue: TLabel
Left = 160
Height = 14
Top = 21
Width = 27
Caption = 'Value'
ParentColor = False
end
object cgUseBounds: TCheckGroup
Left = 1
Height = 88
Top = 1
Width = 147
Align = alLeft
AutoFill = True
Caption = ' Use bounds '
ChildSizing.LeftRightSpacing = 8
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
Items.Strings = (
'Left'
'Right'
'Bottom'
'Top'
)
OnItemClick = cgUseBoundsItemClick
TabOrder = 0
Data = {
0400000002020202
}
end
object fseBounds: TFloatSpinEdit
Left = 204
Height = 23
Top = 17
Width = 50
Increment = 0.1
MaxValue = 10
MinValue = 1
OnChange = fseBoundsChange
TabOrder = 1
Value = 1.7
end
end
end

View File

@ -0,0 +1,46 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'?'#1#6'Height'#3#141#1#3'Top'#3#165#0#5'W'
+'idth'#3#140#1#7'Caption'#6#5'Form1'#12'ClientHeight'#3#141#1#11'ClientWidth'
+#3#140#1#8'OnCreate'#7#10'FormCreate'#10'LCLVersion'#6#6'0.9.27'#0#6'TChart'
+#6'Chart1'#4'Left'#2#0#6'Height'#3'3'#1#3'Top'#2#0#5'Width'#3#140#1#21'Botto'
+'mAxis.Grid.Style'#7#5'psDot'#23'BottomAxis.Grid.Visible'#8#11'Extent.XMin'#5
+#0#152#153#153#153#153#153#217#255#191#11'Extent.YMin'#5#0#152#153#153#153
+#153#153#217#255#191#11'Extent.XMax'#5#0#152#153#153#153#153#153#217#255'?'
+#11'Extent.YMax'#5#0#152#153#153#153#153#153#217#255'?'#16'Foot.Brush.Color'
+#7#9'clBtnFace'#15'Foot.Font.Color'#7#6'clBlue'#19'LeftAxis.Grid.Style'#7#5
+'psDot'#21'LeftAxis.Grid.Visible'#8#20'LeftAxis.Title.Angle'#2'Z'#17'Title.B'
+'rush.Color'#7#9'clBtnFace'#16'Title.Font.Color'#7#6'clBlue'#18'Title.Text.S'
+'trings'#1#6#7'TAChart'#0#5'Align'#7#8'alClient'#11'ParentColor'#8#0#11'TLin'
+'eSeries'#16'Chart1LineSeries'#19'Pointer.Brush.Color'#7#5'clRed'#17'Pointer'
+'.Pen.Color'#7#5'clRed'#11'SeriesColor'#7#5'clRed'#10'ShowPoints'#9#0#0#5'TL'
+'ine'#7'clRight'#9'LineStyle'#7#10'lsVertical'#9'Pen.Color'#7#7'clGreen'#9'P'
+'en.Style'#7#5'psDot'#8'Position'#5#0#152#153#153#153#153#153#217#255'?'#11
+'SeriesColor'#7#7'clGreen'#9'UseBounds'#8#0#0#5'TLine'#6'clLeft'#9'LineStyle'
+#7#10'lsVertical'#9'Pen.Color'#7#7'clGreen'#9'Pen.Style'#7#5'psDot'#8'Positi'
+'on'#5#0#152#153#153#153#153#153#217#255#191#11'SeriesColor'#7#7'clGreen'#9
+'UseBounds'#8#0#0#5'TLine'#5'clTop'#9'Pen.Color'#7#7'clGreen'#9'Pen.Style'#7
+#5'psDot'#8'Position'#5#0#152#153#153#153#153#153#217#255'?'#11'SeriesColor'
+#7#7'clGreen'#9'UseBounds'#8#0#0#5'TLine'#8'clBottom'#9'Pen.Color'#7#7'clGre'
+'en'#9'Pen.Style'#7#5'psDot'#8'Position'#5#0#152#153#153#153#153#153#217#255
+#191#11'SeriesColor'#7#7'clGreen'#9'UseBounds'#8#0#0#0#6'TPanel'#6'Panel1'#4
+'Left'#2#0#6'Height'#2'Z'#3'Top'#3'3'#1#5'Width'#3#140#1#5'Align'#7#8'alBott'
+'om'#12'ClientHeight'#2'Z'#11'ClientWidth'#3#140#1#8'TabOrder'#2#1#0#6'TLabe'
+'l'#13'lblBoundValue'#4'Left'#3#160#0#6'Height'#2#14#3'Top'#2#21#5'Width'#2
+#27#7'Caption'#6#5'Value'#11'ParentColor'#8#0#0#11'TCheckGroup'#11'cgUseBoun'
+'ds'#4'Left'#2#1#6'Height'#2'X'#3'Top'#2#1#5'Width'#3#147#0#5'Align'#7#6'alL'
+'eft'#8'AutoFill'#9#7'Caption'#6#12' Use bounds '#28'ChildSizing.LeftRightSp'
+'acing'#2#8#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHoriz'
+'ontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24
+'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChi'
+'lds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Lay'
+'out'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1
+#13'Items.Strings'#1#6#4'Left'#6#5'Right'#6#6'Bottom'#6#3'Top'#0#11'OnItemCl'
+'ick'#7#20'cgUseBoundsItemClick'#8'TabOrder'#2#0#4'Data'#10#8#0#0#0#4#0#0#0#2
+#2#2#2#0#0#14'TFloatSpinEdit'#9'fseBounds'#4'Left'#3#204#0#6'Height'#2#23#3
+'Top'#2#17#5'Width'#2'2'#9'Increment'#5#0#208#204#204#204#204#204#204#251'?'
+#8'MaxValue'#5#0#0#0#0#0#0#0#160#2'@'#8'MinValue'#5#0#0#0#0#0#0#0#128#255'?'
+#8'OnChange'#7#15'fseBoundsChange'#8'TabOrder'#2#1#5'Value'#5#0#152#153#153
+#153#153#153#217#255'?'#0#0#0#0
]);

View File

@ -0,0 +1,76 @@
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, ExtCtrls, Spin, StdCtrls, SysUtils, FileUtil, LResources, Forms,
Controls, Graphics, Dialogs, TAGraph, TASeries;
type
{ TForm1 }
TForm1 = class(TForm)
cgUseBounds: TCheckGroup;
Chart1: TChart;
clRight: TLine;
clLeft: TLine;
clTop: TLine;
clBottom: TLine;
Chart1LineSeries: TLineSeries;
fseBounds: TFloatSpinEdit;
lblBoundValue: TLabel;
Panel1: TPanel;
procedure cgUseBoundsItemClick(Sender: TObject; Index: integer);
procedure FormCreate(Sender: TObject);
procedure fseBoundsChange(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.cgUseBoundsItemClick(Sender: TObject; Index: integer);
begin
with Chart1.Extent do begin
UseXMin := cgUseBounds.Checked[0];
UseXMax := cgUseBounds.Checked[1];
UseYMin := cgUseBounds.Checked[2];
UseYMax := cgUseBounds.Checked[3];
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
begin
RandSeed := 342432;
for i := -10 to 10 do
Chart1LineSeries.AddXY(i * 0.5, Random(20) * 0.5 - 5);
fseBoundsChange(nil);
end;
procedure TForm1.fseBoundsChange(Sender: TObject);
begin
clRight.Position := fseBounds.Value;
clLeft.Position := -fseBounds.Value;
clTop.Position := fseBounds.Value;
clBottom.Position := -fseBounds.Value;
with Chart1.Extent do begin
XMin := -fseBounds.Value;
XMax := fseBounds.Value;
YMin := -fseBounds.Value;
YMax := fseBounds.Value;
end;
end;
initialization
{$I main.lrs}
end.