forked from academiadocodigo/TBGWebCharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Charts.Axes.Params.pas
167 lines (141 loc) · 4.6 KB
/
Charts.Axes.Params.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
unit Charts.Axes.Params;
interface
uses
Interfaces;
type
TModelHTMLAxesParams = class(TInterfacedObject, iModelHTMLChartsAxesParam)
private
FParent : iModelHTMLChartsAxes;
FPosition : String;
FOffSet : Boolean;
FType : String;
FRealTime : iModelHTMLChartsAxesParamRealTime;
FResult : String;
FStacked : Boolean;
FTicks : iModelHTMLChartsAxesTicks<iModelHTMLChartsAxesParam>;
FGridLines : iModelHTMLChartsAxesGridLines<iModelHTMLChartsAxesParam>;
FScaleLabel : iModelHTMLChatsAxesScaleLabel<iModelHTMLChartsAxesParam>;
public
constructor Create(Parent : iModelHTMLChartsAxes);
destructor Destroy; override;
class function New(Parent : iModelHTMLChartsAxes) : iModelHTMLChartsAxesParam;
function Ticks : iModelHTMLChartsAxesTicks<iModelHTMLChartsAxesParam>;
function GridLines : iModelHTMLChartsAxesGridLines<iModelHTMLChartsAxesParam>;
function ScaleLabel : iModelHTMLChatsAxesScaleLabel<iModelHTMLChartsAxesParam>;
function Position (Value : String) : iModelHTMLChartsAxesParam; overload;
function Position : String; overload;
function OffSet (Value : Boolean) : iModelHTMLChartsAxesParam; overload;
function OffSet : Boolean; overload;
function _Type (Value : String) : iModelHTMLChartsAxesParam; overload;
function _Type : String; overload;
function RealTime : iModelHTMLChartsAxesParamRealTime;
function Stacked ( Value : Boolean ) : iModelHTMLChartsAxesParam; overload;
function Stacked : Boolean; overload;
function Result : String;
function &End : iModelHTMLChartsAxes;
end;
implementation
uses
System.SysUtils, Charts.Axes.Ticks, Charts.Axes.GridLines,
Charts.Axes.ScaleLabel, Injection, Charts.Axes.Params.RealTime;
{ TModelHTMLAxesParams<T> }
function TModelHTMLAxesParams.&End: iModelHTMLChartsAxes;
begin
Result := FParent;
end;
function TModelHTMLAxesParams.GridLines: iModelHTMLChartsAxesGridLines<iModelHTMLChartsAxesParam>;
begin
Result := FGridLines;
end;
constructor TModelHTMLAxesParams.Create(Parent : iModelHTMLChartsAxes);
begin
{$IF RTLVERSION > 27 }
TInjection.Weak(@FParent, Parent);
{$ELSE}
FParent := Parent;
{$IFEND}
FOffSet := True;
FType := '';
FStacked := False;
FTicks := TModelHTMLAxesTicks<iModelHTMLChartsAxesParam>.New(Self);
FGridLines := TModelHTMLAxesGridLines<iModelHTMLChartsAxesParam>.New(Self);
FScaleLabel := TModelHTMLAxesScaleLabel<iModelHTMLChartsAxesParam>.New(Self);
end;
destructor TModelHTMLAxesParams.Destroy;
begin
inherited;
end;
class function TModelHTMLAxesParams.New(Parent : iModelHTMLChartsAxes): iModelHTMLChartsAxesParam;
begin
Result := Self.Create(Parent);
end;
function TModelHTMLAxesParams.OffSet: Boolean;
begin
Result := FOffSet;
end;
function TModelHTMLAxesParams.OffSet(
Value: Boolean): iModelHTMLChartsAxesParam;
begin
Result := Self;
FOffSet := Value;
end;
function TModelHTMLAxesParams.Position: String;
begin
Result := FPosition;
end;
function TModelHTMLAxesParams.Position(
Value: String): iModelHTMLChartsAxesParam;
begin
Result := Self;
FPosition := Value;
end;
function TModelHTMLAxesParams.RealTime: iModelHTMLChartsAxesParamRealTime;
begin
FRealTime := TModelHTMLAxesParamsRealTime.New(Self);
Result := FRealTime;
end;
function TModelHTMLAxesParams.Result: String;
begin
FResult := '';
if Assigned(FRealTime) then
begin
FResult := FResult + 'type: ''realtime'',';
FResult := FResult + FRealTime.Result + ',';
end;
if FPosition <> '' then FResult := FResult + 'position : ' + QuotedStr(FPosition) + ',';
if FStacked then FResult := FResult + 'stacked : true,' else FResult := FResult + 'stacked : false,';
if FOffSet then FResult := FResult + 'offset : true,' else FResult := FResult + 'offset : false,';
FResult := FResult + FGridLines.Result;
FResult := FResult + FScaleLabel.Result;
FResult := FResult + FTicks.Result;
Result := FResult;
end;
function TModelHTMLAxesParams.ScaleLabel: iModelHTMLChatsAxesScaleLabel<iModelHTMLChartsAxesParam>;
begin
Result := FScaleLabel;
end;
function TModelHTMLAxesParams.Stacked: Boolean;
begin
Result := FStacked;
end;
function TModelHTMLAxesParams.Stacked(
Value: Boolean): iModelHTMLChartsAxesParam;
begin
Result := Self;
FStacked := Value;
end;
function TModelHTMLAxesParams.Ticks: iModelHTMLChartsAxesTicks<iModelHTMLChartsAxesParam>;
begin
Result := FTicks;
end;
function TModelHTMLAxesParams._Type: String;
begin
Result := FType;
end;
function TModelHTMLAxesParams._Type(
Value: String): iModelHTMLChartsAxesParam;
begin
Result := Self;
FType := Value;
end;
end.