mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 01:19:16 +02:00
TAChart: Add new property "AngleRange" to TPieSeries to enable a "halfdonut series"
git-svn-id: trunk@62354 -
This commit is contained in:
parent
bdf8608839
commit
410090e60e
@ -401,16 +401,16 @@ object Form1: TForm1
|
|||||||
TabOrder = 12
|
TabOrder = 12
|
||||||
end
|
end
|
||||||
object seViewAngle: TSpinEdit
|
object seViewAngle: TSpinEdit
|
||||||
AnchorSideLeft.Control = lblViewAngle
|
AnchorSideLeft.Control = seAngleRange
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideTop.Control = seDistance
|
AnchorSideTop.Control = seDistance
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = cmbOrientation
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 549
|
Left = 562
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 64
|
Top = 64
|
||||||
Width = 62
|
Width = 62
|
||||||
BorderSpacing.Right = 6
|
Anchors = [akTop, akRight]
|
||||||
Enabled = False
|
Enabled = False
|
||||||
MaxValue = 89
|
MaxValue = 89
|
||||||
OnChange = seViewAngleChange
|
OnChange = seViewAngleChange
|
||||||
@ -418,14 +418,15 @@ object Form1: TForm1
|
|||||||
Value = 60
|
Value = 60
|
||||||
end
|
end
|
||||||
object lblViewAngle: TLabel
|
object lblViewAngle: TLabel
|
||||||
AnchorSideLeft.Control = seDepth
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = seViewAngle
|
AnchorSideTop.Control = seViewAngle
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 484
|
AnchorSideRight.Control = seViewAngle
|
||||||
|
Left = 497
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 68
|
Top = 68
|
||||||
Width = 57
|
Width = 57
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Left = 12
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
Caption = 'View angle'
|
Caption = 'View angle'
|
||||||
@ -433,17 +434,17 @@ object Form1: TForm1
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object cmbOrientation: TComboBox
|
object cmbOrientation: TComboBox
|
||||||
AnchorSideLeft.Control = lblViewAngle
|
AnchorSideLeft.Control = seDepthBrightnessDelta
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = cbMarkAttachment
|
AnchorSideTop.Control = cbMarkAttachment
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = seViewAngle
|
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 484
|
Left = 496
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 93
|
Top = 93
|
||||||
Width = 127
|
Width = 128
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
AutoSize = False
|
AutoSize = False
|
||||||
|
BorderSpacing.Left = 24
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 8
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ItemHeight = 15
|
ItemHeight = 15
|
||||||
@ -458,6 +459,36 @@ object Form1: TForm1
|
|||||||
TabOrder = 14
|
TabOrder = 14
|
||||||
Text = 'normal'
|
Text = 'normal'
|
||||||
end
|
end
|
||||||
|
object lblAngleRange: TLabel
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = seAngleRange
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = seAngleRange
|
||||||
|
Left = 493
|
||||||
|
Height = 15
|
||||||
|
Top = 39
|
||||||
|
Width = 64
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Left = 12
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
Caption = 'Angle range'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object seAngleRange: TSpinEdit
|
||||||
|
AnchorSideTop.Control = seStartAngle
|
||||||
|
AnchorSideRight.Control = cmbOrientation
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 565
|
||||||
|
Height = 23
|
||||||
|
Top = 35
|
||||||
|
Width = 59
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
MaxValue = 360
|
||||||
|
MinValue = 1
|
||||||
|
OnChange = seAngleRangeChange
|
||||||
|
TabOrder = 15
|
||||||
|
Value = 360
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object tsPolar: TTabSheet
|
object tsPolar: TTabSheet
|
||||||
@ -601,7 +632,7 @@ object Form1: TForm1
|
|||||||
'0|7|?|'
|
'0|7|?|'
|
||||||
'0|3|?|'
|
'0|3|?|'
|
||||||
'0|1|?|'
|
'0|1|?|'
|
||||||
'0.20000000000000001|0.20000000000000001|?|'
|
'0.2|0.2|?|'
|
||||||
'0|1|?|'
|
'0|1|?|'
|
||||||
)
|
)
|
||||||
left = 64
|
left = 64
|
||||||
|
@ -33,6 +33,7 @@ type
|
|||||||
lblViewAngle: TLabel;
|
lblViewAngle: TLabel;
|
||||||
lblDistance: TLabel;
|
lblDistance: TLabel;
|
||||||
lblStartAngle: TLabel;
|
lblStartAngle: TLabel;
|
||||||
|
lblAngleRange: TLabel;
|
||||||
seDepth: TSpinEdit;
|
seDepth: TSpinEdit;
|
||||||
seViewAngle: TSpinEdit;
|
seViewAngle: TSpinEdit;
|
||||||
seDepthBrightnessDelta: TSpinEdit;
|
seDepthBrightnessDelta: TSpinEdit;
|
||||||
@ -49,6 +50,7 @@ type
|
|||||||
RandomChartSource1: TRandomChartSource;
|
RandomChartSource1: TRandomChartSource;
|
||||||
sbTransparency: TScrollBar;
|
sbTransparency: TScrollBar;
|
||||||
seStartAngle: TSpinEdit;
|
seStartAngle: TSpinEdit;
|
||||||
|
seAngleRange: TSpinEdit;
|
||||||
seWords: TSpinEdit;
|
seWords: TSpinEdit;
|
||||||
seLabelAngle: TSpinEdit;
|
seLabelAngle: TSpinEdit;
|
||||||
seInnerRadius: TSpinEdit;
|
seInnerRadius: TSpinEdit;
|
||||||
@ -70,6 +72,7 @@ type
|
|||||||
procedure seDepthBrightnessDeltaChange(Sender: TObject);
|
procedure seDepthBrightnessDeltaChange(Sender: TObject);
|
||||||
procedure seDepthChange(Sender: TObject);
|
procedure seDepthChange(Sender: TObject);
|
||||||
procedure seDistanceChange(Sender: TObject);
|
procedure seDistanceChange(Sender: TObject);
|
||||||
|
procedure seAngleRangeChange(Sender: TObject);
|
||||||
procedure seInnerRadiusChange(Sender: TObject);
|
procedure seInnerRadiusChange(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure sbTransparencyChange(Sender: TObject);
|
procedure sbTransparencyChange(Sender: TObject);
|
||||||
@ -182,6 +185,11 @@ begin
|
|||||||
ChartPiePieSeries1.Marks.Distance := seDistance.Value;
|
ChartPiePieSeries1.Marks.Distance := seDistance.Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.seAngleRangeChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ChartPiePieSeries1.AngleRange := seAngleRange.Value;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.seInnerRadiusChange(Sender: TObject);
|
procedure TForm1.seInnerRadiusChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ChartPiePieSeries1.InnerRadiusPercent := seInnerRadius.Value;
|
ChartPiePieSeries1.InnerRadiusPercent := seInnerRadius.Value;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions BuildModesCount="1">
|
<ProjectOptions>
|
||||||
<Version Value="12"/>
|
<Version Value="12"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
@ -12,46 +12,46 @@
|
|||||||
<EnableI18N LFM="False"/>
|
<EnableI18N LFM="False"/>
|
||||||
</i18n>
|
</i18n>
|
||||||
<BuildModes>
|
<BuildModes>
|
||||||
<Item1 Name="default" Default="True"/>
|
<Item Name="default" Default="True"/>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<FormatVersion Value="2"/>
|
<FormatVersion Value="2"/>
|
||||||
<Modes Count="1">
|
<Modes>
|
||||||
<Mode0 Name="default"/>
|
<Mode Name="default"/>
|
||||||
</Modes>
|
</Modes>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="4">
|
<RequiredPackages>
|
||||||
<Item1>
|
<Item>
|
||||||
<PackageName Value="LCLBase"/>
|
<PackageName Value="LCLBase"/>
|
||||||
<MinVersion Major="1" Release="1" Valid="True"/>
|
<MinVersion Major="1" Release="1" Valid="True"/>
|
||||||
</Item1>
|
</Item>
|
||||||
<Item2>
|
<Item>
|
||||||
<PackageName Value="TAChartLazarusPkg"/>
|
<PackageName Value="TAChartLazarusPkg"/>
|
||||||
<MinVersion Major="1" Valid="True"/>
|
<MinVersion Major="1" Valid="True"/>
|
||||||
</Item2>
|
</Item>
|
||||||
<Item3>
|
<Item>
|
||||||
<PackageName Value="LazControls"/>
|
<PackageName Value="LazControls"/>
|
||||||
<MinVersion Valid="True"/>
|
<MinVersion Valid="True"/>
|
||||||
</Item3>
|
</Item>
|
||||||
<Item4>
|
<Item>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item4>
|
</Item>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="2">
|
<Units>
|
||||||
<Unit0>
|
<Unit>
|
||||||
<Filename Value="radialdemo.lpr"/>
|
<Filename Value="radialdemo.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit0>
|
</Unit>
|
||||||
<Unit1>
|
<Unit>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="Form1"/>
|
<ComponentName Value="Form1"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
</Unit1>
|
</Unit>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
@ -73,16 +73,16 @@
|
|||||||
</Linking>
|
</Linking>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions Count="3">
|
<Exceptions>
|
||||||
<Item1>
|
<Item>
|
||||||
<Name Value="EAbort"/>
|
<Name Value="EAbort"/>
|
||||||
</Item1>
|
</Item>
|
||||||
<Item2>
|
<Item>
|
||||||
<Name Value="ECodetoolError"/>
|
<Name Value="ECodetoolError"/>
|
||||||
</Item2>
|
</Item>
|
||||||
<Item3>
|
<Item>
|
||||||
<Name Value="EFOpenError"/>
|
<Name Value="EFOpenError"/>
|
||||||
</Item3>
|
</Item>
|
||||||
</Exceptions>
|
</Exceptions>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
@ -81,6 +81,7 @@ type
|
|||||||
FInnerRadiusPercent: Integer;
|
FInnerRadiusPercent: Integer;
|
||||||
FSlices: array of TPieSlice;
|
FSlices: array of TPieSlice;
|
||||||
FStartAngle: Integer;
|
FStartAngle: Integer;
|
||||||
|
FAngleRange: Integer;
|
||||||
FEdgePen: TPen;
|
FEdgePen: TPen;
|
||||||
FExploded: Boolean;
|
FExploded: Boolean;
|
||||||
FFixedRadius: TChartDistance;
|
FFixedRadius: TChartDistance;
|
||||||
@ -89,6 +90,7 @@ type
|
|||||||
function FixAspectRatio(P: TPoint): TPoint;
|
function FixAspectRatio(P: TPoint): TPoint;
|
||||||
function GetViewAngle: Integer;
|
function GetViewAngle: Integer;
|
||||||
procedure Measure(ADrawer: IChartDrawer);
|
procedure Measure(ADrawer: IChartDrawer);
|
||||||
|
procedure SetAngleRange(AValue: Integer);
|
||||||
procedure SetEdgePen(AValue: TPen);
|
procedure SetEdgePen(AValue: TPen);
|
||||||
procedure SetExploded(AValue: Boolean);
|
procedure SetExploded(AValue: Boolean);
|
||||||
procedure SetFixedRadius(AValue: TChartDistance);
|
procedure SetFixedRadius(AValue: TChartDistance);
|
||||||
@ -115,6 +117,8 @@ type
|
|||||||
property Radius: Integer read FRadius;
|
property Radius: Integer read FRadius;
|
||||||
property StartAngle: Integer
|
property StartAngle: Integer
|
||||||
read FStartAngle write SetStartAngle default 0;
|
read FStartAngle write SetStartAngle default 0;
|
||||||
|
property AngleRange: Integer
|
||||||
|
read FAngleRange write SetAngleRange default 360;
|
||||||
property ViewAngle: Integer
|
property ViewAngle: Integer
|
||||||
read GetViewAngle write SetViewAngle default 60;
|
read GetViewAngle write SetViewAngle default 60;
|
||||||
property OnCustomDrawPie: TCustomDrawPieEvent
|
property OnCustomDrawPie: TCustomDrawPieEvent
|
||||||
@ -333,6 +337,7 @@ constructor TCustomPieSeries.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
ViewAngle := 60;
|
ViewAngle := 60;
|
||||||
|
FAngleRange := 360;
|
||||||
FEdgePen := TPen.Create;
|
FEdgePen := TPen.Create;
|
||||||
FEdgePen.OnChange := @StyleChanged;
|
FEdgePen.OnChange := @StyleChanged;
|
||||||
|
|
||||||
@ -824,6 +829,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomPieSeries.SetAngleRange(AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FAngleRange = AValue then exit;
|
||||||
|
if AValue = 0 then
|
||||||
|
FAngleRange := 360
|
||||||
|
else
|
||||||
|
FAngleRange := EnsureRange(AValue, 1, 360);
|
||||||
|
UpdateParentChart;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomPieSeries.SetEdgePen(AValue: TPen);
|
procedure TCustomPieSeries.SetEdgePen(AValue: TPen);
|
||||||
begin
|
begin
|
||||||
if FEdgePen = AValue then exit;
|
if FEdgePen = AValue then exit;
|
||||||
@ -1144,6 +1159,7 @@ begin
|
|||||||
total := Source.ValuesTotal;
|
total := Source.ValuesTotal;
|
||||||
if total = 0 then
|
if total = 0 then
|
||||||
exit;
|
exit;
|
||||||
|
total := total * 360 / FAngleRange;
|
||||||
prevAngle := start_angle;
|
prevAngle := start_angle;
|
||||||
for i := 0 to Count - 1 do begin
|
for i := 0 to Count - 1 do begin
|
||||||
di := Source[i];
|
di := Source[i];
|
||||||
|
@ -145,6 +145,7 @@ type
|
|||||||
public
|
public
|
||||||
property Radius;
|
property Radius;
|
||||||
published
|
published
|
||||||
|
property AngleRange;
|
||||||
property EdgePen;
|
property EdgePen;
|
||||||
property Depth;
|
property Depth;
|
||||||
property DepthBrightnessDelta;
|
property DepthBrightnessDelta;
|
||||||
|
Loading…
Reference in New Issue
Block a user