@@ -2,6 +2,7 @@ import { Component, ViewEncapsulation, ViewChild } from '@angular/core';
22import { CircularGaugeComponent } from '@syncfusion/ej2-ng-circulargauge' ;
33import { CircularGauge } from '@syncfusion/ej2-circulargauge' ;
44import { DynamicDataSerive } from './customization.service' ;
5+ import { DropDownList } from '@syncfusion/ej2-dropdowns' ;
56
67/**
78 * multiple axis in gauge
@@ -42,7 +43,76 @@ export class CustomizationComponent {
4243 animation : { duration : 0 } ,
4344 pointerWidth : 9 ,
4445 cap : { radius : 10 , color : '#424242' , border : { width : 0 } }
45- } ]
46+ } ] ;
47+ public barColor : DropDownList ; public rangeColor : DropDownList ; public pointerColor : DropDownList ;
48+ ngOnInit ( ) : void {
49+ this . barColor = new DropDownList ( {
50+ index : 0 ,
51+ width : 100 ,
52+ change : ( ) => {
53+ let barColor : string = this . barColor . value . toString ( ) ;
54+ if ( ! this . isClicked ) {
55+ if ( this . isUsage ) {
56+ this . usageGauge . axes [ 0 ] . pointers [ 0 ] . color = barColor ;
57+ this . usageGauge . refresh ( ) ;
58+ } else {
59+ this . randomGauge . axes [ 0 ] . pointers [ 0 ] . color = barColor ;
60+ this . randomGauge . refresh ( ) ;
61+ }
62+ } else {
63+ this . gauge1 . axes [ 0 ] . pointers [ 0 ] . color = barColor ;
64+ this . gauge1 . refresh ( ) ;
65+ this . randomGauge . axes [ 0 ] . pointers [ 0 ] . color = barColor ;
66+ }
67+ }
68+ } ) ;
69+ this . barColor . appendTo ( '#barColor' ) ;
70+ this . rangeColor = new DropDownList ( {
71+ index : 0 ,
72+ width : 100 ,
73+ change : ( ) => {
74+ let barColor : string = this . rangeColor . value . toString ( ) ;
75+ if ( ! this . isClicked ) {
76+ if ( this . isUsage ) {
77+ this . usageGauge . axes [ 0 ] . ranges [ 0 ] . color = barColor ;
78+ this . usageGauge . refresh ( ) ;
79+ } else {
80+ this . randomGauge . axes [ 0 ] . ranges [ 0 ] . color = barColor ;
81+ this . randomGauge . refresh ( ) ;
82+ }
83+ } else {
84+ this . gauge1 . axes [ 0 ] . ranges [ 0 ] . color = barColor ;
85+ this . gauge1 . refresh ( ) ;
86+ this . randomGauge . axes [ 0 ] . ranges [ 0 ] . color = barColor ;
87+ }
88+ }
89+ } ) ;
90+ this . rangeColor . appendTo ( '#rangeColor' ) ;
91+ this . pointerColor = new DropDownList ( {
92+ index : 0 ,
93+ width : 100 ,
94+ change : ( ) => {
95+ let barColor : string = this . pointerColor . value . toString ( ) ;
96+ if ( ! this . isClicked ) {
97+ if ( ! this . isUsage ) {
98+ this . randomGauge . axes [ 0 ] . pointers [ 1 ] . color = barColor ;
99+ this . randomGauge . axes [ 0 ] . pointers [ 1 ] . cap . border . color = barColor ;
100+ this . randomGauge . axes [ 0 ] . pointers [ 1 ] . cap . color = barColor ;
101+ this . randomGauge . refresh ( ) ;
102+ }
103+ } else {
104+ this . gauge1 . axes [ 0 ] . pointers [ 1 ] . color = barColor ;
105+ this . gauge1 . axes [ 0 ] . pointers [ 1 ] . cap . border . color = barColor ;
106+ this . gauge1 . axes [ 0 ] . pointers [ 1 ] . cap . color = barColor ;
107+ this . gauge1 . refresh ( ) ;
108+ this . randomGauge . axes [ 0 ] . pointers [ 1 ] . color = barColor ;
109+ this . randomGauge . axes [ 0 ] . pointers [ 1 ] . cap . border . color = barColor ;
110+ this . randomGauge . axes [ 0 ] . pointers [ 1 ] . cap . color = barColor ;
111+ }
112+ }
113+ } ) ;
114+ this . pointerColor . appendTo ( '#pointerColor' ) ;
115+ }
46116 ngAfterViewInit ( ) : void {
47117 document . getElementById ( 'usage' ) . onclick = ( ) => {
48118 if ( this . isClicked ) {
@@ -54,19 +124,16 @@ export class CustomizationComponent {
54124 this . usageGauge . appendTo ( '#customization-container' ) ;
55125 this . isUsage = true ;
56126 let element : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'currentValue' ) ;
57- let barElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'barColor' ) ;
58- let rangeElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'rangeColor' ) ;
59- let pointerElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'pointerColor' ) ;
60127 let pointElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'pointColor' ) ;
61128 element . min = '0.5' ;
62129 element . max = '100' ;
63130 element . value = this . usageGauge . axes [ 0 ] . pointers [ 0 ] . value . toString ( ) ;
64131 document . getElementById ( 'currentPointerValue' ) . innerHTML = ' Current Value <span> '
65132 + this . usageGauge . axes [ 0 ] . pointers [ 0 ] . value + '</span>' ;
66- barElement . value = this . usageGauge . axes [ 0 ] . pointers [ 0 ] . color ;
67- rangeElement . value = this . usageGauge . axes [ 0 ] . ranges [ 0 ] . color ;
68- pointerElement . style . visibility = 'hidden' ;
69- pointElement . style . visibility = 'hidden ' ;
133+ this . barColor . value = this . usageGauge . axes [ 0 ] . pointers [ 0 ] . color ;
134+ this . rangeColor . value = this . usageGauge . axes [ 0 ] . ranges [ 0 ] . color ;
135+ this . pointerColor . enabled = false ;
136+ pointElement . className = 'e-disabled ' ;
70137 let currentElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'usage' ) ;
71138 let existElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'random' ) ;
72139 currentElement . style . border = '2px solid #E0E0E0' ;
@@ -86,20 +153,17 @@ export class CustomizationComponent {
86153 currentElement . style . border = '2px solid #E0E0E0' ;
87154 existElement . style . border = '' ;
88155 let element : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'currentValue' ) ;
89- let barElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'barColor' ) ;
90- let rangeElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'rangeColor' ) ;
91- let pointerElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'pointerColor' ) ;
92156 let pointElement : HTMLSelectElement = < HTMLSelectElement > document . getElementById ( 'pointColor' ) ;
93- pointerElement . style . visibility = 'visible ' ;
94- pointElement . style . visibility = 'visible' ;
157+ pointElement . className = 'e-enabled ' ;
158+ this . pointerColor . enabled = true ;
95159 element . min = '1000' ;
96160 element . max = '2000' ;
97161 element . value = this . randomGauge . axes [ 0 ] . pointers [ 0 ] . value . toString ( ) ;
98162 document . getElementById ( 'currentPointerValue' ) . innerHTML = 'Current Value <span> ' +
99163 this . randomGauge . axes [ 0 ] . pointers [ 0 ] . value + '</span>' ;
100- barElement . value = this . randomGauge . axes [ 0 ] . pointers [ 0 ] . color ;
101- rangeElement . value = this . randomGauge . axes [ 0 ] . ranges [ 0 ] . color ;
102- pointerElement . value = this . randomGauge . axes [ 0 ] . pointers [ 1 ] . color ;
164+ this . barColor . value = this . randomGauge . axes [ 0 ] . pointers [ 0 ] . color ;
165+ this . rangeColor . value = this . randomGauge . axes [ 0 ] . ranges [ 0 ] . color ;
166+ this . pointerColor . value = this . randomGauge . axes [ 0 ] . pointers [ 1 ] . color ;
103167 } ;
104168
105169 document . getElementById ( 'currentValue' ) . onpointermove = document . getElementById ( 'currentValue' ) . ontouchmove =
@@ -125,59 +189,10 @@ export class CustomizationComponent {
125189 document . getElementById ( 'currentPointerValue' ) . innerHTML = 'Current Value <span> ' + value + '</span>' ;
126190 } ;
127191
128- document . getElementById ( 'barColor' ) . onchange = ( ) => {
129- let barColor : string = ( < HTMLInputElement > document . getElementById ( 'barColor' ) ) . value ;
130- if ( ! this . isClicked ) {
131- if ( this . isUsage ) {
132- this . usageGauge . axes [ 0 ] . pointers [ 0 ] . color = barColor ;
133- this . usageGauge . refresh ( ) ;
134- } else {
135- this . randomGauge . axes [ 0 ] . pointers [ 0 ] . color = barColor ;
136- this . randomGauge . refresh ( ) ;
137- }
138- } else {
139- this . gauge1 . axes [ 0 ] . pointers [ 0 ] . color = barColor ;
140- this . gauge1 . refresh ( ) ;
141- this . randomGauge . axes [ 0 ] . pointers [ 0 ] . color = barColor ;
142- }
143- } ;
144-
145- document . getElementById ( 'rangeColor' ) . onchange = ( ) => {
146- let barColor : string = ( < HTMLInputElement > document . getElementById ( 'rangeColor' ) ) . value ;
147- if ( ! this . isClicked ) {
148- if ( this . isUsage ) {
149- this . usageGauge . axes [ 0 ] . ranges [ 0 ] . color = barColor ;
150- this . usageGauge . refresh ( ) ;
151- } else {
152- this . randomGauge . axes [ 0 ] . ranges [ 0 ] . color = barColor ;
153- this . randomGauge . refresh ( ) ;
154- }
155- } else {
156- this . gauge1 . axes [ 0 ] . ranges [ 0 ] . color = barColor ;
157- this . gauge1 . refresh ( ) ;
158- this . randomGauge . axes [ 0 ] . ranges [ 0 ] . color = barColor ;
159- }
160- } ;
192+
161193
162- document . getElementById ( 'pointerColor' ) . onchange = ( ) => {
163- let barColor : string = ( < HTMLInputElement > document . getElementById ( 'pointerColor' ) ) . value ;
164- if ( ! this . isClicked ) {
165- if ( ! this . isUsage ) {
166- this . randomGauge . axes [ 0 ] . pointers [ 1 ] . color = barColor ;
167- this . randomGauge . axes [ 0 ] . pointers [ 1 ] . cap . border . color = barColor ;
168- this . randomGauge . axes [ 0 ] . pointers [ 1 ] . cap . color = barColor ;
169- this . randomGauge . refresh ( ) ;
170- }
171- } else {
172- this . gauge1 . axes [ 0 ] . pointers [ 1 ] . color = barColor ;
173- this . gauge1 . axes [ 0 ] . pointers [ 1 ] . cap . border . color = barColor ;
174- this . gauge1 . axes [ 0 ] . pointers [ 1 ] . cap . color = barColor ;
175- this . gauge1 . refresh ( ) ;
176- this . randomGauge . axes [ 0 ] . pointers [ 1 ] . color = barColor ;
177- this . randomGauge . axes [ 0 ] . pointers [ 1 ] . cap . border . color = barColor ;
178- this . randomGauge . axes [ 0 ] . pointers [ 1 ] . cap . color = barColor ;
179- }
180- } ;
194+
195+
181196 }
182197 constructor ( ) {
183198 // code
0 commit comments