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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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