mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-22 09:51:32 +02:00
TAChart: Add new demo for paned charts (demo/panes-2)
git-svn-id: trunk@48511 -
This commit is contained in:
parent
489724243b
commit
b677a06286
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -3702,6 +3702,10 @@ components/tachart/demo/opengl/Main.lfm svneol=native#text/plain
|
||||
components/tachart/demo/opengl/Main.pas svneol=native#text/pascal
|
||||
components/tachart/demo/opengl/opengldemo.lpi svneol=native#text/plain
|
||||
components/tachart/demo/opengl/opengldemo.lpr svneol=native#text/pascal
|
||||
components/tachart/demo/panes-2/project1.lpi svneol=native#text/pascal
|
||||
components/tachart/demo/panes-2/project1.lpr svneol=native#text/pascal
|
||||
components/tachart/demo/panes-2/unit1.lfm svneol=native#text/pascal
|
||||
components/tachart/demo/panes-2/unit1.pas svneol=native#text/pascal
|
||||
components/tachart/demo/panes/Main.lfm svneol=native#text/plain
|
||||
components/tachart/demo/panes/Main.pas svneol=native#text/pascal
|
||||
components/tachart/demo/panes/panes.lpi svneol=native#text/plain
|
||||
|
86
components/tachart/demo/panes-2/project1.lpi
Normal file
86
components/tachart/demo/panes-2/project1.lpi
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="project1"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="TAChartLazarusPkg"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="project1"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
21
components/tachart/demo/panes-2/project1.lpr
Normal file
21
components/tachart/demo/panes-2/project1.lpr
Normal file
@ -0,0 +1,21 @@
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, Unit1, tachartlazaruspkg
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
554
components/tachart/demo/panes-2/unit1.lfm
Normal file
554
components/tachart/demo/panes-2/unit1.lfm
Normal file
@ -0,0 +1,554 @@
|
||||
object Form1: TForm1
|
||||
Left = 394
|
||||
Height = 492
|
||||
Top = 225
|
||||
Width = 881
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 492
|
||||
ClientWidth = 881
|
||||
LCLVersion = '1.5'
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 492
|
||||
Top = 0
|
||||
Width = 160
|
||||
Align = alLeft
|
||||
ClientHeight = 492
|
||||
ClientWidth = 160
|
||||
TabOrder = 0
|
||||
object CbLineAtDataOnly: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 10
|
||||
Width = 107
|
||||
Caption = 'Line at data only'
|
||||
Checked = True
|
||||
OnChange = CbLineAtDataOnlyChange
|
||||
State = cbChecked
|
||||
TabOrder = 0
|
||||
end
|
||||
object CbShowHorGrid: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 184
|
||||
Width = 62
|
||||
Caption = 'hor grid'
|
||||
OnChange = CbShowGridChange
|
||||
TabOrder = 1
|
||||
end
|
||||
object CbShowArrow: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 112
|
||||
Width = 52
|
||||
Caption = 'Arrow'
|
||||
OnChange = CbShowArrowChange
|
||||
TabOrder = 2
|
||||
end
|
||||
object CbInverted: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 136
|
||||
Width = 63
|
||||
Caption = 'Inverted'
|
||||
OnChange = CbInvertedChange
|
||||
TabOrder = 3
|
||||
end
|
||||
object CbBiDiMode: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 160
|
||||
Width = 83
|
||||
Caption = 'right-to-left'
|
||||
OnChange = CbBiDiModeChange
|
||||
TabOrder = 4
|
||||
end
|
||||
object CbMarksAtDataOnly: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 37
|
||||
Width = 117
|
||||
Caption = 'Marks at data only'
|
||||
Checked = True
|
||||
OnChange = CbMarksAtDataOnlyChange
|
||||
State = cbChecked
|
||||
TabOrder = 5
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 256
|
||||
Width = 36
|
||||
Caption = 'Range:'
|
||||
ParentColor = False
|
||||
end
|
||||
object CbUseMax: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 272
|
||||
Width = 61
|
||||
Caption = 'UseMax'
|
||||
OnChange = CbUseMaxChange
|
||||
TabOrder = 6
|
||||
end
|
||||
object CbUseMin: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 296
|
||||
Width = 60
|
||||
Caption = 'UseMin'
|
||||
OnChange = CbUseMinChange
|
||||
TabOrder = 7
|
||||
end
|
||||
object CbGrouped: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 64
|
||||
Width = 66
|
||||
Caption = 'Grouped'
|
||||
OnChange = CbGroupedChange
|
||||
TabOrder = 8
|
||||
end
|
||||
object CbShowFrame: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 88
|
||||
Width = 53
|
||||
Caption = 'Frame'
|
||||
Checked = True
|
||||
OnChange = CbShowFrameChange
|
||||
State = cbChecked
|
||||
TabOrder = 9
|
||||
end
|
||||
object CbShowVertGrid: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 208
|
||||
Width = 64
|
||||
Caption = 'vert grid'
|
||||
OnChange = CbShowGridChange
|
||||
TabOrder = 10
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 12
|
||||
Height = 67
|
||||
Top = 333
|
||||
Width = 135
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = False
|
||||
Caption = 'Drag the dashed lines...'
|
||||
ParentColor = False
|
||||
WordWrap = True
|
||||
end
|
||||
end
|
||||
object PageControl1: TPageControl
|
||||
Left = 160
|
||||
Height = 492
|
||||
Top = 0
|
||||
Width = 721
|
||||
ActivePage = TabSheet1
|
||||
Align = alClient
|
||||
TabIndex = 0
|
||||
TabOrder = 1
|
||||
OnChanging = PageControl1Changing
|
||||
object TabSheet1: TTabSheet
|
||||
Caption = 'Horizontal panes'
|
||||
ClientHeight = 464
|
||||
ClientWidth = 713
|
||||
object Chart1: TChart
|
||||
Left = 0
|
||||
Height = 464
|
||||
Top = 0
|
||||
Width = 713
|
||||
AxisList = <
|
||||
item
|
||||
Grid.Color = clGray
|
||||
Grid.Visible = False
|
||||
Alignment = calBottom
|
||||
AxisPen.Visible = True
|
||||
Minors = <>
|
||||
Title.Visible = True
|
||||
Title.Caption = 'x axis'
|
||||
end
|
||||
item
|
||||
Grid.Color = clGray
|
||||
Grid.Visible = False
|
||||
TickColor = clBlue
|
||||
AtDataOnly = True
|
||||
AxisPen.Color = clBlue
|
||||
AxisPen.Visible = True
|
||||
Marks.LabelFont.Color = clBlue
|
||||
Marks.AtDataOnly = True
|
||||
Minors = <>
|
||||
Range.Max = 5
|
||||
Range.Min = -5
|
||||
Title.LabelFont.Color = clBlue
|
||||
Title.LabelFont.Orientation = 900
|
||||
Title.Visible = True
|
||||
Title.Caption = 'y1 axis'
|
||||
Title.PositionOnMarks = True
|
||||
Transformations = ChartAxisTransformations1
|
||||
end
|
||||
item
|
||||
Grid.Color = clGray
|
||||
Grid.Visible = False
|
||||
TickColor = clRed
|
||||
AtDataOnly = True
|
||||
AxisPen.Color = clRed
|
||||
AxisPen.Visible = True
|
||||
Marks.LabelFont.Color = clRed
|
||||
Marks.AtDataOnly = True
|
||||
Minors = <>
|
||||
Range.Max = 20
|
||||
Title.LabelFont.Color = clRed
|
||||
Title.LabelFont.Orientation = 900
|
||||
Title.Visible = True
|
||||
Title.Caption = 'y2 axis'
|
||||
Title.PositionOnMarks = True
|
||||
Transformations = ChartAxisTransformations2
|
||||
end
|
||||
item
|
||||
Grid.Color = clGray
|
||||
Grid.Visible = False
|
||||
AtDataOnly = True
|
||||
AxisPen.Color = clFuchsia
|
||||
AxisPen.Visible = True
|
||||
Marks.LabelFont.Color = clFuchsia
|
||||
Marks.AtDataOnly = True
|
||||
Minors = <>
|
||||
Range.Max = 100
|
||||
Range.Min = -100
|
||||
Title.LabelFont.Color = clFuchsia
|
||||
Title.LabelFont.Orientation = 900
|
||||
Title.Visible = True
|
||||
Title.Caption = 'y3 axis'
|
||||
Title.PositionOnMarks = True
|
||||
Transformations = ChartAxisTransformations3
|
||||
end>
|
||||
BackColor = clNone
|
||||
Extent.UseYMax = True
|
||||
Extent.UseYMin = True
|
||||
Extent.YMax = 10
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Font.Color = clBlue
|
||||
Title.Text.Strings = (
|
||||
'TAChart'
|
||||
)
|
||||
Toolset = ChartToolset1
|
||||
Align = alClient
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
object Chart1LineSeries1: TLineSeries
|
||||
AxisIndexX = 0
|
||||
AxisIndexY = 1
|
||||
LinePen.Color = clBlue
|
||||
Source = RandomChartSource11
|
||||
end
|
||||
object Chart1LineSeries2: TLineSeries
|
||||
AxisIndexX = 0
|
||||
AxisIndexY = 2
|
||||
LinePen.Color = clRed
|
||||
Source = RandomChartSource12
|
||||
end
|
||||
object Chart1LineSeries3: TLineSeries
|
||||
AxisIndexX = 0
|
||||
AxisIndexY = 3
|
||||
LinePen.Color = clFuchsia
|
||||
Source = RandomChartSource13
|
||||
end
|
||||
object Chart1LineSeries4: TLineSeries
|
||||
AxisIndexX = 0
|
||||
AxisIndexY = 3
|
||||
LinePen.Color = clFuchsia
|
||||
LinePen.Style = psDot
|
||||
Source = RandomChartSource14
|
||||
end
|
||||
object Chart1ConstantLine1: TConstantLine
|
||||
Pen.Color = clBlue
|
||||
Pen.Style = psDash
|
||||
Position = 2
|
||||
end
|
||||
object Chart1ConstantLine2: TConstantLine
|
||||
Pen.Color = clRed
|
||||
Pen.Style = psDash
|
||||
Position = 3
|
||||
end
|
||||
object Chart1ConstantLine3: TConstantLine
|
||||
Pen.Color = clRed
|
||||
Pen.Style = psDash
|
||||
Position = 5
|
||||
end
|
||||
object Chart1ConstantLine4: TConstantLine
|
||||
Pen.Color = clFuchsia
|
||||
Pen.Style = psDash
|
||||
Position = 6
|
||||
end
|
||||
end
|
||||
end
|
||||
object TabSheet2: TTabSheet
|
||||
Caption = 'Vertical panes'
|
||||
ClientHeight = 464
|
||||
ClientWidth = 726
|
||||
object Chart2: TChart
|
||||
Left = 0
|
||||
Height = 464
|
||||
Top = 0
|
||||
Width = 726
|
||||
AxisList = <
|
||||
item
|
||||
Grid.Color = clGray
|
||||
Grid.Visible = False
|
||||
AxisPen.Visible = True
|
||||
Minors = <>
|
||||
Title.LabelFont.Orientation = 900
|
||||
Title.Visible = True
|
||||
Title.Caption = 'y axis'
|
||||
end
|
||||
item
|
||||
Grid.Color = clGray
|
||||
Grid.Visible = False
|
||||
TickColor = clBlue
|
||||
Alignment = calBottom
|
||||
AtDataOnly = True
|
||||
AxisPen.Color = clBlue
|
||||
AxisPen.Visible = True
|
||||
Marks.LabelFont.Color = clBlue
|
||||
Marks.AtDataOnly = True
|
||||
Minors = <>
|
||||
Range.Max = 5
|
||||
Range.Min = -5
|
||||
Title.LabelFont.Color = clBlue
|
||||
Title.Visible = True
|
||||
Title.Caption = 'x1 axis'
|
||||
Title.PositionOnMarks = True
|
||||
Transformations = ChartAxisTransformations1
|
||||
end
|
||||
item
|
||||
Grid.Color = clGray
|
||||
Grid.Visible = False
|
||||
TickColor = clRed
|
||||
Alignment = calBottom
|
||||
AtDataOnly = True
|
||||
AxisPen.Color = clRed
|
||||
AxisPen.Visible = True
|
||||
Marks.LabelFont.Color = clRed
|
||||
Marks.AtDataOnly = True
|
||||
Minors = <>
|
||||
Range.Max = 20
|
||||
Title.LabelFont.Color = clRed
|
||||
Title.Visible = True
|
||||
Title.Caption = 'x2 axis'
|
||||
Title.PositionOnMarks = True
|
||||
Transformations = ChartAxisTransformations2
|
||||
end
|
||||
item
|
||||
Grid.Color = clGray
|
||||
Grid.Visible = False
|
||||
Alignment = calBottom
|
||||
AtDataOnly = True
|
||||
AxisPen.Color = clFuchsia
|
||||
AxisPen.Visible = True
|
||||
Marks.LabelFont.Color = clFuchsia
|
||||
Marks.AtDataOnly = True
|
||||
Minors = <>
|
||||
Range.Max = 100
|
||||
Range.Min = -100
|
||||
Title.LabelFont.Color = clFuchsia
|
||||
Title.Visible = True
|
||||
Title.Caption = 'x3 axis'
|
||||
Title.PositionOnMarks = True
|
||||
Transformations = ChartAxisTransformations3
|
||||
end>
|
||||
BackColor = clNone
|
||||
Extent.UseXMax = True
|
||||
Extent.UseXMin = True
|
||||
Extent.XMax = 10
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Font.Color = clBlue
|
||||
Title.Text.Strings = (
|
||||
'TAChart'
|
||||
)
|
||||
Toolset = ChartToolset2
|
||||
Align = alClient
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
object Chart2LineSeries1: TLineSeries
|
||||
AxisIndexX = 1
|
||||
AxisIndexY = 0
|
||||
LinePen.Color = clBlue
|
||||
Source = RandomChartSource21
|
||||
end
|
||||
object Chart2LineSeries2: TLineSeries
|
||||
AxisIndexX = 2
|
||||
AxisIndexY = 0
|
||||
LinePen.Color = clRed
|
||||
Source = RandomChartSource22
|
||||
end
|
||||
object Chart2LineSeries3: TLineSeries
|
||||
AxisIndexX = 3
|
||||
AxisIndexY = 0
|
||||
LinePen.Color = clFuchsia
|
||||
Source = RandomChartSource23
|
||||
end
|
||||
object Chart2LineSeries4: TLineSeries
|
||||
AxisIndexX = 3
|
||||
AxisIndexY = 0
|
||||
LinePen.Color = clFuchsia
|
||||
LinePen.Style = psDot
|
||||
Source = RandomChartSource24
|
||||
end
|
||||
object Chart2ConstantLine1: TConstantLine
|
||||
LineStyle = lsVertical
|
||||
Pen.Color = clBlue
|
||||
Pen.Style = psDash
|
||||
Position = 2
|
||||
end
|
||||
object Chart2ConstantLine2: TConstantLine
|
||||
LineStyle = lsVertical
|
||||
Pen.Color = clRed
|
||||
Pen.Style = psDash
|
||||
Position = 3
|
||||
end
|
||||
object Chart2ConstantLine3: TConstantLine
|
||||
LineStyle = lsVertical
|
||||
Pen.Color = clRed
|
||||
Pen.Style = psDash
|
||||
Position = 5
|
||||
end
|
||||
object Chart2ConstantLine4: TConstantLine
|
||||
LineStyle = lsVertical
|
||||
Pen.Color = clFuchsia
|
||||
Pen.Style = psDash
|
||||
Position = 6
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
object RandomChartSource11: TRandomChartSource
|
||||
PointsNumber = 10
|
||||
RandSeed = 2088531169
|
||||
XMax = 1
|
||||
XMin = 0
|
||||
YMax = 1
|
||||
YMin = 0
|
||||
left = 200
|
||||
top = 48
|
||||
end
|
||||
object RandomChartSource12: TRandomChartSource
|
||||
PointsNumber = 10
|
||||
RandSeed = 2088635735
|
||||
XMax = 1
|
||||
XMin = 0
|
||||
YMax = 10
|
||||
YMin = 0
|
||||
left = 200
|
||||
top = 115
|
||||
end
|
||||
object RandomChartSource13: TRandomChartSource
|
||||
PointsNumber = 10
|
||||
RandSeed = 2088693796
|
||||
XMax = 1
|
||||
XMin = 0
|
||||
YMax = 10
|
||||
YMin = 0
|
||||
left = 200
|
||||
top = 188
|
||||
end
|
||||
object ChartAxisTransformations1: TChartAxisTransformations
|
||||
left = 776
|
||||
top = 48
|
||||
object ChartAxisTransformations1AutoScaleAxisTransform1: TAutoScaleAxisTransform
|
||||
MaxValue = 2
|
||||
end
|
||||
end
|
||||
object ChartAxisTransformations2: TChartAxisTransformations
|
||||
left = 776
|
||||
top = 115
|
||||
object ChartAxisTransformations2AutoScaleAxisTransform1: TAutoScaleAxisTransform
|
||||
MaxValue = 5
|
||||
MinValue = 3
|
||||
end
|
||||
end
|
||||
object ChartAxisTransformations3: TChartAxisTransformations
|
||||
left = 776
|
||||
top = 188
|
||||
object ChartAxisTransformations3AutoScaleAxisTransform1: TAutoScaleAxisTransform
|
||||
MaxValue = 10
|
||||
MinValue = 6
|
||||
end
|
||||
end
|
||||
object RandomChartSource14: TRandomChartSource
|
||||
PointsNumber = 5
|
||||
RandSeed = 999856828
|
||||
XMax = 1
|
||||
XMin = 0
|
||||
YMax = 100
|
||||
YMin = 0
|
||||
left = 200
|
||||
top = 256
|
||||
end
|
||||
object RandomChartSource21: TRandomChartSource
|
||||
PointsNumber = 10
|
||||
RandSeed = 2088531169
|
||||
XMax = 1
|
||||
XMin = 0
|
||||
YMax = 1
|
||||
YMin = 0
|
||||
left = 336
|
||||
top = 48
|
||||
end
|
||||
object RandomChartSource22: TRandomChartSource
|
||||
PointsNumber = 10
|
||||
RandSeed = 2088635735
|
||||
XMax = 10
|
||||
XMin = 0
|
||||
YMax = 1
|
||||
YMin = 0
|
||||
left = 336
|
||||
top = 115
|
||||
end
|
||||
object RandomChartSource23: TRandomChartSource
|
||||
PointsNumber = 10
|
||||
RandSeed = 2088693796
|
||||
XMax = 10
|
||||
XMin = 0
|
||||
YMax = 1
|
||||
YMin = 0
|
||||
left = 336
|
||||
top = 188
|
||||
end
|
||||
object RandomChartSource24: TRandomChartSource
|
||||
PointsNumber = 5
|
||||
RandSeed = 999856828
|
||||
XMax = 100
|
||||
XMin = 0
|
||||
YMax = 1
|
||||
YMin = 0
|
||||
left = 336
|
||||
top = 256
|
||||
end
|
||||
object ChartToolset1: TChartToolset
|
||||
left = 200
|
||||
top = 392
|
||||
object ChartToolset1DataPointDragTool1: TDataPointDragTool
|
||||
Shift = [ssLeft]
|
||||
OnAfterMouseMove = DataPointDragTool_AfterMouseMove
|
||||
AffectedSeries = '4,5,6,7'
|
||||
ActiveCursor = crSizeNS
|
||||
end
|
||||
end
|
||||
object ChartToolset2: TChartToolset
|
||||
left = 336
|
||||
top = 392
|
||||
object ChartToolset2DataPointDragTool1: TDataPointDragTool
|
||||
Shift = [ssLeft]
|
||||
OnAfterMouseMove = DataPointDragTool_AfterMouseMove
|
||||
AffectedSeries = '4,5,6,7'
|
||||
ActiveCursor = crSizeWE
|
||||
end
|
||||
end
|
||||
end
|
284
components/tachart/demo/panes-2/unit1.pas
Normal file
284
components/tachart/demo/panes-2/unit1.pas
Normal file
@ -0,0 +1,284 @@
|
||||
unit Unit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, TAGraph, TASources, TASeries, TATransformations,
|
||||
Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, ComCtrls, types,
|
||||
TACustomSeries, TATools;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
CbShowVertGrid: TCheckBox;
|
||||
Chart1ConstantLine2: TConstantLine;
|
||||
Chart1ConstantLine3: TConstantLine;
|
||||
Chart1ConstantLine4: TConstantLine;
|
||||
Chart2ConstantLine1: TConstantLine;
|
||||
Chart2ConstantLine2: TConstantLine;
|
||||
Chart2ConstantLine3: TConstantLine;
|
||||
Chart2ConstantLine4: TConstantLine;
|
||||
Chart1ConstantLine1: TConstantLine;
|
||||
Chart1LineSeries2: TLineSeries;
|
||||
Chart1LineSeries3: TLineSeries;
|
||||
Chart1LineSeries4: TLineSeries;
|
||||
Chart2LineSeries1: TLineSeries;
|
||||
Chart2LineSeries2: TLineSeries;
|
||||
Chart2LineSeries3: TLineSeries;
|
||||
Chart2LineSeries4: TLineSeries;
|
||||
Chart1LineSeries1: TLineSeries;
|
||||
Chart2: TChart;
|
||||
Chart1: TChart;
|
||||
ChartAxisTransformations1: TChartAxisTransformations;
|
||||
ChartAxisTransformations1AutoScaleAxisTransform1: TAutoScaleAxisTransform;
|
||||
ChartAxisTransformations2: TChartAxisTransformations;
|
||||
ChartAxisTransformations2AutoScaleAxisTransform1: TAutoScaleAxisTransform;
|
||||
ChartAxisTransformations3: TChartAxisTransformations;
|
||||
ChartAxisTransformations3AutoScaleAxisTransform1: TAutoScaleAxisTransform;
|
||||
ChartToolset1: TChartToolset;
|
||||
ChartToolset1DataPointDragTool1: TDataPointDragTool;
|
||||
ChartToolset2: TChartToolset;
|
||||
ChartToolset2DataPointDragTool1: TDataPointDragTool;
|
||||
CbLineAtDataOnly: TCheckBox;
|
||||
CbShowHorGrid: TCheckBox;
|
||||
CbShowArrow: TCheckBox;
|
||||
CbInverted: TCheckBox;
|
||||
CbBiDiMode: TCheckBox;
|
||||
CbMarksAtDataOnly: TCheckBox;
|
||||
CbUseMax: TCheckBox;
|
||||
CbUseMin: TCheckBox;
|
||||
CbGrouped: TCheckBox;
|
||||
CbShowFrame: TCheckBox;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
PageControl1: TPageControl;
|
||||
Panel1: TPanel;
|
||||
RandomChartSource11: TRandomChartSource;
|
||||
RandomChartSource12: TRandomChartSource;
|
||||
RandomChartSource13: TRandomChartSource;
|
||||
RandomChartSource14: TRandomChartSource;
|
||||
RandomChartSource21: TRandomChartSource;
|
||||
RandomChartSource22: TRandomChartSource;
|
||||
RandomChartSource23: TRandomChartSource;
|
||||
RandomChartSource24: TRandomChartSource;
|
||||
TabSheet1: TTabSheet;
|
||||
TabSheet2: TTabSheet;
|
||||
procedure CbShowFrameChange(Sender: TObject);
|
||||
procedure CbGroupedChange(Sender: TObject);
|
||||
procedure CbUseMaxChange(Sender: TObject);
|
||||
procedure CbUseMinChange(Sender: TObject);
|
||||
procedure DataPointDragTool_AfterMouseMove(ATool: TChartTool;
|
||||
APoint: TPoint);
|
||||
procedure CbLineAtDataOnlyChange(Sender: TObject);
|
||||
procedure CbShowGridChange(Sender: TObject);
|
||||
procedure CbShowArrowChange(Sender: TObject);
|
||||
procedure CbInvertedChange(Sender: TObject);
|
||||
procedure CbBiDiModeChange(Sender: TObject);
|
||||
procedure CbMarksAtDataOnlyChange(Sender: TObject);
|
||||
procedure PageControl1Changing(Sender: TObject; var AllowChange: Boolean);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math, TAChartUtils;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
{ The autoscale transformations are shared between both pages. Before changing
|
||||
to the new page we make sure that the constant lines series which indicate the
|
||||
pane limits are at the correct position. }
|
||||
procedure TForm1.PageControl1Changing(Sender: TObject; var AllowChange: Boolean);
|
||||
begin
|
||||
case PageControl1.ActivePageIndex of
|
||||
0: begin
|
||||
Chart2ConstantLine1.Position := ChartAxisTransformations1AutoScaleAxisTransform1.Maxvalue;
|
||||
Chart2ConstantLine2.Position := ChartAxisTransformations2AutoScaleAxisTransform1.MinValue;
|
||||
Chart2ConstantLine3.Position := ChartAxisTransformations2AutoScaleAxisTransform1.Maxvalue;
|
||||
Chart2ConstantLine4.Position := ChartAxisTransformations3AutoScaleAxisTransform1.Minvalue;
|
||||
end;
|
||||
1: begin
|
||||
Chart1ConstantLine1.Position := ChartAxisTransformations1AutoScaleAxisTransform1.Maxvalue;
|
||||
Chart1ConstantLine2.Position := ChartAxisTransformations2AutoScaleAxisTransform1.MinValue;
|
||||
Chart1ConstantLine3.Position := ChartAxisTransformations2AutoScaleAxisTransform1.Maxvalue;
|
||||
Chart1ConstantLine4.Position := ChartAxisTransformations3AutoScaleAxisTransform1.Minvalue;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbLineAtDataOnlyChange(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=1 to 3 do begin
|
||||
Chart1.AxisList[i].AtDataOnly := CbLineAtDataOnly.Checked;
|
||||
Chart2.AxisList[i].AtDataOnly := CbLineAtDataOnly.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbUseMaxChange(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=1 to 3 do begin
|
||||
Chart1.AxisList[i].Range.UseMax := CbUseMax.Checked;
|
||||
Chart2.AxisList[i].Range.UseMax := CbUseMax.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbGroupedChange(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if CbGrouped.Checked then begin
|
||||
for i:=1 to 3 do begin
|
||||
Chart1.AxisList[i].Group := 1;
|
||||
Chart2.AxisList[i].Group := 1;
|
||||
end;
|
||||
end else begin
|
||||
for i:=1 to 3 do begin
|
||||
Chart1.AxisList[i].Group := 0;
|
||||
Chart2.AxisList[i].Group := 0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbShowFrameChange(Sender: TObject);
|
||||
begin
|
||||
Chart1.Frame.Visible := CbShowFrame.Checked;
|
||||
Chart2.Frame.Visible := CbShowFrame.Checked;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbUseMinChange(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=1 to 3 do begin
|
||||
Chart1.AxisList[i].Range.UseMin := CbUseMin.Checked;
|
||||
Chart2.AxisList[i].Range.UseMin := CbUseMin.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
// This code is used by both ChartToolSets, for Chart1 and Chart2.
|
||||
procedure TForm1.DataPointDragTool_AfterMouseMove(ATool: TChartTool;
|
||||
APoint: TPoint);
|
||||
const
|
||||
MIN_SIZE = 0.5;
|
||||
MIN_DISTANCE = 0.1;
|
||||
var
|
||||
pos, prevPos, nextPos: Double;
|
||||
ser: TConstantLine;
|
||||
ex: TDoubleRect;
|
||||
ls: array[1..4] of TConstantLine;
|
||||
begin
|
||||
ser := TConstantLine(TDataPointDragTool(ATool).Series);
|
||||
if ser = nil then
|
||||
exit;
|
||||
|
||||
pos := ser.Position;
|
||||
ex := ser.ParentChart.GetFullExtent;
|
||||
|
||||
if ser.ParentChart = Chart1 then begin
|
||||
ls[1] := Chart1ConstantLine1;
|
||||
ls[2] := Chart1ConstantLine2;
|
||||
ls[3] := Chart1ConstantLine3;
|
||||
ls[4] := Chart1ConstantLine4;
|
||||
end else begin
|
||||
ls[1] := Chart2ConstantLine1;
|
||||
ls[2] := Chart2ConstantLine2;
|
||||
ls[3] := Chart2ConstantLine3;
|
||||
ls[4] := Chart2ConstantLine4;
|
||||
end;
|
||||
|
||||
if ser = ls[1] then begin
|
||||
prevPos := ex.a.y + MIN_SIZE;
|
||||
nextPos := ls[2].Position - MIN_DISTANCE;
|
||||
ser.Position := EnsureRange(pos, prevPos, nextPos);
|
||||
ChartAxisTransformations1AutoscaleAxisTransform1.MaxValue := ser.Position;
|
||||
end else
|
||||
if ser = ls[2] then begin
|
||||
prevPos := ls[1].Position + MIN_DISTANCE;
|
||||
nextPos := ls[3].Position - MIN_SIZE;
|
||||
ser.Position := EnsureRange(pos, prevPos, nextPos);
|
||||
ChartAxisTransformations2AutoscaleAxisTransform1.MinValue := ser.Position;
|
||||
end else
|
||||
if ser = ls[3] then begin
|
||||
prevPos := ls[2].Position + MIN_SIZE;
|
||||
nextPos := ls[4].Position - MIN_DISTANCE;
|
||||
ser.Position := EnsureRange(pos, prevPos, nextPos);
|
||||
ChartAxisTransformations2AutoscaleAxisTransform1.MaxValue := ser.Position;
|
||||
end else
|
||||
if ser = ls[4] then begin
|
||||
prevPos := ls[3].Position + MIN_DISTANCE;
|
||||
nextPos := ex.b.y - MIN_SIZE;
|
||||
ser.Position := EnsureRange(pos, prevPos, nextPos);
|
||||
ChartAxisTransformations3AutoscaleAxisTransform1.MinValue := ser.Position;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbShowGridChange(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Chart1.AxisList[0].Grid.Visible := CbShowVertGrid.Checked;
|
||||
Chart2.AxisList[0].Grid.Visible := cbShowHorGrid.Checked;
|
||||
for i:=1 to 3 do begin
|
||||
Chart1.AxisList[i].Grid.Visible := CbShowHorGrid.Checked;
|
||||
Chart2.AxisList[i].Grid.Visible := CbShowVertGrid.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbShowArrowChange(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to 3 do begin
|
||||
Chart1.AxisList[i].Arrow.Visible := CbShowArrow.Checked;
|
||||
Chart2.AxisList[i].Arrow.Visible := CbShowArrow.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbInvertedChange(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to 3 do begin
|
||||
Chart1.AxisList[i].Inverted := CbInverted.Checked;
|
||||
Chart2.AxisList[i].Inverted := CbInverted.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbBiDiModeChange(Sender: TObject);
|
||||
begin
|
||||
if CbBiDiMode.Checked then
|
||||
Chart1.BiDiMode := bdRightToLeft
|
||||
else
|
||||
Chart1.BiDiMode := bdLeftToRight;
|
||||
Chart2.BiDiMode := Chart1.BiDiMode;
|
||||
end;
|
||||
|
||||
procedure TForm1.CbMarksAtDataOnlyChange(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to 3 do begin
|
||||
Chart1.AxisList[i].Marks.AtDataOnly := CbMarksAtDataOnly.Checked;
|
||||
Chart2.AxisList[i].Marks.AtDataOnly := CbMarksAtDataOnly.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user