mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 23:41:58 +02:00
TAChart: Add NaN demo
git-svn-id: trunk@32323 -
This commit is contained in:
parent
7029ccca10
commit
6f963be4f2
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -2431,6 +2431,10 @@ components/tachart/demo/multi/Main.lfm svneol=native#text/plain
|
|||||||
components/tachart/demo/multi/Main.pas svneol=native#text/pascal
|
components/tachart/demo/multi/Main.pas svneol=native#text/pascal
|
||||||
components/tachart/demo/multi/multidemo.lpi svneol=native#text/plain
|
components/tachart/demo/multi/multidemo.lpi svneol=native#text/plain
|
||||||
components/tachart/demo/multi/multidemo.lpr svneol=native#text/pascal
|
components/tachart/demo/multi/multidemo.lpr svneol=native#text/pascal
|
||||||
|
components/tachart/demo/nan/Main.lfm svneol=native#text/plain
|
||||||
|
components/tachart/demo/nan/Main.pas svneol=native#text/pascal
|
||||||
|
components/tachart/demo/nan/nandemo.lpi svneol=native#text/plain
|
||||||
|
components/tachart/demo/nan/nandemo.lpr svneol=native#text/pascal
|
||||||
components/tachart/demo/navigate/Main.lfm svneol=native#text/plain
|
components/tachart/demo/navigate/Main.lfm svneol=native#text/plain
|
||||||
components/tachart/demo/navigate/Main.pas svneol=native#text/pascal
|
components/tachart/demo/navigate/Main.pas svneol=native#text/pascal
|
||||||
components/tachart/demo/navigate/navigatedemo.lpi svneol=native#text/plain
|
components/tachart/demo/navigate/navigatedemo.lpi svneol=native#text/plain
|
||||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -187,6 +187,11 @@ components/tachart/demo/listbox/lib
|
|||||||
components/tachart/demo/multi/*.exe
|
components/tachart/demo/multi/*.exe
|
||||||
components/tachart/demo/multi/*.lps
|
components/tachart/demo/multi/*.lps
|
||||||
components/tachart/demo/multi/lib
|
components/tachart/demo/multi/lib
|
||||||
|
components/tachart/demo/nan/*.dbg
|
||||||
|
components/tachart/demo/nan/*.exe
|
||||||
|
components/tachart/demo/nan/*.lps
|
||||||
|
components/tachart/demo/nan/*.res
|
||||||
|
components/tachart/demo/nan/lib
|
||||||
components/tachart/demo/navigate/*.exe
|
components/tachart/demo/navigate/*.exe
|
||||||
components/tachart/demo/navigate/*.lps
|
components/tachart/demo/navigate/*.lps
|
||||||
components/tachart/demo/navigate/lib
|
components/tachart/demo/navigate/lib
|
||||||
|
132
components/tachart/demo/nan/Main.lfm
Normal file
132
components/tachart/demo/nan/Main.lfm
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
object Form1: TForm1
|
||||||
|
Left = 342
|
||||||
|
Height = 474
|
||||||
|
Top = 161
|
||||||
|
Width = 646
|
||||||
|
Caption = 'Form1'
|
||||||
|
ClientHeight = 474
|
||||||
|
ClientWidth = 646
|
||||||
|
OnCreate = FormCreate
|
||||||
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '0.9.31'
|
||||||
|
object Chart1: TChart
|
||||||
|
Left = 0
|
||||||
|
Height = 424
|
||||||
|
Top = 0
|
||||||
|
Width = 586
|
||||||
|
AxisList = <
|
||||||
|
item
|
||||||
|
Minors = <>
|
||||||
|
Title.LabelFont.Orientation = 900
|
||||||
|
end
|
||||||
|
item
|
||||||
|
Alignment = calBottom
|
||||||
|
Minors = <>
|
||||||
|
end>
|
||||||
|
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 Chart1LineSeries1: TLineSeries
|
||||||
|
ShowPoints = True
|
||||||
|
Source = lcs1
|
||||||
|
end
|
||||||
|
object Chart1BarSeries1: TBarSeries
|
||||||
|
Active = False
|
||||||
|
BarBrush.Color = clRed
|
||||||
|
Source = lcs1
|
||||||
|
end
|
||||||
|
object Chart1PieSeries1: TPieSeries
|
||||||
|
Active = False
|
||||||
|
Source = lcs1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Panel2: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 50
|
||||||
|
Top = 424
|
||||||
|
Width = 646
|
||||||
|
Align = alBottom
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 50
|
||||||
|
ClientWidth = 646
|
||||||
|
TabOrder = 1
|
||||||
|
object rgSeriesType: TRadioGroup
|
||||||
|
Left = 0
|
||||||
|
Height = 50
|
||||||
|
Top = 0
|
||||||
|
Width = 530
|
||||||
|
Align = alClient
|
||||||
|
AutoFill = True
|
||||||
|
Caption = ' Series type '
|
||||||
|
ChildSizing.LeftRightSpacing = 6
|
||||||
|
ChildSizing.TopBottomSpacing = 6
|
||||||
|
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||||
|
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||||
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
|
ChildSizing.ControlsPerLine = 10
|
||||||
|
ClientHeight = 32
|
||||||
|
ClientWidth = 526
|
||||||
|
Columns = 10
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
'Line'
|
||||||
|
'Bar'
|
||||||
|
'Pie'
|
||||||
|
)
|
||||||
|
OnClick = rgSeriesTypeClick
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object rgXY: TRadioGroup
|
||||||
|
Left = 530
|
||||||
|
Height = 50
|
||||||
|
Top = 0
|
||||||
|
Width = 116
|
||||||
|
Align = alRight
|
||||||
|
AutoFill = True
|
||||||
|
ChildSizing.LeftRightSpacing = 6
|
||||||
|
ChildSizing.TopBottomSpacing = 6
|
||||||
|
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||||
|
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||||
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
|
ChildSizing.ControlsPerLine = 2
|
||||||
|
ClientHeight = 32
|
||||||
|
ClientWidth = 112
|
||||||
|
Columns = 2
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
'X'
|
||||||
|
'Y'
|
||||||
|
)
|
||||||
|
OnClick = rgXYClick
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object clbNans: TCheckListBox
|
||||||
|
Left = 586
|
||||||
|
Height = 424
|
||||||
|
Top = 0
|
||||||
|
Width = 60
|
||||||
|
Align = alRight
|
||||||
|
ItemHeight = 0
|
||||||
|
OnItemClick = clbNansItemClick
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object lcs1: TListChartSource
|
||||||
|
left = 524
|
||||||
|
top = 300
|
||||||
|
end
|
||||||
|
object lcs2: TListChartSource
|
||||||
|
left = 524
|
||||||
|
top = 352
|
||||||
|
end
|
||||||
|
end
|
79
components/tachart/demo/nan/Main.pas
Normal file
79
components/tachart/demo/nan/Main.pas
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
unit Main;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
CheckLst, Classes, ExtCtrls, SysUtils, FileUtil, Forms, Controls, Graphics,
|
||||||
|
Dialogs, TAGraph, TASeries, TASources;
|
||||||
|
|
||||||
|
type
|
||||||
|
TForm1 = class(TForm)
|
||||||
|
Chart1: TChart;
|
||||||
|
Chart1BarSeries1: TBarSeries;
|
||||||
|
Chart1LineSeries1: TLineSeries;
|
||||||
|
Chart1PieSeries1: TPieSeries;
|
||||||
|
clbNans: TCheckListBox;
|
||||||
|
lcs1: TListChartSource;
|
||||||
|
lcs2: TListChartSource;
|
||||||
|
Panel2: TPanel;
|
||||||
|
rgXY: TRadioGroup;
|
||||||
|
rgSeriesType: TRadioGroup;
|
||||||
|
procedure clbNansItemClick(Sender: TObject; Index: integer);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure rgSeriesTypeClick(Sender: TObject);
|
||||||
|
procedure rgXYClick(Sender: TObject);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Form1: TForm1;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
Math, TAChartUtils;
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
procedure TForm1.clbNansItemClick(Sender: TObject; Index: integer);
|
||||||
|
begin
|
||||||
|
if rgXY.ItemIndex = 0 then
|
||||||
|
lcs1.SetXValue(Index, IfThen(clbNans.Checked[Index], Nan, lcs2[Index]^.X))
|
||||||
|
else
|
||||||
|
lcs1.SetYValue(Index, IfThen(clbNans.Checked[Index], Nan, lcs2[Index]^.Y));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Randomize;
|
||||||
|
for i := 1 to 20 do begin
|
||||||
|
lcs1.Add(i, Random(100) / 50);
|
||||||
|
clbNans.Items.Add(IntToStr(i));
|
||||||
|
end;
|
||||||
|
lcs2.CopyForm(lcs1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.rgSeriesTypeClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
s: TBasicChartSeries;
|
||||||
|
begin
|
||||||
|
for s in Chart1.Series do
|
||||||
|
s.Active := s.Index = rgSeriesType.ItemIndex;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.rgXYClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
lcs1.CopyForm(lcs2);
|
||||||
|
for i := 0 to lcs1.Count - 1 do
|
||||||
|
clbNansItemClick(nil, i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
95
components/tachart/demo/nan/nandemo.lpi
Normal file
95
components/tachart/demo/nan/nandemo.lpi
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="9"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<Title Value="TAChart NaN 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="nandemo.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="nandemo"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="Main.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="Main"/>
|
||||||
|
</Unit1>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="10"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="nandemo"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<UseExternalDbgSyms Value="True"/>
|
||||||
|
</Debugging>
|
||||||
|
<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/nan/nandemo.lpr
Normal file
22
components/tachart/demo/nan/nandemo.lpr
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
program nandemo;
|
||||||
|
|
||||||
|
{$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 := 'TAChart NaN demo';
|
||||||
|
RequireDerivedFormResource := True;
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TForm1, Form1);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user