mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-15 11:50:33 +01: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
|
Height = 333
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 533
|
Width = 533
|
||||||
ActivePage = lsLinear
|
ActivePage = tsAxisGroup
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabIndex = 0
|
TabIndex = 3
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object lsLinear: TTabSheet
|
object lsLinear: TTabSheet
|
||||||
Caption = 'Linear transform'
|
Caption = 'Linear transform'
|
||||||
@ -29,11 +29,10 @@ object Form1: TForm1
|
|||||||
Width = 525
|
Width = 525
|
||||||
AxisList = <
|
AxisList = <
|
||||||
item
|
item
|
||||||
Alignment = calLeft
|
|
||||||
Grid.Visible = False
|
Grid.Visible = False
|
||||||
Marks.LabelFont.Color = clRed
|
Marks.LabelFont.Color = clRed
|
||||||
|
Marks.AtDataOnly = True
|
||||||
TickColor = clRed
|
TickColor = clRed
|
||||||
Title.Distance = 0
|
|
||||||
Title.LabelFont.Color = clRed
|
Title.LabelFont.Color = clRed
|
||||||
Title.LabelFont.Orientation = 900
|
Title.LabelFont.Orientation = 900
|
||||||
Title.Visible = True
|
Title.Visible = True
|
||||||
@ -52,8 +51,8 @@ object Form1: TForm1
|
|||||||
Grid.Visible = False
|
Grid.Visible = False
|
||||||
Marks.Distance = 4
|
Marks.Distance = 4
|
||||||
Marks.LabelFont.Color = clBlue
|
Marks.LabelFont.Color = clBlue
|
||||||
|
Marks.AtDataOnly = True
|
||||||
TickColor = clBlue
|
TickColor = clBlue
|
||||||
Title.Distance = 0
|
|
||||||
Title.LabelFont.Color = clBlue
|
Title.LabelFont.Color = clBlue
|
||||||
Title.LabelFont.Orientation = 900
|
Title.LabelFont.Orientation = 900
|
||||||
Title.Visible = True
|
Title.Visible = True
|
||||||
@ -125,7 +124,6 @@ object Form1: TForm1
|
|||||||
Width = 525
|
Width = 525
|
||||||
AxisList = <
|
AxisList = <
|
||||||
item
|
item
|
||||||
Alignment = calLeft
|
|
||||||
Title.LabelFont.Orientation = 900
|
Title.LabelFont.Orientation = 900
|
||||||
Title.Visible = True
|
Title.Visible = True
|
||||||
Title.Caption = 'Left'
|
Title.Caption = 'Left'
|
||||||
@ -209,7 +207,6 @@ object Form1: TForm1
|
|||||||
Width = 525
|
Width = 525
|
||||||
AxisList = <
|
AxisList = <
|
||||||
item
|
item
|
||||||
Alignment = calLeft
|
|
||||||
Marks.Distance = 0
|
Marks.Distance = 0
|
||||||
Marks.Format = '$%0:.9g'
|
Marks.Format = '$%0:.9g'
|
||||||
Marks.Frame.Style = psSolid
|
Marks.Frame.Style = psSolid
|
||||||
@ -250,6 +247,37 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
object lcsMarks: TListChartSource
|
object lcsMarks: TListChartSource
|
||||||
DataPoints.Strings = (
|
DataPoints.Strings = (
|
||||||
|
|||||||
@ -17,6 +17,7 @@ type
|
|||||||
catTAutoScaleAxisTransform1: TAutoScaleAxisTransform;
|
catTAutoScaleAxisTransform1: TAutoScaleAxisTransform;
|
||||||
catTAuto: TChartAxisTransformations;
|
catTAuto: TChartAxisTransformations;
|
||||||
cbAuto: TCheckBox;
|
cbAuto: TCheckBox;
|
||||||
|
ChartAxisGroup: TChart;
|
||||||
ChartLog: TChart;
|
ChartLog: TChart;
|
||||||
cfsLog: TFuncSeries;
|
cfsLog: TFuncSeries;
|
||||||
cbLog: TCheckBox;
|
cbLog: TCheckBox;
|
||||||
@ -39,6 +40,7 @@ type
|
|||||||
rcsTSummer: TRandomChartSource;
|
rcsTSummer: TRandomChartSource;
|
||||||
rcsTWinter: TRandomChartSource;
|
rcsTWinter: TRandomChartSource;
|
||||||
lsLinear: TTabSheet;
|
lsLinear: TTabSheet;
|
||||||
|
tsAxisGroup: TTabSheet;
|
||||||
tsLog: TTabSheet;
|
tsLog: TTabSheet;
|
||||||
tsCustomMarks: TTabSheet;
|
tsCustomMarks: TTabSheet;
|
||||||
procedure cbAutoChange(Sender: TObject);
|
procedure cbAutoChange(Sender: TObject);
|
||||||
@ -54,7 +56,7 @@ var
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math;
|
Math, TAChartAxis;
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
@ -82,15 +84,43 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.FormCreate(Sender: TObject);
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
|
const
|
||||||
|
COLORS: array [1..5] of Integer =
|
||||||
|
($0000A0, $002080, $004060, $006040, $008020);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i, j: Integer;
|
||||||
x: Double;
|
x: Double;
|
||||||
|
ls: TLineSeries;
|
||||||
|
tr: TChartAxisTransformations;
|
||||||
begin
|
begin
|
||||||
for i := 0 to 50 do begin
|
for i := 0 to 50 do begin
|
||||||
with cfsLog.Extent do
|
with cfsLog.Extent do
|
||||||
x := i / 50 * (XMax - XMin) + XMin;
|
x := i / 50 * (XMax - XMin) + XMin;
|
||||||
clsLogPoints.AddXY(x + Random - 0.5, MyFunc(x) + Random - 0.5);
|
clsLogPoints.AddXY(x + Random - 0.5, MyFunc(x) + Random - 0.5);
|
||||||
end;
|
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;
|
end;
|
||||||
|
|
||||||
procedure TForm1.TChartAxisList1MarkToText(var AText: String; AMark: Double);
|
procedure TForm1.TChartAxisList1MarkToText(var AText: String; AMark: Double);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user