mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 11:40:35 +02:00
TAChart: Add tools demo
git-svn-id: trunk@24346 -
This commit is contained in:
parent
cc26bf33e5
commit
0060d87d21
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -2121,6 +2121,10 @@ components/tachart/demo/save/main.lfm svneol=native#text/plain
|
||||
components/tachart/demo/save/main.pas svneol=native#text/plain
|
||||
components/tachart/demo/save/savedemo.lpi svneol=native#text/plain
|
||||
components/tachart/demo/save/savedemo.lpr svneol=native#text/plain
|
||||
components/tachart/demo/tools/main.lfm svneol=native#text/plain
|
||||
components/tachart/demo/tools/main.pas svneol=native#text/pascal
|
||||
components/tachart/demo/tools/toolsdemo.lpi svneol=native#text/plain
|
||||
components/tachart/demo/tools/toolsdemo.lpr svneol=native#text/pascal
|
||||
components/tachart/fpdoc/tachartaxis.xml svneol=native#text/plain
|
||||
components/tachart/fpdoc/tachartutils.xml svneol=native#text/plain
|
||||
components/tachart/fpdoc/tacustomseries.xml svneol=native#text/plain
|
||||
|
159
components/tachart/demo/tools/main.lfm
Normal file
159
components/tachart/demo/tools/main.lfm
Normal file
@ -0,0 +1,159 @@
|
||||
object Form1: TForm1
|
||||
Left = 292
|
||||
Height = 442
|
||||
Top = 152
|
||||
Width = 554
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 442
|
||||
ClientWidth = 554
|
||||
LCLVersion = '0.9.29'
|
||||
object Chart1: TChart
|
||||
Left = 0
|
||||
Height = 376
|
||||
Top = 0
|
||||
Width = 554
|
||||
AxisList = <
|
||||
item
|
||||
Alignment = calLeft
|
||||
Title.Font.Orientation = 900
|
||||
Transformation.Offset = 0
|
||||
Transformation.Scale = 1
|
||||
end
|
||||
item
|
||||
Alignment = calBottom
|
||||
Transformation.Offset = 0
|
||||
Transformation.Scale = 1
|
||||
end>
|
||||
Extent.XMin = -3
|
||||
Extent.YMin = -2
|
||||
Extent.XMax = 3
|
||||
Extent.YMax = 2
|
||||
Extent.UseXMin = True
|
||||
Extent.UseYMin = True
|
||||
Extent.UseXMax = True
|
||||
Extent.UseYMax = True
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Font.Color = clBlue
|
||||
Title.Text.Strings = (
|
||||
'TAChart'
|
||||
)
|
||||
Toolset = ChartToolset1
|
||||
Align = alClient
|
||||
DoubleBuffered = True
|
||||
ParentColor = False
|
||||
object Chart1FuncSeries1: TFuncSeries
|
||||
OnCalculate = Chart1FuncSeries1Calculate
|
||||
Pen.Color = clMaroon
|
||||
end
|
||||
object Chart1BarSeries1: TBarSeries
|
||||
BarBrush.Color = clRed
|
||||
SeriesColor = clRed
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 66
|
||||
Top = 376
|
||||
Width = 554
|
||||
Align = alBottom
|
||||
ClientHeight = 66
|
||||
ClientWidth = 554
|
||||
TabOrder = 1
|
||||
object rgZoom: TRadioGroup
|
||||
Left = 1
|
||||
Height = 64
|
||||
Top = 1
|
||||
Width = 255
|
||||
Align = alLeft
|
||||
AutoFill = True
|
||||
Caption = ' Zooming '
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 46
|
||||
ClientWidth = 251
|
||||
ItemIndex = 1
|
||||
Items.Strings = (
|
||||
'Drag to zoom'
|
||||
'Click to zoom in, Shift+click to zoom out'
|
||||
)
|
||||
OnClick = rgZoomClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object rgPan: TRadioGroup
|
||||
Left = 256
|
||||
Height = 64
|
||||
Top = 1
|
||||
Width = 292
|
||||
Align = alLeft
|
||||
AutoFill = True
|
||||
Caption = 'Panning'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 46
|
||||
ClientWidth = 288
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Right-drag in any direction'
|
||||
'Right-drag left/right, Shift+right-drag up/down'
|
||||
)
|
||||
OnClick = rgPanClick
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object ChartToolset1: TChartToolset
|
||||
left = 124
|
||||
top = 75
|
||||
object ChartToolset1ZoomOut: TZoomClickTool
|
||||
Shift = [ssShift, ssLeft]
|
||||
ZoomFactor = 0.5
|
||||
end
|
||||
object ChartToolset1ZoomIn: TZoomClickTool
|
||||
Shift = [ssLeft]
|
||||
ZoomFactor = 2
|
||||
end
|
||||
object ChartToolset1PanAny: TPanDragTool
|
||||
Shift = [ssRight]
|
||||
end
|
||||
object ChartToolset1ZoomDragTool1: TZoomDragTool
|
||||
Enabled = False
|
||||
Shift = [ssLeft]
|
||||
end
|
||||
object ChartToolset1PanHor: TPanDragTool
|
||||
Enabled = False
|
||||
Shift = [ssRight]
|
||||
ActiveCursor = crSizeWE
|
||||
Directions = [pdLeft, pdRight]
|
||||
end
|
||||
object ChartToolset1PanVert: TPanDragTool
|
||||
Enabled = False
|
||||
Shift = [ssShift, ssRight]
|
||||
ActiveCursor = crSizeNS
|
||||
Directions = [pdUp, pdDown]
|
||||
end
|
||||
end
|
||||
object RandomChartSource1: TRandomChartSource
|
||||
PointsNumber = 10
|
||||
RandSeed = 251061796
|
||||
XMax = 9
|
||||
XMin = 0
|
||||
YMax = 10
|
||||
YMin = 0
|
||||
left = 124
|
||||
top = 152
|
||||
end
|
||||
end
|
70
components/tachart/demo/tools/main.pas
Normal file
70
components/tachart/demo/tools/main.pas
Normal file
@ -0,0 +1,70 @@
|
||||
unit main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, ExtCtrls, SysUtils, FileUtil, LResources, Forms, Controls, Graphics,
|
||||
Dialogs, TAGraph, TASeries, TASources, TATools;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Chart1: TChart;
|
||||
Chart1BarSeries1: TBarSeries;
|
||||
Chart1FuncSeries1: TFuncSeries;
|
||||
ChartToolset1: TChartToolset;
|
||||
ChartToolset1PanAny: TPanDragTool;
|
||||
ChartToolset1PanHor: TPanDragTool;
|
||||
ChartToolset1PanVert: TPanDragTool;
|
||||
ChartToolset1ZoomDragTool1: TZoomDragTool;
|
||||
ChartToolset1ZoomOut: TZoomClickTool;
|
||||
ChartToolset1ZoomIn: TZoomClickTool;
|
||||
Panel1: TPanel;
|
||||
rgZoom: TRadioGroup;
|
||||
RandomChartSource1: TRandomChartSource;
|
||||
rgPan: TRadioGroup;
|
||||
procedure Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
|
||||
procedure rgPanClick(Sender: TObject);
|
||||
procedure rgZoomClick(Sender: TObject);
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
|
||||
begin
|
||||
AY := Sin(AX * 10) + 0.7 * Cos(AX * 30) + 0.3 * Sin(AX * 80);
|
||||
end;
|
||||
|
||||
procedure TForm1.rgPanClick(Sender: TObject);
|
||||
var
|
||||
b: Boolean;
|
||||
begin
|
||||
b := rgPan.ItemIndex = 0;
|
||||
ChartToolset1PanAny.Enabled := b;
|
||||
ChartToolset1PanHor.Enabled := not b;
|
||||
ChartToolset1PanVert.Enabled := not b;
|
||||
end;
|
||||
|
||||
procedure TForm1.rgZoomClick(Sender: TObject);
|
||||
var
|
||||
b: Boolean;
|
||||
begin
|
||||
b := rgZoom.ItemIndex = 0;
|
||||
ChartToolset1ZoomDragTool1.Enabled := b;
|
||||
ChartToolset1ZoomIn.Enabled := not b;
|
||||
ChartToolset1ZoomOut.Enabled := not b;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
96
components/tachart/demo/tools/toolsdemo.lpi
Normal file
96
components/tachart/demo/tools/toolsdemo.lpi
Normal file
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="7"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<UseDefaultCompilerOptions Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
<StringTable Comments="" CompanyName="" FileDescription="" FileVersion="" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
|
||||
</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="toolsdemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="toolsdemo"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="main"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="8"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="toolsdemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)\"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<UseAnsiStrings Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
20
components/tachart/demo/tools/toolsdemo.lpr
Normal file
20
components/tachart/demo/tools/toolsdemo.lpr
Normal file
@ -0,0 +1,20 @@
|
||||
program toolsdemo;
|
||||
|
||||
{$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 };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user