mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-10 05:42:39 +02:00
TAChart: Update axis demo to include AtDataOnly and Group properties
git-svn-id: trunk@26939 -
This commit is contained in:
parent
a6d808414e
commit
b95e37f3d3
@ -14,9 +14,9 @@ object Form1: TForm1
|
||||
Height = 333
|
||||
Top = 0
|
||||
Width = 533
|
||||
ActivePage = lsLinear
|
||||
ActivePage = tsAxisGroup
|
||||
Align = alClient
|
||||
TabIndex = 0
|
||||
TabIndex = 3
|
||||
TabOrder = 0
|
||||
object lsLinear: TTabSheet
|
||||
Caption = 'Linear transform'
|
||||
@ -29,11 +29,10 @@ object Form1: TForm1
|
||||
Width = 525
|
||||
AxisList = <
|
||||
item
|
||||
Alignment = calLeft
|
||||
Grid.Visible = False
|
||||
Marks.LabelFont.Color = clRed
|
||||
Marks.AtDataOnly = True
|
||||
TickColor = clRed
|
||||
Title.Distance = 0
|
||||
Title.LabelFont.Color = clRed
|
||||
Title.LabelFont.Orientation = 900
|
||||
Title.Visible = True
|
||||
@ -52,8 +51,8 @@ object Form1: TForm1
|
||||
Grid.Visible = False
|
||||
Marks.Distance = 4
|
||||
Marks.LabelFont.Color = clBlue
|
||||
Marks.AtDataOnly = True
|
||||
TickColor = clBlue
|
||||
Title.Distance = 0
|
||||
Title.LabelFont.Color = clBlue
|
||||
Title.LabelFont.Orientation = 900
|
||||
Title.Visible = True
|
||||
@ -125,7 +124,6 @@ object Form1: TForm1
|
||||
Width = 525
|
||||
AxisList = <
|
||||
item
|
||||
Alignment = calLeft
|
||||
Title.LabelFont.Orientation = 900
|
||||
Title.Visible = True
|
||||
Title.Caption = 'Left'
|
||||
@ -209,7 +207,6 @@ object Form1: TForm1
|
||||
Width = 525
|
||||
AxisList = <
|
||||
item
|
||||
Alignment = calLeft
|
||||
Marks.Distance = 0
|
||||
Marks.Format = '$%0:.9g'
|
||||
Marks.Frame.Style = psSolid
|
||||
@ -250,6 +247,37 @@ object Form1: TForm1
|
||||
end
|
||||
end
|
||||
end
|
||||
object tsAxisGroup: TTabSheet
|
||||
Caption = 'Axis groups'
|
||||
ClientHeight = 307
|
||||
ClientWidth = 525
|
||||
object ChartAxisGroup: TChart
|
||||
Left = 0
|
||||
Height = 307
|
||||
Top = 0
|
||||
Width = 525
|
||||
AxisList = <
|
||||
item
|
||||
Grid.Visible = False
|
||||
Group = 2
|
||||
TickLength = 0
|
||||
Title.LabelFont.Orientation = 900
|
||||
Title.Font.Orientation = 900
|
||||
end
|
||||
item
|
||||
Alignment = calBottom
|
||||
end>
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Font.Color = clBlue
|
||||
Title.Text.Strings = (
|
||||
'TAChart'
|
||||
)
|
||||
Align = alClient
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
end
|
||||
object lcsMarks: TListChartSource
|
||||
DataPoints.Strings = (
|
||||
|
@ -17,6 +17,7 @@ type
|
||||
catTAutoScaleAxisTransform1: TAutoScaleAxisTransform;
|
||||
catTAuto: TChartAxisTransformations;
|
||||
cbAuto: TCheckBox;
|
||||
ChartAxisGroup: TChart;
|
||||
ChartLog: TChart;
|
||||
cfsLog: TFuncSeries;
|
||||
cbLog: TCheckBox;
|
||||
@ -39,6 +40,7 @@ type
|
||||
rcsTSummer: TRandomChartSource;
|
||||
rcsTWinter: TRandomChartSource;
|
||||
lsLinear: TTabSheet;
|
||||
tsAxisGroup: TTabSheet;
|
||||
tsLog: TTabSheet;
|
||||
tsCustomMarks: TTabSheet;
|
||||
procedure cbAutoChange(Sender: TObject);
|
||||
@ -54,7 +56,7 @@ var
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
Math, TAChartAxis;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
@ -82,15 +84,43 @@ begin
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
const
|
||||
COLORS: array [1..5] of Integer =
|
||||
($0000A0, $002080, $004060, $006040, $008020);
|
||||
var
|
||||
i: Integer;
|
||||
i, j: Integer;
|
||||
x: Double;
|
||||
ls: TLineSeries;
|
||||
tr: TChartAxisTransformations;
|
||||
begin
|
||||
for i := 0 to 50 do begin
|
||||
with cfsLog.Extent do
|
||||
x := i / 50 * (XMax - XMin) + XMin;
|
||||
clsLogPoints.AddXY(x + Random - 0.5, MyFunc(x) + Random - 0.5);
|
||||
end;
|
||||
for i := 1 to 5 do begin
|
||||
ls := TLineSeries.Create(Self);
|
||||
ChartAxisGroup.AddSeries(ls);
|
||||
ls.SeriesColor := COLORS[i];
|
||||
ls.LinePen.Width := 2;
|
||||
for j := 1 to 20 do
|
||||
ls.AddXY(j, Random * 8);
|
||||
tr := TChartAxisTransformations.Create(Self);
|
||||
with TAutoScaleAxisTransform.Create(Self) do begin
|
||||
Transformations := tr;
|
||||
MinValue := i;
|
||||
MaxValue := i + 0.8;
|
||||
end;
|
||||
with TChartAxis.Create(ChartAxisGroup.AxisList) do begin
|
||||
Transformations := tr;
|
||||
Marks.AtDataOnly := true;
|
||||
Marks.LabelFont.Orientation := 900;
|
||||
Marks.LabelFont.Color := COLORS[i];
|
||||
TickColor := COLORS[i];
|
||||
Group := 1;
|
||||
end;
|
||||
ls.AxisIndexY := ChartAxisGroup.AxisList.Count - 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.TChartAxisList1MarkToText(var AText: String; AMark: Double);
|
||||
|
Loading…
Reference in New Issue
Block a user