mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 05:38:25 +02:00
TAChart: Add imagelist demo based on code by Werner Pamler
git-svn-id: trunk@34850 -
This commit is contained in:
parent
54c94a710b
commit
88e42b0f52
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -2534,6 +2534,10 @@ 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
|
||||
components/tachart/demo/func/main.pas svneol=native#text/plain
|
||||
components/tachart/demo/imagelist/Main.lfm svneol=native#text/plain
|
||||
components/tachart/demo/imagelist/Main.pas svneol=native#text/pascal
|
||||
components/tachart/demo/imagelist/imagelistdemo.lpi svneol=native#text/plain
|
||||
components/tachart/demo/imagelist/imagelistdemo.lpr svneol=native#text/pascal
|
||||
components/tachart/demo/labels/Main.lfm svneol=native#text/plain
|
||||
components/tachart/demo/labels/Main.pas svneol=native#text/pascal
|
||||
components/tachart/demo/labels/labelsdemo.lpi svneol=native#text/plain
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -176,6 +176,10 @@ components/tachart/demo/fpvectorial/lib
|
||||
components/tachart/demo/func/*.exe
|
||||
components/tachart/demo/func/*.lps
|
||||
components/tachart/demo/func/lib
|
||||
components/tachart/demo/imagelist/*.exe
|
||||
components/tachart/demo/imagelist/*.lps
|
||||
components/tachart/demo/imagelist/*.res
|
||||
components/tachart/demo/imagelist/lib
|
||||
components/tachart/demo/labels/*.exe
|
||||
components/tachart/demo/labels/*.lps
|
||||
components/tachart/demo/labels/lib
|
||||
|
197
components/tachart/demo/imagelist/Main.lfm
Normal file
197
components/tachart/demo/imagelist/Main.lfm
Normal file
@ -0,0 +1,197 @@
|
||||
object frmMain: TfrmMain
|
||||
Left = 261
|
||||
Height = 434
|
||||
Top = 153
|
||||
Width = 484
|
||||
Caption = 'frmMain'
|
||||
ClientHeight = 434
|
||||
ClientWidth = 484
|
||||
LCLVersion = '0.9.31'
|
||||
object Chart1: TChart
|
||||
Left = 0
|
||||
Height = 226
|
||||
Top = 38
|
||||
Width = 484
|
||||
AxisList = <
|
||||
item
|
||||
Minors = <>
|
||||
Title.LabelFont.Orientation = 900
|
||||
end
|
||||
item
|
||||
Alignment = calBottom
|
||||
Minors = <>
|
||||
end>
|
||||
BackColor = clWhite
|
||||
Extent.UseXMax = True
|
||||
Extent.UseXMin = True
|
||||
Extent.UseYMax = True
|
||||
Extent.UseYMin = True
|
||||
Extent.XMax = 5
|
||||
Extent.XMin = -5
|
||||
Extent.YMax = 1
|
||||
Extent.YMin = -1
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Font.Color = clBlue
|
||||
Title.Text.Strings = (
|
||||
'TAChart'
|
||||
)
|
||||
Align = alClient
|
||||
ParentColor = False
|
||||
object Chart1FuncSeries1: TFuncSeries
|
||||
Extent.UseXMax = True
|
||||
Extent.UseXMin = True
|
||||
Extent.XMax = 5
|
||||
Extent.XMin = -5
|
||||
OnCalculate = Chart1FuncSeries1Calculate
|
||||
Pen.Color = clPurple
|
||||
end
|
||||
object Chart1FuncSeries2: TFuncSeries
|
||||
OnCalculate = Chart1FuncSeries2Calculate
|
||||
Pen.Color = clLime
|
||||
end
|
||||
end
|
||||
object ListView1: TListView
|
||||
Left = 0
|
||||
Height = 150
|
||||
Top = 264
|
||||
Width = 484
|
||||
Align = alBottom
|
||||
Color = clBtnFace
|
||||
Columns = <>
|
||||
Items.LazData = {
|
||||
8C0000000400000000000000FFFFFFFFFFFFFFFF000000000D00000064657369
|
||||
676E206974656D203001000000FFFFFFFFFFFFFFFF000000000D000000646573
|
||||
69676E206974656D203102000000FFFFFFFFFFFFFFFF000000000D0000006465
|
||||
7369676E206974656D203203000000FFFFFFFFFFFFFFFF000000000D00000064
|
||||
657369676E206974656D2033
|
||||
}
|
||||
SmallImages = ChartImageList1
|
||||
TabOrder = 1
|
||||
end
|
||||
object ToolBar1: TToolBar
|
||||
Left = 0
|
||||
Height = 38
|
||||
Top = 0
|
||||
Width = 484
|
||||
AutoSize = True
|
||||
ButtonHeight = 36
|
||||
Caption = 'ToolBar1'
|
||||
EdgeBorders = [ebBottom]
|
||||
Images = ChartImageList1
|
||||
ShowCaptions = True
|
||||
TabOrder = 2
|
||||
object tbAdd: TToolButton
|
||||
Left = 1
|
||||
Top = 0
|
||||
Caption = 'Add'
|
||||
ImageIndex = 1
|
||||
OnClick = tbAddClick
|
||||
end
|
||||
object tbQuit: TToolButton
|
||||
Left = 38
|
||||
Top = 0
|
||||
Caption = 'Quit'
|
||||
ImageIndex = 0
|
||||
OnClick = tbQuitClick
|
||||
end
|
||||
object tbSep1: TToolButton
|
||||
Left = 28
|
||||
Top = 0
|
||||
Width = 10
|
||||
Caption = 'tbSep1'
|
||||
Style = tbsSeparator
|
||||
end
|
||||
end
|
||||
object StatusBar1: TStatusBar
|
||||
Left = 0
|
||||
Height = 20
|
||||
Top = 414
|
||||
Width = 484
|
||||
Panels = <>
|
||||
end
|
||||
object RandomChartSource1: TRandomChartSource
|
||||
PointsNumber = 10
|
||||
RandSeed = 1965225964
|
||||
XMax = 5
|
||||
XMin = -5
|
||||
YMax = 1
|
||||
YMin = -1
|
||||
left = 191
|
||||
top = 159
|
||||
end
|
||||
object ChartImageList1: TChartImageList
|
||||
Chart = Chart1
|
||||
OnPopulate = ChartImageList1Populate
|
||||
left = 192
|
||||
top = 97
|
||||
Bitmap = {
|
||||
4C69020000001000000010000000003F9300003F9300003F9300003F9424003F
|
||||
948A003E93CC004095CC004095CC004095CC004095CC004095CC004095CC0040
|
||||
95CC004095CC00409599FFFFFF00003F9300003F9324003F938A0E4B9CD33F76
|
||||
C0EC5D90D4FF3365A9FFA0A0A0FFA9A9A9FFA9A9A9FFAAAAAAFFACACACFFAEAE
|
||||
AEFFB0B0B0FF003E93CCFFFFFF00003F938A0E4A9CD33E75BFEC5487CBFF3669
|
||||
ADFF23569AFF3363A6FFA9A9A9FFBCBCBCFFBDBDBDFFBFBFBFFFC1C1C1FFC4C4
|
||||
C4FFC7C7C7FF003C90CCFFFFFF00003D91CC5D90D4FF3568ACFF285B9FFF1A4D
|
||||
91FF4477BBFF3361A4FFA9A9A9FFBDBDBDFFBFBFBFFFC1C1C1FFC4C4C4FFC7C7
|
||||
C7FFC9C9C9FF003A8DCCFFFFFF00003B8ECC588BCFFF1A4D91FF4376BAFF3265
|
||||
A9FF4376BAFF335FA1FFAAAAAAFFBFBFBFFFC1C1C1FFC4C4C4FFC7C7C7FFC9C9
|
||||
C9FFCCCCCCFF003789CCFFFFFF0000398BCC5588CCFF275A9EFF4174B8FF3164
|
||||
A8FF4174B8FF335D9EFFACACACFFC1C1C1FFC4C4C4FFC7C7C7FFC9C9C9FFCCCC
|
||||
CCFFD0D0D0FF003485CCFFFFFF00003688CC5386CAFF295CA0FF3F72B6FF3063
|
||||
A7FF3F72B6FF335A9AFFAEAEAEFFC4C4C4FFC7C7C7FFC9C9C9FFCCCCCCFFD0D0
|
||||
D0FFD3D3D3FF003181CCFFFFFF00003485CC5083C7FF1D5094FF3265A9FF2D60
|
||||
A4FF3D70B4FF335897FFB0B0B0FFC7C7C7FFC9C9C9FFCCCCCCFFD0D0D0FFD3D3
|
||||
D3FFD5D5D5FF002E7DCCFFFFFF00003181CC4C7FC3FFBBBBBBFF22518CFF2C5F
|
||||
A3FF3B6EB2FF335593FFB3B3B3FFC9C9C9FFCCCCCCFFD0D0D0FFD3D3D3FFD5D5
|
||||
D5FFD8D8D8FF002B78CCFFFFFF00002E7DCC497CC0FF09336FFF215090FF2B5E
|
||||
A2FF396CB0FF335290FFB5B5B5FFCCCCCCFFD0D0D0FFD3D3D3FFD5D5D5FFD8D8
|
||||
D8FFDBDBDBFF002774CCFFFFFF00002B79CC477ABEFF2C5FA3FF376AAEFF2B5E
|
||||
A2FF376AAEFF33508CFFB8B8B8FFD0D0D0FFD3D3D3FFD5D5D5FFD8D8D8FFDBDB
|
||||
DBFFDCDCDCFF00246FCCFFFFFF00002875CC4477BBFF2C5FA3FF3568ACFF2B5E
|
||||
A2FF2E61A5FF334B87FFBBBBBBFFD3D3D3FFD5D5D5FFD8D8D8FFDBDBDBFFDCDC
|
||||
DCFFDDDDDDFF001F68CCFFFFFF00002571CC4174B8FF2C5FA3FF2D60A4FF2356
|
||||
9AFF3D70B4FF334179FFBEBEBEFFD5D5D5FFD8D8D8FFDBDBDBFFDCDCDCFFDDDD
|
||||
DDFFDDDDDDFF001258CCFFFFFF0000226DCC3F72B6FF225599FF3B6EB2FF2C51
|
||||
96EC0A1C60D3000749A4000648CC000648CC000648CC000648CC000648CC0006
|
||||
48CC000648CC00074A99FFFFFF00001B64CC4174B8FF2A5094EC0A1A5ED30008
|
||||
4A8A000648240006470000044500000445000004450000044500000445000004
|
||||
45000004450000064800FFFFFF0000105500000B4FCC0007498A000546240005
|
||||
4700000648000006470000044500000445000004450000044500000445000004
|
||||
45000004450000064800FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0013A2000014A5000014A8000015A9
|
||||
001A15AA006C15AA00A615AA00C415AA00C415AA00A615AA006C15A9001A14A8
|
||||
000014A5000013A20000FFFFFF00FFFFFF0013A2000014A5000014A8004D1BAD
|
||||
08BF42C82FE35FDC4EF56BE35AFD6BE359FD5FDB4EF541C72EE31BAD07BF14A8
|
||||
004D14A5000013A20000FFFFFF00FFFFFF0013A2000014A5004D21AF0ECD5FDA
|
||||
4EF663DA52FF5FD64EFF50C73FFF50C73FFF5FD64EFF62D951FF5DD94BF620AE
|
||||
0DCD14A5004D13A20000FFFFFF00FFFFFF0013A1001A1AA707BF5CD74BF658CF
|
||||
47FF57CE46FF4AC139FFFFFFFF00FFFFFF004AC139FF57CE46FF58CF47FF57D2
|
||||
45F619A606BF13A1001AFFFFFF00FFFFFF00129E006C3DBF2CE354CB43FF4EC5
|
||||
3DFF4EC53DFF44BB33FFFFFFFF00FFFFFF0044BB33FF4EC53DFF4EC53DFF52C9
|
||||
41FF36B925E3129E006CFFFFFF00FFFFFF00119A00A751CB40F547BE36FF3EB5
|
||||
2DFF3EB52DFF37AE26FFEBEBEBFFE2E2E2FF259D14FF239B12FF239B12FF279F
|
||||
16FF34B023F5119A00A7FFFFFF00FFFFFF00109600C453CB42FD3CB32BFFF8F8
|
||||
F8FFE1E1E1FFD5D5D5FFD7D7D7FFDCDCDCFFE0E0E0FFE4E4E4FFE8E8E8FF22A0
|
||||
11FF2CAA1BFD109600C4FFFFFF00FFFFFF000F9200C450C83FFD33AF22FFD4D4
|
||||
D4FFD3D3D3FFD7D7D7FFDCDCDCFFE0E0E0FFE4E4E4FFE8E8E8FFECECECFF22A6
|
||||
11FF28AE17FD0F9200C4FFFFFF00FFFFFF000E8D00A73BBD2BF523B412FF22A8
|
||||
11FF22A811FF22A411FFE0E0E0FFE4E4E4FF22A411FF22A811FF22A811FF22B4
|
||||
11FF21AF11F50E8D00A7FFFFFF00FFFFFF000D89006C22A813E326C015FF22BE
|
||||
11FF22BE11FF22B511FFE4E4E4FFE8E8E8FF22B511FF22BE11FF22BE11FF22BE
|
||||
11FF17A109E30D89006CFFFFFF00FFFFFF000C85001A0F8A03BF27C017F623C8
|
||||
12FF22C811FF22BC11FFE8E8E8FFECECECFF22BC11FF22C811FF22C811FF1FBC
|
||||
0FF60D8902BF0C85001AFFFFFF00FFFFFF000B8300000B7F004D0E8804CD21C4
|
||||
11F623D112FF22D111FF22B611FF22B611FF22D111FF22D111FF1EC20FF60D88
|
||||
03CD0B7F004D0B830000FFFFFF00FFFFFF000B8300000A7D0000076F004D0874
|
||||
02BF139D08E31DC40EF521D411FD21D411FD1DC40EF5139D08E3087402BF076F
|
||||
004D0A7D00000B830000FFFFFF00FFFFFF000B8300000A7D0000066D00000360
|
||||
001A025D006C025D00A6025D00C4025D00C4025D00A6025D006C0360001A066D
|
||||
00000A7D00000B830000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00
|
||||
}
|
||||
end
|
||||
end
|
92
components/tachart/demo/imagelist/Main.pas
Normal file
92
components/tachart/demo/imagelist/Main.pas
Normal file
@ -0,0 +1,92 @@
|
||||
unit Main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, TAGraph, TAChartImageList, TASources,
|
||||
TAFuncSeries, Forms, Controls, Graphics, Dialogs, ComCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TfrmMain }
|
||||
|
||||
TfrmMain = class(TForm)
|
||||
Chart1: TChart;
|
||||
Chart1FuncSeries1: TFuncSeries;
|
||||
Chart1FuncSeries2: TFuncSeries;
|
||||
ChartImageList1: TChartImageList;
|
||||
ListView1: TListView;
|
||||
RandomChartSource1: TRandomChartSource;
|
||||
StatusBar1: TStatusBar;
|
||||
ToolBar1: TToolBar;
|
||||
tbAdd: TToolButton;
|
||||
tbQuit: TToolButton;
|
||||
tbSep1: TToolButton;
|
||||
procedure Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
|
||||
procedure Chart1FuncSeries2Calculate(const AX: Double; out AY: Double);
|
||||
procedure ChartImageList1Populate(Sender: TObject);
|
||||
procedure tbAddClick(Sender: TObject);
|
||||
procedure tbQuitClick(Sender: TObject);
|
||||
end;
|
||||
|
||||
var
|
||||
frmMain: TfrmMain;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
LCLIntf, TATypes, TASeries;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TfrmMain }
|
||||
|
||||
procedure TfrmMain.Chart1FuncSeries1Calculate(const AX: Double; out AY: Double);
|
||||
begin
|
||||
AY := Sin(AX);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.Chart1FuncSeries2Calculate(const AX: Double; out AY: Double);
|
||||
begin
|
||||
AY := Cos(AX);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.ChartImageList1Populate(Sender: TObject);
|
||||
begin
|
||||
with ChartImageList1 do
|
||||
StatusBar1.SimpleText := Format(
|
||||
'Now %d images in image list. ' +
|
||||
'Among them %d series images starting at index %d',
|
||||
[Count, SeriesCount, FirstSeriesIndex]);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.tbAddClick(Sender: TObject);
|
||||
var
|
||||
series: TLineSeries;
|
||||
sty: Integer;
|
||||
begin
|
||||
RandomChartSource1.RandSeed := Random(MaxInt);
|
||||
series := TLineSeries.Create(Self);
|
||||
series.SeriesColor := RGB(Random(256), Random(256), Random(256));
|
||||
series.Pointer.Brush.Color := series.SeriesColor;
|
||||
sty := Random(Ord(High(TSeriesPointerStyle)) + 5);
|
||||
series.ShowPoints := sty <= Ord(High(TSeriesPointerStyle));
|
||||
if series.ShowPoints then
|
||||
series.Pointer.Style := TSeriesPointerStyle(sty);
|
||||
series.ListSource.CopyFrom(RandomChartSource1);
|
||||
Chart1.AddSeries(series);
|
||||
with Listview1.Items.Add do begin
|
||||
Caption := Format('run item %d', [ListView1.Items.Count]);
|
||||
ImageIndex := ChartImageList1.Count - 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.tbQuitClick(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
96
components/tachart/demo/imagelist/imagelistdemo.lpi
Normal file
96
components/tachart/demo/imagelist/imagelistdemo.lpi
Normal file
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="Chart image list demo"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</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="imagelistdemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="imagelistdemo"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="Main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Main"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="imagelistdemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<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>
|
22
components/tachart/demo/imagelist/imagelistdemo.lpr
Normal file
22
components/tachart/demo/imagelist/imagelistdemo.lpr
Normal file
@ -0,0 +1,22 @@
|
||||
program imagelistdemo;
|
||||
|
||||
{$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.Title := 'Chart image list demo';
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user