mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 16:19:13 +02:00
TAChart: Add label positioning demo
git-svn-id: trunk@26772 -
This commit is contained in:
parent
d5a2df6249
commit
9d66578778
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -2159,6 +2159,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/funcdemo.lpr svneol=native#text/plain
|
||||||
components/tachart/demo/func/main.lfm 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/func/main.pas svneol=native#text/plain
|
||||||
|
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
|
||||||
|
components/tachart/demo/labels/labelsdemo.lpr svneol=native#text/pascal
|
||||||
components/tachart/demo/legend/legenddemo.lpi svneol=native#text/plain
|
components/tachart/demo/legend/legenddemo.lpi svneol=native#text/plain
|
||||||
components/tachart/demo/legend/legenddemo.lpr svneol=native#text/pascal
|
components/tachart/demo/legend/legenddemo.lpr svneol=native#text/pascal
|
||||||
components/tachart/demo/legend/main.lfm svneol=native#text/plain
|
components/tachart/demo/legend/main.lfm svneol=native#text/plain
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<Version Value="7"/>
|
<Version Value="8"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<LRSInOutputDirectory Value="False"/>
|
<LRSInOutputDirectory Value="False"/>
|
||||||
@ -60,11 +60,16 @@
|
|||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="9"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="$(ProjOutDir)\"/>
|
<IncludeFiles Value="$(ProjOutDir)\"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<UseAnsiStrings Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
<Linking>
|
<Linking>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<GenerateDebugInfo Value="True"/>
|
<GenerateDebugInfo Value="True"/>
|
||||||
|
@ -80,7 +80,7 @@ implementation
|
|||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
TAChartUtils;
|
TAChartUtils, TADrawUtils, TATypes;
|
||||||
|
|
||||||
{ TForm1 }
|
{ TForm1 }
|
||||||
|
|
||||||
@ -270,6 +270,7 @@ begin
|
|||||||
FPie.Title := 'pie';
|
FPie.Title := 'pie';
|
||||||
FPie.Marks.LabelBrush.Color := $80FFFF;
|
FPie.Marks.LabelBrush.Color := $80FFFF;
|
||||||
FPie.Marks.LinkPen.Width := 2;
|
FPie.Marks.LinkPen.Width := 2;
|
||||||
|
FPie.Marks.OverlapPolicy := opHideNeighbour;
|
||||||
Chart1.AddSeries(FPie);
|
Chart1.AddSeries(FPie);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
128
components/tachart/demo/labels/Main.lfm
Normal file
128
components/tachart/demo/labels/Main.lfm
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
object Form1: TForm1
|
||||||
|
Left = 1326
|
||||||
|
Height = 322
|
||||||
|
Top = 177
|
||||||
|
Width = 448
|
||||||
|
Caption = 'Form1'
|
||||||
|
ClientHeight = 322
|
||||||
|
ClientWidth = 448
|
||||||
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '0.9.29'
|
||||||
|
object pcMain: TPageControl
|
||||||
|
Left = 0
|
||||||
|
Height = 284
|
||||||
|
Top = 0
|
||||||
|
Width = 448
|
||||||
|
ActivePage = tsBar
|
||||||
|
Align = alClient
|
||||||
|
TabIndex = 0
|
||||||
|
TabOrder = 0
|
||||||
|
object tsBar: TTabSheet
|
||||||
|
Caption = 'Bar'
|
||||||
|
ClientHeight = 258
|
||||||
|
ClientWidth = 440
|
||||||
|
object Chart1: TChart
|
||||||
|
Left = 0
|
||||||
|
Height = 258
|
||||||
|
Top = 0
|
||||||
|
Width = 440
|
||||||
|
AxisList = <
|
||||||
|
item
|
||||||
|
Alignment = calLeft
|
||||||
|
Marks.LabelBrush.Color = clSkyBlue
|
||||||
|
Marks.LabelBrush.Style = bsSolid
|
||||||
|
Title.Font.Orientation = 900
|
||||||
|
end
|
||||||
|
item
|
||||||
|
Alignment = calBottom
|
||||||
|
Marks.LabelBrush.Color = clSkyBlue
|
||||||
|
Marks.LabelBrush.Style = bsSolid
|
||||||
|
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 Chart1BarSeries1: TBarSeries
|
||||||
|
Marks.Format = '%1:.2f%%'
|
||||||
|
Marks.Style = smsPercent
|
||||||
|
BarBrush.Color = clRed
|
||||||
|
SeriesColor = clRed
|
||||||
|
Source = RandomChartSource1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object pnlControls: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 38
|
||||||
|
Top = 284
|
||||||
|
Width = 448
|
||||||
|
Align = alBottom
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 38
|
||||||
|
ClientWidth = 448
|
||||||
|
TabOrder = 1
|
||||||
|
object seAxisAngle: TSpinEdit
|
||||||
|
Left = 72
|
||||||
|
Height = 21
|
||||||
|
Top = 9
|
||||||
|
Width = 50
|
||||||
|
Increment = 5
|
||||||
|
MaxValue = 360
|
||||||
|
MinValue = -360
|
||||||
|
OnChange = seAxisAngleChange
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object seSeriesAngle: TSpinEdit
|
||||||
|
Left = 216
|
||||||
|
Height = 21
|
||||||
|
Top = 9
|
||||||
|
Width = 50
|
||||||
|
Increment = 5
|
||||||
|
MaxValue = 360
|
||||||
|
MinValue = -360
|
||||||
|
OnChange = seSeriesAngleChange
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object cbHideOverlapping: TCheckBox
|
||||||
|
Left = 300
|
||||||
|
Height = 17
|
||||||
|
Top = 9
|
||||||
|
Width = 130
|
||||||
|
Caption = 'Hide overlapping labels'
|
||||||
|
OnChange = cbHideOverlappingChange
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object lblAxisAngle: TLabel
|
||||||
|
Left = 8
|
||||||
|
Height = 14
|
||||||
|
Top = 12
|
||||||
|
Width = 50
|
||||||
|
Caption = 'Axis angle'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object lblSeriesAngle: TLabel
|
||||||
|
Left = 144
|
||||||
|
Height = 14
|
||||||
|
Top = 12
|
||||||
|
Width = 59
|
||||||
|
Caption = 'Series angle'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object RandomChartSource1: TRandomChartSource
|
||||||
|
PointsNumber = 15
|
||||||
|
RandSeed = 567673250
|
||||||
|
XMax = 15
|
||||||
|
XMin = 0
|
||||||
|
YMax = 15
|
||||||
|
YMin = 10
|
||||||
|
left = 342
|
||||||
|
top = 94
|
||||||
|
end
|
||||||
|
end
|
69
components/tachart/demo/labels/Main.pas
Normal file
69
components/tachart/demo/labels/Main.pas
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
unit Main;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, ComCtrls, ExtCtrls, Spin, StdCtrls, SysUtils, FileUtil, Forms,
|
||||||
|
Controls, Graphics, Dialogs, TAGraph, TASeries, TASources;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
TForm1 = class(TForm)
|
||||||
|
Chart1: TChart;
|
||||||
|
Chart1BarSeries1: TBarSeries;
|
||||||
|
cbHideOverlapping: TCheckBox;
|
||||||
|
lblAxisAngle: TLabel;
|
||||||
|
lblSeriesAngle: TLabel;
|
||||||
|
pcMain: TPageControl;
|
||||||
|
pnlControls: TPanel;
|
||||||
|
RandomChartSource1: TRandomChartSource;
|
||||||
|
seAxisAngle: TSpinEdit;
|
||||||
|
seSeriesAngle: TSpinEdit;
|
||||||
|
tsBar: TTabSheet;
|
||||||
|
procedure cbHideOverlappingChange(Sender: TObject);
|
||||||
|
procedure seAxisAngleChange(Sender: TObject);
|
||||||
|
procedure seSeriesAngleChange(Sender: TObject);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Form1: TForm1;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
TATypes;
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
procedure TForm1.cbHideOverlappingChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
op: TChartMarksOverlapPolicy;
|
||||||
|
begin
|
||||||
|
if cbHideOverlapping.Checked then
|
||||||
|
op := opHideNeighbour
|
||||||
|
else
|
||||||
|
op := opIgnore;
|
||||||
|
Chart1.LeftAxis.Marks.OverlapPolicy := op;
|
||||||
|
Chart1.BottomAxis.Marks.OverlapPolicy := op;
|
||||||
|
Chart1BarSeries1.Marks.OverlapPolicy := op;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.seAxisAngleChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chart1.LeftAxis.Marks.LabelFont.Orientation := seAxisAngle.Value * 10;
|
||||||
|
Chart1.BottomAxis.Marks.LabelFont.Orientation := seAxisAngle.Value * 10;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.seSeriesAngleChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chart1BarSeries1.Marks.LabelFont.Orientation := seSeriesAngle.Value * 10;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
103
components/tachart/demo/labels/labelsdemo.lpi
Normal file
103
components/tachart/demo/labels/labelsdemo.lpi
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Version Value="8"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<UseDefaultCompilerOptions Value="True"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<TargetFileExt Value=".exe"/>
|
||||||
|
<Title Value="Label positioning demo"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
<UseXPManifest Value="True"/>
|
||||||
|
</General>
|
||||||
|
<i18n>
|
||||||
|
<EnableI18N LFM="False"/>
|
||||||
|
</i18n>
|
||||||
|
<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"/>
|
||||||
|
</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="labelsdemo.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="labelsdemo"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="Main.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="Main"/>
|
||||||
|
</Unit1>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="9"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="labelsdemo"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)\"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<CodeGeneration>
|
||||||
|
<Checks>
|
||||||
|
<RangeChecks Value="True"/>
|
||||||
|
<OverflowChecks Value="True"/>
|
||||||
|
</Checks>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Linking>
|
||||||
|
<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>
|
21
components/tachart/demo/labels/labelsdemo.lpr
Normal file
21
components/tachart/demo/labels/labelsdemo.lpr
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
program labelsdemo;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
|
Interfaces, // this includes the LCL widgetset
|
||||||
|
Forms, tachartlazaruspkg, Main
|
||||||
|
{ you can add units after this };
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
begin
|
||||||
|
Application.Title := 'Label positioning demo';
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TForm1, Form1);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user