TAChart: Use series enumerators in demo projects

git-svn-id: trunk@31679 -
This commit is contained in:
ask 2011-07-12 11:42:28 +00:00
parent ff5131c97b
commit ef6c622afb
8 changed files with 50 additions and 42 deletions

View File

@ -8,7 +8,7 @@ object Form1: TForm1
ClientWidth = 560
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '0.9.29'
LCLVersion = '0.9.31'
object Chart1: TChart
Left = 0
Height = 297
@ -16,10 +16,12 @@ object Form1: TForm1
Width = 560
AxisList = <
item
Minors = <>
Title.LabelFont.Orientation = 900
end
item
Alignment = calBottom
Minors = <>
end>
BackColor = clSilver
Depth = 50

View File

@ -54,11 +54,11 @@ end;
procedure TForm1.seDepthChange(Sender: TObject);
var
i: Integer;
s: TBasicChartSeries;
begin
Chart1.Depth := seDepth.Value;
for i := 0 to Chart1.SeriesCount - 1 do
Chart1.Series[i].Depth := Min(seDepth.Value, 10);
for s in Chart1.Series do
s.Depth := Min(seDepth.Value, 10);
end;
end.

View File

@ -1,22 +1,23 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<Version Value="8"/>
<General>
<Flags>
<AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
<Title Value="TAChart 3D look demo"/>
<ResourceType Value="res"/>
</General>
<VersionInfo>
<StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
@ -54,10 +55,10 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="9"/>
<Version Value="10"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)\"/>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>

View File

@ -17,12 +17,14 @@ object Form1: TForm1
AxisList = <
item
Grid.Color = clGray
Minors = <>
Title.LabelFont.Height = -11
Title.LabelFont.Name = 'MS Sans Serif'
end
item
Alignment = calBottom
Grid.Color = clGray
Alignment = calBottom
Minors = <>
Title.LabelFont.Height = -11
Title.LabelFont.Name = 'MS Sans Serif'
end>

View File

@ -87,9 +87,10 @@ uses
procedure TForm1.BringToFront(ASeries: TBasicChartSeries);
var
i: Integer;
s: TBasicChartSeries;
begin
for i := 0 to Chart1.SeriesCount - 1 do
Chart1.Series[i].ZPosition := Ord(Chart1.Series[i] = ASeries);
for s in Chart1.Series do
s.ZPosition := Ord(s = ASeries);
end;
procedure TForm1.btnAddAreaClick(Sender: TObject);

View File

@ -29,10 +29,12 @@ object Form1: TForm1
Width = 637
AxisList = <
item
Minors = <>
Title.LabelFont.Orientation = 900
end
item
Alignment = calBottom
Minors = <>
end>
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
@ -159,10 +161,12 @@ object Form1: TForm1
Width = 637
AxisList = <
item
Minors = <>
Title.LabelFont.Orientation = 900
end
item
Alignment = calBottom
Minors = <>
end>
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
@ -210,10 +214,12 @@ object Form1: TForm1
Width = 467
AxisList = <
item
Minors = <>
Title.LabelFont.Orientation = 900
end
item
Alignment = calBottom
Minors = <>
end>
AxisVisible = False
ExpandPercentage = 5

View File

@ -62,7 +62,11 @@ implementation
{$R *.lfm}
uses
LCLIntf, TATypes, TAChartUtils;
LCLIntf, TAChartUtils, TATypes, TAEnumerators;
type
TLineSeriesEnum =
specialize TFilteredChartSeriesEnumeratorFactory<TLineSeries>;
{ TForm1 }
@ -95,45 +99,37 @@ end;
procedure TForm1.cb3DChange(Sender: TObject);
var
i: Integer;
ls: TLineSeries;
begin
for i := 0 to chFast.SeriesCount - 1 do
if chFast.Series[i] is TLineSeries then
with chFast.Series[i] as TLineSeries do
Depth := 15 - Depth;
for ls in TLineSeriesEnum.Create(chFast) do
ls.Depth := 15 - ls.Depth;
end;
procedure TForm1.cbLineTypeChange(Sender: TObject);
var
i: Integer;
ls: TLineSeries;
begin
for i := 0 to chFast.SeriesCount - 1 do
if chFast.Series[i] is TLineSeries then
with chFast.Series[i] as TLineSeries do
LineType := TLineType(cbLineType.ItemIndex);
for ls in TLineSeriesEnum.Create(chFast) do
ls.LineType := TLineType(cbLineType.ItemIndex);
end;
procedure TForm1.cbRotatedChange(Sender: TObject);
var
i: Integer;
ls: TLineSeries;
begin
for i := 0 to chFast.SeriesCount - 1 do
if chFast.Series[i] is TLineSeries then
with chFast.Series[i] as TLineSeries do begin
AxisIndexY := Ord(cbRotated.Checked);
AxisIndexX := 1 - AxisIndexY;
end;
for ls in TLineSeriesEnum.Create(chFast) do begin
ls.AxisIndexY := Ord(cbRotated.Checked);
ls.AxisIndexX := 1 - ls.AxisIndexY;
end;
end;
procedure TForm1.cbSortedChange(Sender: TObject);
var
i: Integer;
ls: TLineSeries;
begin
for i := 0 to chFast.SeriesCount - 1 do
if chFast.Series[i] is TLineSeries then
with chFast.Series[i] as TLineSeries do
if Source is TListChartSource then
ListSource.Sorted := cbSorted.Checked;
for ls in TLineSeriesEnum.Create(chFast) do
if ls.Source is TListChartSource then
ls.ListSource.Sorted := cbSorted.Checked;
end;
procedure TForm1.FormCreate(Sender: TObject);
@ -142,7 +138,7 @@ var
ls: TLineSeries;
s: ShortString;
begin
for st := Low(st) to High(st) do begin
for st in TSeriesPointerStyle do begin
ls := TLineSeries.Create(Self);
ls.LinePen.Color := clGreen;
ls.ShowPoints := true;
@ -161,10 +157,10 @@ end;
procedure TForm1.sePointerSizeChange(Sender: TObject);
var
i: Integer;
ls: TLineSeries;
begin
for i := 0 to chPointers.SeriesCount - 1 do
with (chPointers.Series[i] as TLineSeries).Pointer do begin
for ls in TLineSeriesEnum.Create(chPointers) do
with ls.Pointer do begin
HorizSize := sePointerSize.Value;
VertSize := sePointerSize.Value;
end;

View File

@ -30,7 +30,7 @@ type
FChart: TChart;
FFilter: TBooleanDynArray;
public
constructor Create(AChart: TChart; AFilter: TBooleanDynArray);
constructor Create(AChart: TChart; AFilter: TBooleanDynArray = nil);
property Chart: TChart read FChart;
property Filter: TBooleanDynArray read FFilter;
end;