1
1
< main [class] ="theme ">
2
2
< div class ="chart-col ">
3
3
< div style ="position: absolute; top: 50px; left: 50px; right: 50px; bottom: 50px; ">
4
- < ngx-graph
5
- #graph
6
- class ="chart-container "
7
- [view] ="view "
8
- [enableZoom] ="enableZoom "
9
- [autoZoom] ="autoZoom "
10
- [panOnZoom] ="panOnZoom "
11
- [panOffsetX] ="panOffsetX "
12
- [panOffsetY] ="panOffsetY "
13
- [zoomLevel] ="zoomLevel "
14
- [autoCenter] ="autoCenter "
15
- [legend] ="showLegend "
16
- [links] ="hierarchialGraph.links "
17
- (legendLabelClick) ="onLegendLabelClick($event) "
18
- [nodes] ="hierarchialGraph.nodes "
19
- [scheme] ="colorScheme "
20
- [orientation] ="orientation "
21
- [curve] ="curve "
22
- (select) ="select($event) ">
4
+ < ngx-graph #graph class ="chart-container " [view] ="view " [enableZoom] ="enableZoom " [autoZoom] ="autoZoom " [panOnZoom] ="panOnZoom "
5
+ [panOffsetX] ="panOffsetX " [panOffsetY] ="panOffsetY " [zoomLevel] ="zoomLevel " [autoCenter] ="autoCenter " [legend] ="showLegend "
6
+ [links] ="hierarchialGraph.links " (legendLabelClick) ="onLegendLabelClick($event) " [nodes] ="hierarchialGraph.nodes " [scheme] ="colorScheme "
7
+ [orientation] ="orientation " [curve] ="curve " [update$] ="update$ " [zoomToFit$] ="zoomToFit$ " [center$] ="center$ " (select) ="select($event) ">
23
8
24
9
< ng-template #defsTemplate >
25
10
< svg:marker id ="arrow " viewBox ="0 -5 10 10 " refX ="8 " refY ="0 " markerWidth ="4 " markerHeight ="4 " orient ="auto ">
28
13
</ ng-template >
29
14
30
15
< ng-template #nodeTemplate let-node >
31
- < svg:g class ="node "
32
- ngx-tooltip
33
- [tooltipPlacement] ="'top' "
34
- [tooltipType] ="'tooltip' "
35
- [tooltipTitle] ="node.label ">
16
+ < svg:g class ="node " ngx-tooltip [tooltipPlacement] ="'top' " [tooltipType] ="'tooltip' " [tooltipTitle] ="node.label ">
36
17
< svg:rect [attr.width] ="node.width " [attr.height] ="node.height " [attr.fill] ="node.options.color " />
37
18
< svg:text alignment-baseline ="central " [attr.x] ="10 " [attr.y] ="node.height / 2 "> {{node.label}}</ svg:text >
38
19
</ svg:g >
39
20
</ ng-template >
40
21
41
22
< ng-template #linkTemplate let-link >
42
23
< svg:g class ="edge ">
43
- < svg:path
44
- class ="line "
45
- stroke-width ="2 "
46
- marker-end ="url(#arrow) " >
24
+ < svg:path class ="line " stroke-width ="2 " marker-end ="url(#arrow) ">
47
25
</ svg:path >
48
26
< svg:text class ="edge-label " text-anchor ="middle ">
49
- < textPath
50
- class ="text-path "
51
- [attr.href] ="'#' + link.id "
52
- [style.dominant-baseline] ="link.dominantBaseline "
53
- startOffset ="50% ">
27
+ < textPath class ="text-path " [attr.href] ="'#' + link.id " [style.dominant-baseline] ="link.dominantBaseline " startOffset ="50% ">
54
28
{{link.label}}
55
29
</ textPath >
56
30
</ svg:text >
62
36
</ div >
63
37
< div class ="sidebar ">
64
38
< h1 >
65
- NGX-< strong > Graph</ strong >
39
+ NGX-
40
+ < strong > Graph</ strong >
66
41
< small class ="subtitle "> Graph Visualization for Angular</ small >
67
42
</ h1 >
68
43
69
44
< div class ="sidebar-body ">
70
45
< h3 > Theme</ h3 >
71
- < select
72
- [ngModel] ="theme "
73
- (ngModelChange) ="theme = $event "> >
46
+ < select [ngModel] ="theme " (ngModelChange) ="theme = $event "> >
74
47
< option [value] ="'dark' "> Dark</ option >
75
48
< option [value] ="'light' "> Light</ option >
76
49
</ select >
77
50
78
51
< h3 (click) ="dataVisable = !dataVisable " style ="cursor: pointer ">
79
- < span
80
- [class.arrow-down] ="dataVisable "
81
- [class.arrow-right] ="!dataVisable ">
52
+ < span [class.arrow-down] ="dataVisable " [class.arrow-right] ="!dataVisable ">
82
53
</ span >
83
54
< strong > Data</ strong >
84
55
</ h3 >
85
56
< div [hidden] ="!dataVisable " style ="margin-left: 10px; ">
86
57
< div >
87
58
< label >
88
- < input type ="checkbox " [checked] ="realTimeData " (change) ="realTimeData = $event.target.checked ">
89
- Real-time
59
+ < input type ="checkbox " [checked] ="realTimeData " (change) ="realTimeData = $event.target.checked "> Real-time
90
60
</ label >
91
61
</ div >
92
62
</ div >
93
63
< div >
94
64
< h3 (click) ="dimVisiable = !dimVisiable " style ="cursor: pointer ">
95
- < span
96
- [class.arrow-down] ="dimVisiable "
97
- [class.arrow-right] ="!dimVisiable ">
65
+ < span [class.arrow-down] ="dimVisiable " [class.arrow-right] ="!dimVisiable ">
98
66
</ span >
99
67
< strong > Dimensions</ strong >
100
68
</ h3 >
101
69
< div [hidden] ="!dimVisiable " style ="margin-left: 10px; ">
102
70
< label >
103
- < input type ="checkbox " [checked] ="fitContainer " (change) ="toggleFitContainer($event.target.checked, autoZoom, autoCenter) ">
104
- Fit Container
105
- </ label > < br />
71
+ < input type ="checkbox " [checked] ="fitContainer " (change) ="toggleFitContainer($event.target.checked, autoZoom, autoCenter) "> Fit Container
72
+ </ label >
73
+ < br />
106
74
< div *ngIf ="!fitContainer ">
107
- < label > Width:</ label > < br />
108
- < input type ="number " [(ngModel)] ="width "> < br />
109
- < label > Height:</ label > < br />
110
- < input type ="number " [(ngModel)] ="height "> < br />
75
+ < label > Width:</ label >
76
+ < br />
77
+ < input type ="number " [(ngModel)] ="width ">
78
+ < br />
79
+ < label > Height:</ label >
80
+ < br />
81
+ < input type ="number " [(ngModel)] ="height ">
82
+ < br />
111
83
< button (click) ="applyDimensions() "> Apply dimensions</ button >
112
84
</ div >
113
85
</ div >
114
86
</ div >
115
87
116
88
< h3 (click) ="positionVisible = !positionVisible " style ="cursor: pointer ">
117
- < span
118
- [class.arrow-down] ="positionVisible "
119
- [class.arrow-right] ="!positionVisible ">
89
+ < span [class.arrow-down] ="positionVisible " [class.arrow-right] ="!positionVisible ">
120
90
</ span >
121
91
< strong > Position and zoom</ strong >
122
92
</ h3 >
@@ -128,43 +98,34 @@ <h3 (click)="positionVisible = !positionVisible" style="cursor: pointer">
128
98
< label > Y:</ label >
129
99
< input [(ngModel)] ="graph.panOffsetY " />
130
100
< br />
131
-
101
+
132
102
< label > Zoom level:</ label >
133
103
< input [(ngModel)] ="graph.zoomLevel " />
134
104
< br />
135
105
< label >
136
- < input type ="checkbox " [checked] ="enableZoom " (change) ="toggleEnableZoom($event.target.checked) ">
137
- Enable Zoom
138
- </ label > < br />
106
+ < input type ="checkbox " [checked] ="enableZoom " (change) ="toggleEnableZoom($event.target.checked) "> Enable Zoom
107
+ </ label >
108
+ < br />
139
109
< label >
140
- < input type ="checkbox " [checked] ="autoZoom " (change) ="toggleFitContainer(fitContainer, $event.target.checked, autoCenter) ">
141
- Auto Zoom
142
- </ label > < br />
110
+ < input type ="checkbox " [checked] ="autoZoom " (change) ="toggleFitContainer(fitContainer, $event.target.checked, autoCenter) "> Auto Zoom
111
+ </ label >
112
+ < br />
143
113
< label >
144
- < input type ="checkbox " [checked] ="autoCenter " (change) ="toggleFitContainer(fitContainer, autoZoom, $event.target.checked) ">
145
- Auto Center
114
+ < input type ="checkbox " [checked] ="autoCenter " (change) ="toggleFitContainer(fitContainer, autoZoom, $event.target.checked) "> Auto Center
146
115
</ label >
147
116
</ div >
148
117
149
118
< h3 (click) ="colorVisible = !colorVisible " style ="cursor: pointer ">
150
- < span
151
- [class.arrow-down] ="colorVisible "
152
- [class.arrow-right] ="!colorVisible ">
119
+ < span [class.arrow-down] ="colorVisible " [class.arrow-right] ="!colorVisible ">
153
120
</ span >
154
121
< strong > Color Scheme</ strong >
155
122
</ h3 >
156
- < select
157
- [hidden] ="!colorVisible "
158
- style ="margin-left: 10px; "
159
- [ngModel] ="selectedColorScheme "
160
- (ngModelChange) ="setColorScheme($event) ">
123
+ < select [hidden] ="!colorVisible " style ="margin-left: 10px; " [ngModel] ="selectedColorScheme " (ngModelChange) ="setColorScheme($event) ">
161
124
< option *ngFor ="let scheme of colorSets " [value] ="scheme.name "> {{scheme.name}}</ option >
162
125
</ select >
163
126
164
127
< h3 (click) ="optsVisible = !optsVisible " style ="cursor: pointer ">
165
- < span
166
- [class.arrow-down] ="optsVisible "
167
- [class.arrow-right] ="!optsVisible ">
128
+ < span [class.arrow-down] ="optsVisible " [class.arrow-right] ="!optsVisible ">
168
129
</ span >
169
130
< strong > Options</ strong >
170
131
</ h3 >
@@ -175,21 +136,24 @@ <h3 (click)="optsVisible = !optsVisible" style="cursor: pointer">
175
136
</ select >
176
137
177
138
< label > Line Interpolation</ label >
178
- < select
179
- [ngModel] ="curveType "
180
- (ngModelChange) ="setInterpolationType($event) ">
139
+ < select [ngModel] ="curveType " (ngModelChange) ="setInterpolationType($event) ">
181
140
< option *ngFor ="let interpolationType of interpolationTypes " [value] ="interpolationType ">
182
141
{{interpolationType}}
183
142
</ option >
184
143
</ select >
185
144
186
145
< label > Pan on zoom</ label >
187
- < select
188
- [(ngModel)] ="panOnZoom ">
146
+ < select [(ngModel)] ="panOnZoom ">
189
147
< option [ngValue] ="true "> True</ option >
190
148
< option [ngValue] ="false "> False</ option >
191
149
</ select >
150
+ < br />
151
+ < br />
152
+ < button class ="btn btn-default " (click) ="center() "> Center</ button >
153
+ < button class ="btn btn-default " (click) ="zoomToFit() "> Fit in view</ button >
154
+ < button class ="btn btn-default " (click) ="updateChart() "> Update</ button >
192
155
</ div >
193
156
</ div >
157
+
194
158
</ div >
195
- </ main >
159
+ </ main >
0 commit comments