forked from academiadocodigo/TBGWebCharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharts.Legends.pas
103 lines (84 loc) · 2.36 KB
/
Charts.Legends.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
unit Charts.Legends;
interface
uses
Interfaces;
type
TModelHTMLChartsLegends = class(TInterfacedObject, iModelHTMLLegend)
private
FParent : iModelHTMLOptions;
Fdisplay : Boolean;
Fposition : String;
FLabels : iModelHTMLLegendLabels<iModelHTMLLegend>;
public
constructor Create(Parent : iModelHTMLOptions);
destructor Destroy; override;
class function New(Parent : iModelHTMLOptions) : iModelHTMLLegend;
function Labels : iModelHTMLLegendLabels<iModelHTMLLegend>;
function display ( Value : Boolean ) : iModelHTMLLegend; overload;
function display : Boolean; overload;
function position ( Value : String ) : iModelHTMLLegend; overload;
function position : String; overload;
function Result : String;
function &End : iModelHTMLOptions;
end;
implementation
uses
Charts.Legends.Labels, Injection;
{ TModelHTMLChartsLegends<T> }
function TModelHTMLChartsLegends.&End: iModelHTMLOptions;
begin
Result := FParent;
end;
function TModelHTMLChartsLegends.Labels: iModelHTMLLegendLabels<iModelHTMLLegend>;
begin
Result := FLabels;
end;
constructor TModelHTMLChartsLegends.Create(Parent : iModelHTMLOptions);
begin
{$IF RTLVERSION > 27 }
TInjection.Weak(@FParent, Parent);
{$ELSE}
FParent := Parent;
{$IFEND}
FLabels := TModelHTMLLegendsLabels<iModelHTMLLegend>.New(Self);
Fdisplay := True;
Fposition := 'top';
end;
destructor TModelHTMLChartsLegends.Destroy;
begin
inherited;
end;
function TModelHTMLChartsLegends.display: Boolean;
begin
Result := Fdisplay;
end;
function TModelHTMLChartsLegends.display(
Value: Boolean): iModelHTMLLegend;
begin
Result := Self;
FDisplay := Value;
end;
class function TModelHTMLChartsLegends.New(Parent : iModelHTMLOptions): iModelHTMLLegend;
begin
Result := Self.Create(Parent);
end;
function TModelHTMLChartsLegends.position: String;
begin
Result := Fposition;
end;
function TModelHTMLChartsLegends.position(
Value: String): iModelHTMLLegend;
begin
Result := Self;
Fposition := Value;
end;
function TModelHTMLChartsLegends.Result: String;
begin
Result := '';
Result := Result + 'legend : { ';
Result := Result + 'position : "' + Fposition + '", ';
Result := Result + FLabels.Result;
if Fdisplay then Result := Result + ' display : true ' else Result := Result + 'display : false ';
Result := Result + '},';
end;
end.