TAChart: Allow hiding of stacked chart levels in the multi demo

git-svn-id: trunk@37590 -
This commit is contained in:
ask 2012-06-08 09:02:52 +00:00
parent 7b0ef9b1df
commit e51dd9411e
2 changed files with 53 additions and 0 deletions

View File

@ -82,6 +82,10 @@ object Form1: TForm1
Depth = 10
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
Legend.GroupFont.Style = [fsBold]
Legend.GroupTitles.Strings = (
'Levels'
)
Legend.Visible = True
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlue
@ -91,6 +95,7 @@ object Form1: TForm1
Align = alClient
ParentColor = False
object chStackedBarSeries1: TBarSeries
Legend.GroupIndex = 0
Legend.Multiplicity = lmStyle
Active = False
Marks.Format = '%0:.2g'
@ -105,6 +110,7 @@ object Form1: TForm1
Styles = ChartStyles1
end
object chStackedLineSeries1: TLineSeries
Legend.GroupIndex = 0
Legend.Multiplicity = lmStyle
Active = False
Marks.Format = '%0:.2g'
@ -117,6 +123,7 @@ object Form1: TForm1
Styles = ChartStyles1
end
object chStackedAreaSeries1: TAreaSeries
Legend.GroupIndex = 0
Legend.Multiplicity = lmStyle
Marks.Format = '%0:.2g'
Marks.LinkPen.Visible = False
@ -182,6 +189,36 @@ object Form1: TForm1
OnChange = cbPercentageChange
TabOrder = 1
end
object cgShowStackLevels: TCheckGroup
Left = 297
Height = 42
Top = 0
Width = 224
Align = alRight
AutoFill = True
Caption = 'Show levels'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 3
ClientHeight = 24
ClientWidth = 220
Columns = 3
Items.Strings = (
'red'
'green'
'blue'
)
OnItemClick = cgShowStackLevelsItemClick
TabOrder = 2
Data = {
03000000030303
}
end
end
end
object tsWhiskers: TTabSheet

View File

@ -15,6 +15,7 @@ type
TForm1 = class(TForm)
ccsStacked: TCalculatedChartSource;
cbPercentage: TCheckBox;
cgShowStackLevels: TCheckGroup;
chOHLC: TChart;
ChartStyles1: TChartStyles;
chOHLCOpenHighLowCloseSeries1: TOpenHighLowCloseSeries;
@ -36,6 +37,7 @@ type
tsStacked: TTabSheet;
tsBubble: TTabSheet;
procedure cbPercentageChange(Sender: TObject);
procedure cgShowStackLevelsItemClick(Sender: TObject; Index: integer);
procedure FormCreate(Sender: TObject);
procedure rgStackedSeriesClick(Sender: TObject);
end;
@ -54,6 +56,20 @@ begin
ccsStacked.Percentage := cbPercentage.Checked;
end;
procedure TForm1.cgShowStackLevelsItemClick(Sender: TObject; Index: integer);
var
s: String;
i: Integer;
begin
s := '';
for i := 0 to cgShowStackLevels.Items.Count - 1 do begin
if cgShowStackLevels.Checked[i] then
s += Format('%d,', [i]);
ChartStyles1.Styles[i].RepeatCount := Ord(cgShowStackLevels.Checked[i]);
end;
ccsStacked.ReorderYList := s[1..Length(s) - 1];
end;
procedure TForm1.FormCreate(Sender: TObject);
var
ylist: array [1..4] of Double;