TAChart: Update "labels" demo to show label shapes

git-svn-id: trunk@38580 -
This commit is contained in:
ask 2012-09-08 11:31:58 +00:00
parent c7d446ef38
commit 282b5f7f99
2 changed files with 57 additions and 22 deletions

View File

@ -1,31 +1,31 @@
object Form1: TForm1 object Form1: TForm1
Left = 1160 Left = 1160
Height = 414 Height = 430
Top = 177 Top = 177
Width = 496 Width = 592
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 414 ClientHeight = 430
ClientWidth = 496 ClientWidth = 592
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.1' LCLVersion = '1.1'
object pcMain: TPageControl object pcMain: TPageControl
Left = 0 Left = 0
Height = 364 Height = 368
Top = 0 Top = 0
Width = 496 Width = 592
ActivePage = tsBar ActivePage = tsBar
Align = alClient Align = alClient
TabIndex = 0 TabIndex = 0
TabOrder = 0 TabOrder = 0
object tsBar: TTabSheet object tsBar: TTabSheet
Caption = 'Bar' Caption = 'Bar'
ClientHeight = 338 ClientHeight = 342
ClientWidth = 488 ClientWidth = 584
object Chart1: TChart object Chart1: TChart
Left = 0 Left = 0
Height = 338 Height = 342
Top = 0 Top = 0
Width = 488 Width = 584
AxisList = < AxisList = <
item item
TickLength = 0 TickLength = 0
@ -60,12 +60,17 @@ object Form1: TForm1
Align = alClient Align = alClient
ParentColor = False ParentColor = False
object Chart1BarSeries1: TBarSeries object Chart1BarSeries1: TBarSeries
Marks.Shape = cmsEllipse Marks.Margins.Left = 8
Marks.Margins.Top = 5
Marks.Margins.Right = 8
Marks.Margins.Bottom = 5
Marks.Arrow.BaseLength = 3 Marks.Arrow.BaseLength = 3
Marks.Arrow.Length = 9 Marks.Arrow.Length = 9
Marks.Arrow.Visible = True Marks.Arrow.Visible = True
Marks.Arrow.Width = 4 Marks.Arrow.Width = 4
Marks.Format = '%1:.2f%%' Marks.Format = '%1:.2f%%'
Marks.Frame.Color = 31097
Marks.Frame.Width = 2
Marks.Style = smsPercent Marks.Style = smsPercent
BarBrush.Color = clRed BarBrush.Color = clRed
Source = RandomChartSource1 Source = RandomChartSource1
@ -75,12 +80,12 @@ object Form1: TForm1
object Multiline: TTabSheet object Multiline: TTabSheet
Caption = 'Multiline' Caption = 'Multiline'
ClientHeight = 338 ClientHeight = 338
ClientWidth = 488 ClientWidth = 584
object ChartMulti: TChart object ChartMulti: TChart
Left = 0 Left = 0
Height = 338 Height = 338
Top = 0 Top = 0
Width = 488 Width = 584
AxisList = < AxisList = <
item item
Marks.Alignment = taCenter Marks.Alignment = taCenter
@ -121,18 +126,18 @@ object Form1: TForm1
end end
object pnlControls: TPanel object pnlControls: TPanel
Left = 0 Left = 0
Height = 50 Height = 62
Top = 364 Top = 368
Width = 496 Width = 592
Align = alBottom Align = alBottom
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 50 ClientHeight = 62
ClientWidth = 496 ClientWidth = 592
TabOrder = 1 TabOrder = 1
object cbHideOverlapping: TCheckBox object cbHideOverlapping: TCheckBox
Left = 352 Left = 336
Height = 17 Height = 17
Top = 16 Top = 12
Width = 130 Width = 130
Caption = 'Hide overlapping labels' Caption = 'Hide overlapping labels'
OnChange = cbHideOverlappingChange OnChange = cbHideOverlappingChange
@ -140,12 +145,12 @@ object Form1: TForm1
end end
object gbAngles: TGroupBox object gbAngles: TGroupBox
Left = 0 Left = 0
Height = 50 Height = 62
Top = 0 Top = 0
Width = 312 Width = 312
Align = alLeft Align = alLeft
Caption = ' Angles ' Caption = ' Angles '
ClientHeight = 32 ClientHeight = 44
ClientWidth = 308 ClientWidth = 308
TabOrder = 1 TabOrder = 1
object seAxisAngle: TSpinEdit object seAxisAngle: TSpinEdit
@ -206,6 +211,24 @@ object Form1: TForm1
TabOrder = 2 TabOrder = 2
end end
end end
object cbShape: TComboBox
Left = 336
Height = 21
Top = 32
Width = 160
ItemHeight = 13
ItemIndex = 0
Items.Strings = (
'Rectangle'
'Ellipse'
'Rounded corners'
'Rounded sides'
)
OnChange = cbShapeChange
Style = csDropDownList
TabOrder = 2
Text = 'Rectangle'
end
end end
object RandomChartSource1: TRandomChartSource object RandomChartSource1: TRandomChartSource
PointsNumber = 15 PointsNumber = 15

View File

@ -18,6 +18,7 @@ type
cbHideOverlapping: TCheckBox; cbHideOverlapping: TCheckBox;
ChartMulti: TChart; ChartMulti: TChart;
ChartMultiLineSeries1: TLineSeries; ChartMultiLineSeries1: TLineSeries;
cbShape: TComboBox;
gbAngles: TGroupBox; gbAngles: TGroupBox;
lblAxisAngle: TLabel; lblAxisAngle: TLabel;
lblSeriesAngle: TLabel; lblSeriesAngle: TLabel;
@ -31,6 +32,7 @@ type
Multiline: TTabSheet; Multiline: TTabSheet;
tsBar: TTabSheet; tsBar: TTabSheet;
procedure cbHideOverlappingChange(Sender: TObject); procedure cbHideOverlappingChange(Sender: TObject);
procedure cbShapeChange(Sender: TObject);
procedure ChartMultiAxisList1MarkToText(var AText: String; AMark: Double); procedure ChartMultiAxisList1MarkToText(var AText: String; AMark: Double);
procedure seAxisAngleChange(Sender: TObject); procedure seAxisAngleChange(Sender: TObject);
procedure seSeriesAngleChange(Sender: TObject); procedure seSeriesAngleChange(Sender: TObject);
@ -64,6 +66,16 @@ begin
Chart1BarSeries1.Marks.OverlapPolicy := op; Chart1BarSeries1.Marks.OverlapPolicy := op;
end; end;
procedure TForm1.cbShapeChange(Sender: TObject);
var
s: TChartLabelShape;
begin
s := TChartLabelShape(cbShape.ItemIndex);
Chart1BarSeries1.Marks.Shape := s;
ChartMulti.LeftAxis.Marks.Shape := s;
ChartMulti.BottomAxis.Marks.Shape := s;
end;
procedure TForm1.ChartMultiAxisList1MarkToText( procedure TForm1.ChartMultiAxisList1MarkToText(
var AText: String; AMark: Double); var AText: String; AMark: Double);
begin begin