TAChart: Fix line demo (inconsistent behavior when "3D" and "rotated" boxes are checked and "Add" is pressed).

git-svn-id: trunk@62290 -
This commit is contained in:
wp 2019-11-23 22:59:36 +00:00
parent 4c785559bb
commit b4a469cf74
3 changed files with 52 additions and 38 deletions

View File

@ -2,10 +2,10 @@ object Form1: TForm1
Left = 605 Left = 605
Height = 494 Height = 494
Top = 364 Top = 364
Width = 691 Width = 705
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 494 ClientHeight = 494
ClientWidth = 691 ClientWidth = 705
OnCreate = FormCreate OnCreate = FormCreate
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '2.1.0.0' LCLVersion = '2.1.0.0'
@ -13,7 +13,7 @@ object Form1: TForm1
Left = 0 Left = 0
Height = 494 Height = 494
Top = 0 Top = 0
Width = 691 Width = 705
ActivePage = tsFast ActivePage = tsFast
Align = alClient Align = alClient
TabIndex = 0 TabIndex = 0
@ -22,12 +22,12 @@ object Form1: TForm1
object tsFast: TTabSheet object tsFast: TTabSheet
Caption = 'Fast drawing' Caption = 'Fast drawing'
ClientHeight = 466 ClientHeight = 466
ClientWidth = 683 ClientWidth = 697
object chFast: TChart object chFast: TChart
Left = 0 Left = 0
Height = 427 Height = 427
Top = 39 Top = 39
Width = 683 Width = 697
AxisList = < AxisList = <
item item
Marks.LabelBrush.Style = bsClear Marks.LabelBrush.Style = bsClear
@ -69,12 +69,12 @@ object Form1: TForm1
Left = 0 Left = 0
Height = 39 Height = 39
Top = 0 Top = 0
Width = 683 Width = 697
Align = alTop Align = alTop
AutoSize = True AutoSize = True
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 39 ClientHeight = 39
ClientWidth = 683 ClientWidth = 697
TabOrder = 1 TabOrder = 1
object cbLineType: TComboBox object cbLineType: TComboBox
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
@ -134,12 +134,12 @@ object Form1: TForm1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1 AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 357 Left = 327
Height = 25 Height = 25
Top = 7 Top = 7
Width = 48 Width = 48
AutoSize = True AutoSize = True
BorderSpacing.Left = 80 BorderSpacing.Left = 50
Caption = 'Add' Caption = 'Add'
OnClick = btnAddSeriesClick OnClick = btnAddSeriesClick
TabOrder = 3 TabOrder = 3
@ -149,7 +149,7 @@ object Form1: TForm1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1 AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 523 Left = 492
Height = 23 Height = 23
Top = 8 Top = 8
Width = 76 Width = 76
@ -162,10 +162,10 @@ object Form1: TForm1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1 AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 413 Left = 383
Height = 25 Height = 25
Top = 7 Top = 7
Width = 102 Width = 101
AutoSize = True AutoSize = True
BorderSpacing.Left = 8 BorderSpacing.Left = 8
Caption = 'Timed refresh:' Caption = 'Timed refresh:'
@ -187,10 +187,16 @@ object Form1: TForm1
TabOrder = 6 TabOrder = 6
end end
object lblPointsCount: TLabel object lblPointsCount: TLabel
Left = 0 AnchorSideLeft.Control = edTime
Height = 1 AnchorSideLeft.Side = asrBottom
Top = 14 AnchorSideTop.Control = edTime
Width = 1 AnchorSideTop.Side = asrCenter
Left = 574
Height = 15
Top = 12
Width = 79
BorderSpacing.Left = 6
Caption = 'lblPointsCount'
ParentColor = False ParentColor = False
end end
end end
@ -198,12 +204,12 @@ object Form1: TForm1
object tsPointers: TTabSheet object tsPointers: TTabSheet
Caption = 'Pointers' Caption = 'Pointers'
ClientHeight = 466 ClientHeight = 466
ClientWidth = 683 ClientWidth = 697
object chPointers: TChart object chPointers: TChart
Left = 0 Left = 0
Height = 466 Height = 466
Top = 0 Top = 0
Width = 513 Width = 527
AxisList = < AxisList = <
item item
Marks.LabelBrush.Style = bsClear Marks.LabelBrush.Style = bsClear
@ -230,7 +236,7 @@ object Form1: TForm1
Align = alClient Align = alClient
end end
object pnlPointers: TPanel object pnlPointers: TPanel
Left = 513 Left = 527
Height = 466 Height = 466
Top = 0 Top = 0
Width = 170 Width = 170
@ -260,12 +266,12 @@ object Form1: TForm1
object tsCustomDrawPointer: TTabSheet object tsCustomDrawPointer: TTabSheet
Caption = 'Customdrawn pointer' Caption = 'Customdrawn pointer'
ClientHeight = 466 ClientHeight = 466
ClientWidth = 683 ClientWidth = 697
object Chart_CustomDrawPointer: TChart object Chart_CustomDrawPointer: TChart
Left = 0 Left = 0
Height = 427 Height = 427
Top = 39 Top = 39
Width = 683 Width = 697
AxisList = < AxisList = <
item item
Marks.LabelBrush.Style = bsClear Marks.LabelBrush.Style = bsClear
@ -299,12 +305,12 @@ object Form1: TForm1
Left = 0 Left = 0
Height = 39 Height = 39
Top = 0 Top = 0
Width = 683 Width = 697
Align = alTop Align = alTop
AutoSize = True AutoSize = True
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 39 ClientHeight = 39
ClientWidth = 683 ClientWidth = 697
TabOrder = 1 TabOrder = 1
object cbBitmapPointer: TCheckBox object cbBitmapPointer: TCheckBox
AnchorSideLeft.Control = Panel2 AnchorSideLeft.Control = Panel2
@ -393,12 +399,12 @@ object Form1: TForm1
object tsGetPointerStyle: TTabSheet object tsGetPointerStyle: TTabSheet
Caption = 'OnGetPointerStyle event' Caption = 'OnGetPointerStyle event'
ClientHeight = 466 ClientHeight = 466
ClientWidth = 683 ClientWidth = 697
object ChartGetPointerStyleEvent: TChart object ChartGetPointerStyleEvent: TChart
Left = 0 Left = 0
Height = 466 Height = 466
Top = 0 Top = 0
Width = 683 Width = 697
AxisList = < AxisList = <
item item
Marks.LabelBrush.Style = bsClear Marks.LabelBrush.Style = bsClear
@ -432,12 +438,12 @@ object Form1: TForm1
object tsOscilloscope: TTabSheet object tsOscilloscope: TTabSheet
Caption = 'Oscilloscope' Caption = 'Oscilloscope'
ClientHeight = 466 ClientHeight = 466
ClientWidth = 683 ClientWidth = 697
object chOscillator: TChart object chOscillator: TChart
Left = 0 Left = 0
Height = 466 Height = 466
Top = 0 Top = 0
Width = 683 Width = 697
AxisList = < AxisList = <
item item
Grid.Color = clMedGray Grid.Color = clMedGray
@ -481,17 +487,17 @@ object Form1: TForm1
object tsColorEach: TTabSheet object tsColorEach: TTabSheet
Caption = 'Color each data point' Caption = 'Color each data point'
ClientHeight = 466 ClientHeight = 466
ClientWidth = 683 ClientWidth = 697
object pnlColorEach: TPanel object pnlColorEach: TPanel
Left = 0 Left = 0
Height = 39 Height = 39
Top = 0 Top = 0
Width = 683 Width = 697
Align = alTop Align = alTop
AutoSize = True AutoSize = True
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 39 ClientHeight = 39
ClientWidth = 683 ClientWidth = 697
TabOrder = 0 TabOrder = 0
object cbColorEach: TComboBox object cbColorEach: TComboBox
AnchorSideLeft.Control = pnlColorEach AnchorSideLeft.Control = pnlColorEach
@ -524,7 +530,7 @@ object Form1: TForm1
Left = 0 Left = 0
Height = 427 Height = 427
Top = 39 Top = 39
Width = 683 Width = 697
AxisList = < AxisList = <
item item
Marks.LabelBrush.Style = bsClear Marks.LabelBrush.Style = bsClear

View File

@ -107,12 +107,17 @@ begin
for i := 1 to 10 do begin for i := 1 to 10 do begin
s := TLineSeries.Create(chFast); s := TLineSeries.Create(chFast);
s.SeriesColor := clRed; s.SeriesColor := clRed;
if cb3D.Checked then
s.Depth := 15 - s.Depth;
s.AxisIndexY := Ord(cbRotated.Checked);
s.AxisIndexX := 1 - s.AxisIndexY;
s.ListSource.Sorted := cbSorted.Checked;
for j := 1 to POINTS_PER_SERIE do for j := 1 to POINTS_PER_SERIE do
s.AddXY(j, Random * 5 + chFast.SeriesCount * 10); s.AddXY(j, Random * 5 + chFast.SeriesCount * 10);
chFast.AddSeries(s); chFast.AddSeries(s);
end; end;
lblPointsCount.Caption := lblPointsCount.Caption :=
Format('Points: %.2e', [chFast.SeriesCount * POINTS_PER_SERIE * 1.0]); Format('Points: %.0n', [chFast.SeriesCount * POINTS_PER_SERIE * 1.0]);
end; end;
procedure TForm1.btnRefreshClick(Sender: TObject); procedure TForm1.btnRefreshClick(Sender: TObject);
@ -162,6 +167,8 @@ begin
ls.AxisIndexY := Ord(cbRotated.Checked); ls.AxisIndexY := Ord(cbRotated.Checked);
ls.AxisIndexX := 1 - ls.AxisIndexY; ls.AxisIndexX := 1 - ls.AxisIndexY;
end; end;
chFastConstantLine1.LineStyle := TLineStyle(cbRotated.Checked);
chFastConstantLine1.AxisIndex := Ord(cbRotated.Checked);
end; end;
procedure TForm1.cbSortedChange(Sender: TObject); procedure TForm1.cbSortedChange(Sender: TObject);
@ -187,6 +194,8 @@ var
x, y: Double; x, y: Double;
clr: TColor; clr: TColor;
begin begin
lblPointsCount.Caption := '';
// Populate the series for the PointerStyle demo // Populate the series for the PointerStyle demo
for st in TSeriesPointerStyle do begin for st in TSeriesPointerStyle do begin
ls := TLineSeries.Create(Self); ls := TLineSeries.Create(Self);

View File

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="11"/> <Version Value="12"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
</General> </General>
@ -20,14 +22,11 @@
<Version Value="2"/> <Version Value="2"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
<FormatVersion Value="2"/> <FormatVersion Value="2"/>
<Modes Count="1"> <Modes Count="1">
<Mode0 Name="default"> <Mode0 Name="default">
<local> <local>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local> </local>
</Mode0> </Mode0>
</Modes> </Modes>