realchart 1.3.18 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/gauge.d.ts CHANGED
@@ -3,7 +3,7 @@ import { CircularGauge, CircleGaugeOptions, ChartItemOptions, GaugeRangeBand, IC
3
3
 
4
4
  /**
5
5
  * 원형게이지 테두리(rim) 모델 기반 클래스<br/>
6
- * {@page options} 모델은 {@page op.CircleGaugeRimBaseOptions}이다.
6
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/CircleGaugeRimBaseOptions CircleGaugeRimBaseOptions}이다.
7
7
  */
8
8
  declare abstract class CircleGaugeRimBase<OP extends CircleGaugeRimBaseOptions = CircleGaugeRimBaseOptions> extends GaugeItem<OP> {
9
9
  static defaults: CircleGaugeRimBaseOptions;
@@ -13,12 +13,12 @@ declare abstract class CircleGaugeRimBase<OP extends CircleGaugeRimBaseOptions =
13
13
  minValue?: number;
14
14
  maxValue?: number;
15
15
  }, value: number): ValueRange | undefined;
16
- protected _doApply(options: CircleGaugeRimBaseOptions): void;
16
+ protected _doApply(options: OP): void;
17
17
  private $_internalRanges;
18
18
  }
19
19
  /**
20
20
  * 원형게이지 테두리(rim) 모델.<br/>
21
- * {@page options} 모델은 {@page op.CircleGaugeRimOptions}이다.
21
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/CircleGaugeRimOptions CircleGaugeRimOptions}이다.
22
22
  */
23
23
  declare class CircleGaugeRim extends CircleGaugeRimBase<CircleGaugeRimOptions> {
24
24
  static defaults: CircleGaugeRimOptions;
@@ -28,7 +28,7 @@ declare class CircleGaugeRim extends CircleGaugeRimBase<CircleGaugeRimOptions> {
28
28
  }
29
29
  /**
30
30
  * 값을 표시하는 테두리(rim) 모델.<br/>
31
- * {@page options} 모델은 {@page op.CircleGaugeValueRimOptions}이다.
31
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/CircleGaugeValueRimOptions CircleGaugeValueRimOptions}이다.
32
32
  */
33
33
  declare class CircleGaugeValueRim extends CircleGaugeRimBase<CircleGaugeValueRimOptions> {
34
34
  static defaults: CircleGaugeValueRimOptions;
@@ -38,7 +38,7 @@ declare class CircleGaugeValueRim extends CircleGaugeRimBase<CircleGaugeValueRim
38
38
  }
39
39
  /**
40
40
  * 원형게이지 침(hand) 모델.<br/>
41
- * {@page options} 모델은 {@page op.CircleGaugeHandOptions}이다.
41
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/CircleGaugeHandOptions CircleGaugeHandOptions}이다.
42
42
  */
43
43
  declare class CircleGaugeHand extends GaugeItem<CircleGaugeHandOptions> {
44
44
  static defaults: CircleGaugeHandOptions;
@@ -54,7 +54,7 @@ declare class CircleGaugeHand extends GaugeItem<CircleGaugeHandOptions> {
54
54
  }
55
55
  /**
56
56
  * 원형게이지 핀 모델.<br/>
57
- * {@page options} 모델은 {@page op.CircleGaugePinOptions}이다.
57
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/CircleGaugePinOptions CircleGaugePinOptions}이다.
58
58
  */
59
59
  declare class CircleGaugePin extends GaugeItem<CircleGaugePinOptions> {
60
60
  static defaults: CircleGaugePinOptions;
@@ -64,7 +64,7 @@ declare class CircleGaugePin extends GaugeItem<CircleGaugePinOptions> {
64
64
  }
65
65
  /**
66
66
  * 원형게이지 자(scale) 모델.<br/>
67
- * {@page options} 모델은 {@page op.CircleGaugeScaleOptions}이다.
67
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/CircleGaugeScaleOptions CircleGaugeScaleOptions}이다.
68
68
  */
69
69
  declare class CircleGaugeScale extends GaugeScale<CircleGaugeScaleOptions> {
70
70
  static defaults: CircleGaugeScaleOptions;
@@ -72,8 +72,8 @@ declare class CircleGaugeScale extends GaugeScale<CircleGaugeScaleOptions> {
72
72
  }
73
73
  /**
74
74
  * 원형 게이지 모델.<br/>
75
- * {@page op.GaugeOptions#type}은 **'circle'** 이고,
76
- * {@page options 설정} 모델은 {@page op.CircleGaugeOptions}이다.
75
+ * {@link https://realchart.co.kr/docs/api/options/GaugeOptions#type type}은 **'circle'** 이고,
76
+ * {@link options 설정} 모델은 {@link https://realchart.co.kr/docs/api/options/CircleGaugeOptions CircleGaugeOptions}이다.
77
77
  *
78
78
  * @modules gauge
79
79
  */
@@ -116,8 +116,8 @@ declare class CircleGauge extends CircularGauge<CircleGaugeOptions> {
116
116
  }
117
117
 
118
118
  /**
119
- * {@page LinearGauge} 스케일 모델.<br/>
120
- * {@page options} 모델은 {@page op.LinearGaugeScaleOptions}이다.<br/>
119
+ * {@link LinearGauge} 스케일 모델.<br/>
120
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/LinearGaugeScaleOptions LinearGaugeScaleOptions}이다.<br/>
121
121
  */
122
122
  declare class LinearGaugeScale extends GaugeScale<LinearGaugeScaleOptions> {
123
123
  _vertical: boolean;
@@ -125,7 +125,7 @@ declare class LinearGaugeScale extends GaugeScale<LinearGaugeScaleOptions> {
125
125
  }
126
126
  /**
127
127
  * 선형게이지 라벨 모델.<br/>
128
- * {@page options} 모델은 {@page op.LinearGaugeLabelOptions}이다.
128
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/LinearGaugeLabelOptions LinearGaugeLabelOptions}이다.
129
129
  */
130
130
  declare class LinearGaugeLabel<OP extends LinearGaugeLabelOptions = LinearGaugeLabelOptions> extends GaugeLabel<OP> {
131
131
  static defaults: LinearGaugeLabelOptions;
@@ -142,29 +142,27 @@ declare class LinearGaugeLabel<OP extends LinearGaugeLabelOptions = LinearGaugeL
142
142
  getMaxWidth(domain: number): number;
143
143
  getMaxHeight(domain: number): number;
144
144
  getGap(domain: number): number;
145
- protected _doApply(options: LinearGaugeLabelOptions): void;
145
+ protected _doApply(options: OP): void;
146
146
  }
147
147
  /**
148
148
  * 선형 게이지 모델들의 기반 클래스.<br/>
149
- * {@page options} 모델은 {@page op.LinearGaugeBaseOptions}이다.
149
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/LinearGaugeBaseOptions LinearGaugeBaseOptions}이다.
150
150
  */
151
151
  declare abstract class LinearGaugeBase<OP extends LinearGaugeBaseOptions = LinearGaugeBaseOptions> extends ValueGauge<OP> {
152
152
  static defaults: LinearGaugeBaseOptions;
153
153
  private _label;
154
154
  private _scale;
155
- protected _doInitChildren(op: {
156
- [child: string]: ChartItemOptions;
157
- }): void;
155
+ protected _doInitChildren(op: OP): void;
158
156
  /**
159
157
  * label 설정 모델.
160
158
  *
161
- * @config
159
+ *
162
160
  */
163
161
  get label(): LinearGaugeLabel<LinearGaugeLabelOptions>;
164
162
  /**
165
163
  * scale.
166
164
  *
167
- * @config
165
+ *
168
166
  */
169
167
  get scale(): LinearGaugeScale;
170
168
  isVertical(): boolean;
@@ -174,7 +172,7 @@ declare abstract class LinearGaugeBase<OP extends LinearGaugeBaseOptions = Linea
174
172
  }
175
173
  /**
176
174
  * linear 게이지의 값을 표시하는 영역에 대한 설정 모델.<br/>
177
- * {@page options} 모델은 {@page op.LinearValueBarOptions}이다.
175
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/LinearValueBarOptions LinearValueBarOptions}이다.
178
176
  */
179
177
  declare class LinearValueBar<OP extends LinearValueBarOptions = LinearValueBarOptions> extends GaugeItem<OP> {
180
178
  private _args;
@@ -182,8 +180,8 @@ declare class LinearValueBar<OP extends LinearValueBarOptions = LinearValueBarOp
182
180
  }
183
181
  /**
184
182
  * 선형 게이지 모델.<br/>
185
- * {@page op.GaugeOptions#type}은 **'linear'** 이고,
186
- * {@page options 설정} 모델은 {@page op.LinearGaugeOptions}이다.
183
+ * {@link https://realchart.co.kr/docs/api/options/GaugeOptions#type type}은 **'linear'** 이고,
184
+ * {@link options 설정} 모델은 {@link https://realchart.co.kr/docs/api/options/LinearGaugeOptions LinearGaugeOptions}이다.
187
185
  *
188
186
  * @modules gauge
189
187
  */
@@ -201,27 +199,27 @@ declare class LinearGauge extends LinearGaugeBase<LinearGaugeOptions> {
201
199
  /**
202
200
  * 게이지 본체 주변이나 내부에 값 영역들을 구분해서 표시하는 band의 모델.
203
201
  *
204
- * @config
202
+ *
205
203
  */
206
204
  get band(): GaugeRangeBand;
207
205
  }
208
206
  /**
209
207
  * 선형 그룹게이지의 자식 라벨 모델.<br/>
210
- * {@page options} 모델은 {@page op.LinearGaugeChildLabelOptions}이다.
208
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/LinearGaugeChildLabelOptions LinearGaugeChildLabelOptions}이다.
211
209
  */
212
210
  declare class LinearGaugeChildLabel extends ChartItem<LinearGaugeChildLabelOptions> {
213
211
  static defaults: LinearGaugeChildLabelOptions;
214
212
  }
215
213
  /**
216
214
  * 선형 그룹게이지의 그룹 라벨 모델.<br/>
217
- * {@page options} 모델은 {@page op.LinearGaugeGroupLabelOptions}이다.
215
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/LinearGaugeGroupLabelOptions LinearGaugeGroupLabelOptions}이다.
218
216
  */
219
217
  declare class LinearGaugeGroupLabel extends LinearGaugeLabel<LinearGaugeGroupLabelOptions> {
220
218
  static defaults: LinearGaugeGroupLabelOptions;
221
219
  }
222
220
  /**
223
221
  * 선형 그룹게이지 모델들의 기반 클래스.<br/>
224
- * {@page options} 모델은 {@page op.LinearGaugeGroupBaseOptions}이다.
222
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/LinearGaugeGroupBaseOptions LinearGaugeGroupBaseOptions}이다.
225
223
  */
226
224
  declare abstract class LinearGaugeGroupBase<T extends LinearGaugeBase = LinearGaugeBase, OP extends LinearGaugeGroupBaseOptions<LinearGaugeBaseOptions> = LinearGaugeGroupBaseOptions<LinearGaugeBaseOptions>> extends GaugeGroup<T, OP> {
227
225
  static defaults: LinearGaugeGroupBaseOptions<LinearGaugeBaseOptions>;
@@ -230,25 +228,23 @@ declare abstract class LinearGaugeGroupBase<T extends LinearGaugeBase = LinearGa
230
228
  private _scale;
231
229
  _labelWidth: number;
232
230
  _labelHeight: number;
233
- protected _doInitChildren(op: {
234
- [child: string]: ChartItemOptions;
235
- }): void;
231
+ protected _doInitChildren(op: OP): void;
236
232
  /**
237
233
  * label 설정 모델.
238
234
  *
239
- * @config
235
+ *
240
236
  */
241
237
  get label(): LinearGaugeGroupLabel;
242
238
  /**
243
239
  * 자식 게이지들의 label 표시 관련 속성 모델.
244
240
  *
245
- * @config
241
+ *
246
242
  */
247
243
  get itemLabel(): LinearGaugeChildLabel;
248
244
  /**
249
245
  * scale.
250
246
  *
251
- * @config
247
+ *
252
248
  */
253
249
  get scale(): LinearGaugeScale;
254
250
  calcedMinMax(): IMinMax;
@@ -256,7 +252,7 @@ declare abstract class LinearGaugeGroupBase<T extends LinearGaugeBase = LinearGa
256
252
 
257
253
  /**
258
254
  * Bullet 게이지 밴드 모델.<br/>
259
- * {@page options} 모델은 {@page op.BulletGaugeBandOptions}이다.
255
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/BulletGaugeBandOptions BulletGaugeBandOptions}이다.
260
256
  */
261
257
  declare class BulletGaugeBand extends ChartItem<BulletGaugeBandOptions> {
262
258
  gauge: BulletGauge | BulletGaugeGroup;
@@ -268,7 +264,7 @@ declare class BulletGaugeBand extends ChartItem<BulletGaugeBandOptions> {
268
264
  * 값 범위 목록을 리턴한다.<br/>
269
265
  * 범위별로 다른 스타일을 적용할 수 있다.
270
266
  *
271
- * @config
267
+ *
272
268
  */
273
269
  getRanges(): ValueRange[];
274
270
  protected _doApply(options: BulletGaugeBandOptions): void;
@@ -276,21 +272,21 @@ declare class BulletGaugeBand extends ChartItem<BulletGaugeBandOptions> {
276
272
  }
277
273
  /**
278
274
  * Bullet 게이지 목표 bar 모델.<br/>
279
- * {@page options} 모델은 {@page op.BulletTargetBarOptions}이다.
275
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/BulletTargetBarOptions BulletTargetBarOptions}이다.
280
276
  */
281
277
  declare class BulletTargetBar extends GaugeItem<BulletTargetBarOptions> {
282
278
  static defaults: BulletTargetBarOptions;
283
279
  }
284
280
  /**
285
281
  * Bullet 게이지 값 bar 모델.<br/>
286
- * {@page options} 모델은 {@page op.BulletValueBarOptions}이다.
282
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/BulletValueBarOptions BulletValueBarOptions}이다.
287
283
  */
288
284
  declare class BulletValueBar extends LinearValueBar<BulletValueBarOptions> {
289
285
  }
290
286
  /**
291
287
  * Bullet 게이지 모델.<br/>
292
- * {@page op.GaugeOptions#type}은 {@page config.gauge.bullet 'bullet'}이고,
293
- * {@page options 설정} 모델은 {@page op.BulletGaugeOptions}이다.
288
+ * {@link https://realchart.co.kr/docs/api/options/GaugeOptions#type type}은 {@link https://realchart.co.kr/config/config/gauge/bullet bullet}이고,
289
+ * {@link options 설정} 모델은 {@link https://realchart.co.kr/docs/api/options/BulletGaugeOptions BulletGaugeOptions}이다.
294
290
  *
295
291
  * @modules gauge
296
292
  */
@@ -306,27 +302,27 @@ declare class BulletGauge extends LinearGaugeBase<BulletGaugeOptions> {
306
302
  /**
307
303
  * 밴드.
308
304
  *
309
- * @config
305
+ *
310
306
  */
311
307
  get band(): BulletGaugeBand;
312
308
  /**
313
309
  * target bar.
314
310
  *
315
- * @config
311
+ *
316
312
  */
317
313
  get targetBar(): BulletTargetBar;
318
314
  /**
319
315
  * value bar.
320
316
  *
321
- * @config
317
+ *
322
318
  */
323
319
  get valueBar(): BulletValueBar;
324
320
  getRanges(min: number, max: number, inclusive: boolean): ValueRange[];
325
321
  }
326
322
  /**
327
323
  * Bullet 게이지그룹 모델.<br/>
328
- * {@page op.GaugeOptions#type}은 {@page config.gauge.bulletgroup 'bulletgroup'}이고,
329
- * {@page options} 모델은 {@page op.BulletGaugeGroupOptions}이다.
324
+ * {@link https://realchart.co.kr/docs/api/options/GaugeOptions#type type}은 {@link https://realchart.co.kr/config/config/gauge/bulletgroup bulletgroup}이고,
325
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/BulletGaugeGroupOptions BulletGaugeGroupOptions}이다.
330
326
  *
331
327
  * @modules gauge
332
328
  */
@@ -340,7 +336,7 @@ declare class BulletGaugeGroup extends LinearGaugeGroupBase<BulletGauge, BulletG
340
336
 
341
337
  /**
342
338
  * Clock 게이지 테두리(rim) 설정 모델.<br/>
343
- * {@page options} 모델은 {@page op.ClockGaugeRimOptions}이다.
339
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/ClockGaugeRimOptions ClockGaugeRimOptions}이다.
344
340
  */
345
341
  declare class ClockGaugeRim extends GaugeItem<ClockGaugeRimOptions> {
346
342
  static defaults: ClockGaugeRimOptions;
@@ -350,31 +346,31 @@ declare class ClockGaugeRim extends GaugeItem<ClockGaugeRimOptions> {
350
346
  }
351
347
  /**
352
348
  * Clock 게이지 시/분침(hand) 설정 모델.<br/>
353
- * {@page options} 모델은 {@page op.ClockGaugeHandOptions}이다.
349
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/ClockGaugeHandOptions ClockGaugeHandOptions}이다.
354
350
  */
355
351
  declare class ClockGaugeHand<OP extends ClockGaugeHandOptions = ClockGaugeHandOptions> extends GaugeItem<OP> {
356
352
  static defaults: ClockGaugeHandOptions;
357
353
  private _lengthDim;
358
354
  getLength(domain: number): number;
359
- protected _doApply(options: ClockGaugeHandOptions): void;
355
+ protected _doApply(options: OP): void;
360
356
  }
361
357
  /**
362
358
  * Clock 게이지 분침 모델.<br/>
363
- * {@page options} 모델은 {@page op.ClockGaugeHandOptions}이다.
359
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/ClockGaugeHandOptions ClockGaugeHandOptions}이다.
364
360
  */
365
361
  declare class ClockGaugeMinuteHand extends ClockGaugeHand<ClockGaugeHandOptions> {
366
362
  static defaults: ClockGaugeHandOptions;
367
363
  }
368
364
  /**
369
365
  * Clock 게이지 초침(hand) 설정 모델.<br/>
370
- * {@page options} 모델은 {@page op.ClockGaugeSecondHandOptions}이다.
366
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/ClockGaugeSecondHandOptions ClockGaugeSecondHandOptions}이다.
371
367
  */
372
368
  declare class ClockGaugeSecondHand extends ClockGaugeHand<ClockGaugeSecondHandOptions> {
373
369
  static defaults: ClockGaugeSecondHandOptions;
374
370
  }
375
371
  /**
376
372
  * Clock 게이지 tick 설정 모델.<br/>
377
- * {@page options} 모델은 {@page op.ClockGaugeTickOptions}이다.
373
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/ClockGaugeTickOptions ClockGaugeTickOptions}이다.
378
374
  */
379
375
  declare class ClockGaugeTick extends GaugeItem<ClockGaugeTickOptions> {
380
376
  length: number;
@@ -382,14 +378,14 @@ declare class ClockGaugeTick extends GaugeItem<ClockGaugeTickOptions> {
382
378
  }
383
379
  /**
384
380
  * Clock 게이지 tick 라벨 설정 모델.<br/>
385
- * {@page options} 모델은 {@page op.ClockGaugeTickLabelOptions}이다.
381
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/ClockGaugeTickLabelOptions ClockGaugeTickLabelOptions}이다.
386
382
  */
387
383
  declare class ClockGaugeTickLabel extends GaugeItem<ClockGaugeTickLabelOptions> {
388
384
  static defaults: ClockGaugeTickLabelOptions;
389
385
  }
390
386
  /**
391
387
  * Clock 게이지 중심 pin 설정 모델.<br/>
392
- * {@page options} 모델은 {@page op.ClockGaugePinOptions}이다.
388
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/ClockGaugePinOptions ClockGaugePinOptions}이다.
393
389
  */
394
390
  declare class ClockGaugePin extends GaugeItem<ClockGaugePinOptions> {
395
391
  raidus: number;
@@ -397,7 +393,7 @@ declare class ClockGaugePin extends GaugeItem<ClockGaugePinOptions> {
397
393
  }
398
394
  /**
399
395
  * Clock 게이지 내부에 표시되는 라벨 설정 모델.<br/>
400
- * {@page options} 모델은 {@page op.ClockGaugeLabelOptions}이다.
396
+ * {@link options} 모델은 {@link https://realchart.co.kr/docs/api/options/ClockGaugeLabelOptions ClockGaugeLabelOptions}이다.
401
397
  */
402
398
  declare class ClockGaugeLabel extends ChartText<ClockGaugeLabelOptions> {
403
399
  static defaults: ClockGaugeLabelOptions;
@@ -405,8 +401,8 @@ declare class ClockGaugeLabel extends ChartText<ClockGaugeLabelOptions> {
405
401
  }
406
402
  /**
407
403
  * 시계 게이지 모델.<br/>
408
- * {@page op.GaugeOptions#type}은 **'clock'** 이고,
409
- * {@page options 설정} 모델은 {@page op.ClockGaugeOptions}이다.
404
+ * {@link https://realchart.co.kr/docs/api/options/GaugeOptions#type type}은 **'clock'** 이고,
405
+ * {@link options 설정} 모델은 {@link https://realchart.co.kr/docs/api/options/ClockGaugeOptions ClockGaugeOptions}이다.
410
406
  *
411
407
  * @modules gauge
412
408
  */
@@ -425,55 +421,55 @@ declare class ClockGauge extends Gauge<ClockGaugeOptions> {
425
421
  /**
426
422
  * rim 설정 모델.
427
423
  *
428
- * @config
424
+ *
429
425
  */
430
426
  rim: ClockGaugeRim;
431
427
  /**
432
428
  * 시침 설정 모델.
433
429
  *
434
- * @config
430
+ *
435
431
  */
436
432
  hourHand: ClockGaugeHand;
437
433
  /**
438
434
  * 분침 설정 모델.
439
435
  *
440
- * @config
436
+ *
441
437
  */
442
438
  minuteHand: ClockGaugeMinuteHand;
443
439
  /**
444
440
  * 초침 설정 모델.
445
441
  *
446
- * @config
442
+ *
447
443
  */
448
444
  secondHand: ClockGaugeSecondHand;
449
445
  /**
450
446
  * main tick.
451
447
  *
452
- * @config
448
+ *
453
449
  */
454
450
  tick: ClockGaugeTick;
455
451
  /**
456
452
  * minor tick
457
453
  *
458
- * @config
454
+ *
459
455
  */
460
456
  minorTick: ClockGaugeTick;
461
457
  /**
462
458
  * tick label
463
459
  *
464
- * @config
460
+ *
465
461
  */
466
462
  tickLabel: ClockGaugeTickLabel;
467
463
  /**
468
464
  * pin
469
465
  *
470
- * @config
466
+ *
471
467
  */
472
468
  pin: ClockGaugePin;
473
469
  /**
474
470
  * label
475
471
  *
476
- * @config
472
+ *
477
473
  */
478
474
  label: ClockGaugeLabel;
479
475
  getTime(): Date;
package/gauge.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealChart Gauge v1.3.18
3
+ * RealChart Gauge v1.4.1
4
4
  * Copyright (C) 2023-2025 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealChartGauge={},e.RealChart)}(this,(function(e,t){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var s=i(t);class a extends t.GaugeItem{getRange(e,t){const i=this.$_internalRanges(e);if(i)for(const e of i)if(t>=e.fromValue&&t<e.toValue)return e}_doApply(e){const t=this;var i;super._doApply(e),(i=e.ranges)!==t._ranges&&(t._ranges=i,t._runRanges=null)}$_internalRanges(e){return this._runRanges||(this._runRanges=t.buildValueRanges(this._ranges,e.minValue,e.maxValue,this._op.rangeInclusive)),this._runRanges}}a.defaults=t.extend(t.ChartItem.defaults,{rangeInclusive:!0});class n extends a{getSegmentThickness(e){return t.calcPercent(this._segmentThicknessDim,e,e)}_doApply(e){super._doApply(e),this._setDim(e,"segmentThickness")}}n.defaults=t.extend(a.defaults,{segmentGap:0});class l extends a{getThickness(e){return t.calcPercent(this._thicknessDim,e,e)}_doApply(e){super._doApply(e),this._setDim(e,"thickness")}}l.defaults=t.extend(a.defaults,{thickness:"100%",stroked:!1});class r extends t.GaugeItem{}r.defaults=t.extend(t.ChartItem.defaults,{visible:!1});class h extends t.GaugeItem{getExtents(e){return{radius:t.calcPercent(this._radiusDim,e,0),length:t.calcPercent(this._lengthDim,e,0),offset:t.calcPercent(this._offsetDim,e,0)}}_doApply(e){super._doApply(e),this._setDims(e,"radius","length","offset")}}h.defaults=t.extend(t.ChartItem.defaults,{visible:!1,radius:3,length:"100%",offset:0});class o extends t.GaugeItem{getRadius(e){return t.calcPercent(this._radiusDim,e,0)}_doApply(e){super._doApply(e),this._setDim(e,"radius")}}o.defaults=t.extend(t.ChartItem.defaults,{visible:!1,radius:5});class c extends t.GaugeScale{_getStepMultiples(e){return[1,2,2.5,5,10]}}c.defaults=t.extend(t.GaugeScale.defaults,{visible:!1,stepPixels:72});class d extends t.CircularGauge{_doInitChildren(e){super._doInitChildren(e),e.band=(this._band=new t.GaugeRangeBand(this)).init(),e.scale=(this._scale=new c(this)).init(),e.rim=(this._rim=new n(this)).init(),e.valueRim=(this._valueRim=new l(this)).init(),e.hand=(this._hand=new h(this)).init(),e.pin=(this._pin=new o(this)).init()}get band(){return this._band}get scale(){return this._scale}get rim(){return this._rim}get valueRim(){return this._valueRim}get hand(){return this._hand}get pin(){return this._pin}getExtents(e){const i=super.getExtents(e),s=this.scale,a=this.band;let n=i.radius;const l=n-i.inner;if(a.visible)switch(i.bandThick=a.getThickness(l),a.options.position){case"inside":i.band=n-(l-i.bandThick)/2;break;case"opposite":i.band=i.inner-a.options.gap,i.inner=i.band-i.bandThick;break;default:i.band=n+=i.bandThick+a.options.gap}if(i.scaleTick=t.maxv(1,s.tick.options.length||0),i.scaleLabel=16,"opposite"===s.options.position)i.scale=i.inner-s.options.gap,i.inner=i.scale-i.scaleTick-i.scaleLabel;else i.scale=n+s.options.gap;return i}}d.type=t.CircleGaugeType;class u extends t.CircularGaugeGroup{_gaugesType(){return"circle"}}u.type=t.CircleGaugeGroupType,u.gaugeType=t.CircleGaugeType,u.defaults=t.extend(t.CircularGaugeGroup.defaults,{innerRadius:"50%"});class _ extends t.ValueGaugeView{}class g extends t.ScaleView{setExtents(e,t){this._center=e,this._exts=t}_createLine(e,i){return new t.ArcElement(e,i)}_doMeasure(e,t,i,s,a){const n=t._steps.length-(360===t.gauge.options.sweepAngle?1:0);return this._line.setVis(t.line.visible)&&this._line.internalSetStyleOrClass(t.line._style),this._tickContainer.setVis(t.tick.visible)&&(this._tickContainer.internalSetStyleOrClass(t.tick._style),this._ticks.prepare(n)),this._labelContainer.setVis(t.label.visible)&&(this._labelContainer.internalSetStyleOrClass(t.label._style),this._labels.prepare(n,(e=>{}))),{width:i,height:s}}_doLayout(e){const i=this.model,s=i._steps,a=i.gauge,n=a.options,l="opposite"===i.options.position?-1:1,r=a._props,h=this._center.x,o=this._center.y,c=this._exts.scale,d=c+this.model.tick.options.length*l,u=r._sweepRad,_=r._startRad,g=n.maxValue-n.minValue,p=n.clockwise;let b,w,m,x;if(this._line.visible&&this._line.setArc(h,o,c,_,p?u:-u,p),this._tickContainer.visible&&this._ticks.forEach(((e,a,n)=>{const l=i.getRate(s[a])*(p?u:-u)+_;b=h+t.cos(l)*c,w=o+t.sin(l)*c,m=h+t.cos(l)*d,x=o+t.sin(l)*d,e.setLine(b,w,m,x)})),this._labelContainer.visible){this._labels.get(0).setText(String(n.maxValue));const e=d+.2*this._labels.get(0).getBBox().height*l;this._labels.forEach(((a,r,c)=>{const d=i.getRate(s[r])*(p?u:-u)+_;a.setText(String(t.fixnum(n.minValue+i.getRate(s[r])*g)));const b=a.getBBox();m=h+t.cos(d)*(e+b.width/2*l)-b.width/2,x=o+t.sin(d)*(e+b.height/2*l)-b.height/2,a.trans(m,x)}))}}}let p=class extends t.ChartElement{constructor(e){super(e,"rct-circle-gauge-band"),this._sectorViews=new t.ElementPool(this,t.SectorElement),this.add(this._labelContainer=new t.LayerElement(e,"rct-circle-gauge-band-tick-labels")),this._labels=new t.ElementPool(this._labelContainer,t.TextElement)}setExtends(e,t){this._center=e,this._exts=t}_doLayout(e){const t=this.model,i=t.gauge,s=i.scale,a=i._props,n=this._center.x,l=this._center.y,r=this._exts.band,h=i.options.clockwise,o=1-this._exts.bandThick/r,c=t.getRanges(),d=a._sweepRad;i.options.maxValue,i.options.minValue;let u=a._startRad;this._sectorViews.prepare(c.length).forEach(((e,t)=>{const i=s.getRate(c[t].toValue-c[t].fromValue)*d;e.setSector({cx:n,cy:l,rx:r,ry:r,innerRadius:o,start:u,angle:i,clockwise:h}),e.internalClearStyleAndClass(),e.setFill(c[t].color),c[t].style&&e.addStyleOrClass(c[t].style),u+=h?i:-i}))}};class b extends t.PathElement{render(e,i){const s=e.getRadius(i);return s!==this._radius&&(this._radius=s,this.setPath((new t.PathBuilder).circle(0,0,s).end())),this.internalSetStyleOrClass(e._style),this}}class w extends t.PathElement{render(e,i){const s=e.getExtents(i);if(s.radius!==this._radius||s.length!==this._length||s.offset!==this._offset){const e=this._radius=s.radius,i=this._offset=s.offset;if(this._length=s.length,this._radius>0&&this._length>0){const s=new t.PathBuilder;s.move(-e,i).line(0,-this._length+i).line(e,i),this.setPath(s.end())}else this.setPath("")}return this.internalSetStyleOrClass(e._style),this}}class m extends _{constructor(e){super(e,"rct-circle-gauge")}_doInitContents(e,i){i.add(this._rimView=new t.SectorElement(e,"rct-circle-gauge-rim")),i.add(this._valueView=new t.SectorElement(e,"rct-circle-gauge-value")),i.add(this._innerView=new t.SectorElement(e,"rct-circle-gauge-inner")),i.add(this._textView=new t.TextElement(e,"rct-circle-gauge-label")),i.add(this._handContainer=new t.LayerElement(e,void 0)),i.add(this._scaleView=new g(e)),i.add(this._bandView=new p(e))}_backgroundView(){return this._rimView}_prepareGauge(e,t){this._rimView.setVis(t.rim.visible),this._scaleView.setVis(t.scale.visible),this._bandView.setVis(t.band.visible),this._valueView.setVis(t.valueRim.visible),t.hand.visible?(this._handView||this._handContainer.add(this._handView=new w(e,"rct-circle-gauge-hand")),this._handView.visible=!0):this._handView&&(this._handView.visible=!1),t.pin.visible?(this._pinView||this._handContainer.add(this._pinView=new b(e,"rct-circle-gauge-pin")),this._pinView.visible=!0):this._pinView&&(this._pinView.visible=!1),this._textView.setVis(t.labelVisible())&&this._textView.setStyleOrClass(t.label._style)}_renderGauge(e,i){const s=this.model,a=s.getCenter(e,i),n=s.getExtents(t.minv(e,i));this.$_renderBackground(s,a,n),this._renderValue()}_renderValue(){const e=this.model,i=e.options,s=e.scale,a=e.getProps(),n=this._getValue(e),l=s.getRate(t.pickNum(n,0)),r=this._center,h=this._exts,o=e.valueRim.getThickness(h.radiusThick),c=this._textView;if(this._valueView.visible){const s=e.valueRim,c=s.options,d=s.getRange(i,n),u=h.value+(c.stroked?0:o/2),_=this._valueView;_.setStyleOrClass(s._style),d&&(_.setStyle(c.stroked?"stroke":"fill",d.color),d.style&&_.addStyleOrClass(d.style)),c.stroked&&(_.setFill("none"),_.setStyle("strokeWidth",t.pixel(o))),_.setBoolData("stroked",c.stroked),_.setSectorEx({cx:r.x,cy:r.y,rx:u,ry:u,innerRadius:(u-o)/u,start:a._startRad,angle:a._sweepRad*l,clockwise:i.clockwise},c.stroked)}if(this._handView){const i=(a._handRad+a._sweepRad*l)*t.RAD_DEG;this._handView.render(e.hand,h.radius).transp(r).rotate(e.options.clockwise?i:-i)}if(c.visible){const t=e.label;if(t.setText(e.getLabel(t,t.options.animatable?n:i.value)),c.text=t.options.text,t.buildSvg(c,null,NaN,NaN,e,t._domain),c.setBoolData("grouped",!!e._group),e._group)this.$_layoutGroupedLabel(e,c,h);else{const e=c.getBBox(),i=t.getOffset(this.width,this.height);c.trans(r.x+i.x,r.y-e.height/2+i.y)}}}$_renderBackground(e,t,i){const s=e.getProps(),a=s._startRad;this._center=t,this._exts=i,e.scale.buildSteps(i.scale*s._sweepRad,NaN),this._rimView.visible&&(this._rimView.internalSetStyleOrClass(e.rim._style),this._rimView.setSector({cx:t.x,cy:t.y,rx:i.radius,ry:i.radius,innerRadius:1-i.radiusThick/i.radius,start:a,angle:s._sweepRad,clockwise:e.options.clockwise})),this._scaleView.visible&&(this._scaleView.setStyleOrClass(e.scale._style),this._scaleView.measure(this.doc,e.scale,this.width,this.height,0),this._scaleView.setExtents(t,i),this._scaleView.layout()),this._bandView.visible&&(this._bandView.setStyleOrClass(e.band._style),this._bandView.measure(this.doc,e.band,this.width,this.height,0),this._bandView.setExtends(t,i),this._bandView.layout()),this._innerView.setStyleOrClass(e.options.innerStyle);let n=i.inner;const l=getComputedStyle(this._innerView.dom),r=parseFloat(l.strokeWidth);r>1&&(n-=r/2),this._innerView.setSector({cx:t.x,cy:t.y,rx:n,ry:n,innerRadius:0,start:0,angle:2*Math.PI,clockwise:!0}),this._pinView&&this._pinView.render(e.pin,n).trans(t.x,t.y)}$_layoutGroupedLabel(e,i,s){const a=i.getBBox(),n=this._rimView.getBBox(),l=+e._group.options.labelGap||0;i.anchor=t.TextAnchor.END,i.trans(n.x+n.width/2-l,n.y+(s.radius-s.inner-a.height)/2)}}class x extends t.GaugeGroupView{constructor(e){super(e,"rct-circle-gauge-group")}_createPool(e){return new t.ElementPool(e,m)}_doRenderGauges(e,i,s,a){const n=this.doc,l=this.model,r=l.props.getCenter(s,a),h=l.props.getExtents(t.minv(s,a));l.setChildExtents(h),s=a=2*h.radius,i.forEach(((e,t)=>{e.measure(n,l.getVisible(t),s,a,0),e.resize(s,a),e.layout()})),e.trans(r.x-h.radius,r.y-h.radius)}}class y extends t.GaugeScale{}class V extends t.GaugeLabel{getWidth(e){return t.calcPercent(this._widthDim,e)}getHeight(e){return t.calcPercent(this._heightDim,e)}getMaxWidth(e){return t.calcPercent(this._maxWidthDim,e)}getMaxHeight(e){return t.calcPercent(this._maxHeightDim,e)}getGap(e){return t.calcPercent(this._gapDim,e,0)}_doApply(e){super._doApply(e),this._setDims(e,"width","height","maxWidth","maxHeight","gap")}}V.defaults=t.extend(t.GaugeLabel.defaults,{maxWidth:"30%",maxHeight:"30%",gap:10});class v extends t.ValueGauge{_doInitChildren(e){super._doInitChildren(e),e.label=(this._label=new V(this.chart)).init(),e.scale=(this._scale=new y(this)).init()}get label(){return this._label}get scale(){return this._scale}isVertical(){return this._group?this._group.options.vertical:this._op.vertical}scaleVisible(){return!this._group&&this._scale.visible}calcedMinMax(){return this._scale.range()}_doPrepareRender(e){super._doPrepareRender(e),this._label._prepareRender()}}v.defaults=t.extend(t.ValueGauge.defaults,{reversed:!1});class f extends t.GaugeItem{constructor(){super(...arguments),this._args={gauge:null,value:NaN}}getStyle(e,t){if(this._op.styleCallback){this._args.gauge=e,this._args.value=t;return this._op.styleCallback(this._args)}}}class k extends v{_doInitChildren(e){super._doInitChildren(e),e.valueBar=(this._valueBar=new f(this)).init(),e.band=(this._band=new t.GaugeRangeBand(this)).init()}get valueBar(){return this._valueBar}get band(){return this._band}}k.type=t.LinearGaugeType;class C extends t.ChartItem{}C.defaults=t.extend(t.ChartItem.defaults,{opposite:!1,gap:10});class S extends V{}S.defaults=t.extend(V.defaults,{gap:10});class E extends t.GaugeGroup{_doInitChildren(e){super._doInitChildren(e),e.label=(this._label=new S(this.chart)).init(),e.itemLabel=(this._itemLabel=new C(this.chart)).init(),e.scale=(this._scale=new y(this)).init()}get label(){return this._label}get itemLabel(){return this._itemLabel}get scale(){return this._scale}calcedMinMax(){return this.scale.range()}}E.defaults=t.extend(t.GaugeGroup.defaults,{vertical:!1,itemGap:10});class R extends E{_doInitChildren(e){super._doInitChildren(e),e.band=(this._band=new t.GaugeRangeBand(this)).init()}get band(){return this._band}_gaugesType(){return"linear"}_doPrepareRender(e){super._doPrepareRender(e),this.band.visible&&this.band._prepareRender()}}R.type=t.LinearGaugeGroupType,R.gaugeType=t.LinearGaugeType;class G extends t.ScaleView{_createLine(e,i){return new t.LineElement(e,i)}_doMeasure(e,i,s,a,n){const l=i.options,r=i._reversed,h=i._vertical,o=i.label,c=i.tick,d=i._steps,u=d.length;let _=h?l.gap:s,g=h?a:l.gap;if(this._tickContainer.setVis(c.visible)&&(this._tickContainer.setStyleOrClass(c._style),this._ticks.prepare(u)),h?_+=c.options.length:g+=c.options.length,this._labelContainer.setVis(o.visible)&&(this._labelContainer.setStyleOrClass(o._style),this._labels.prepare(u,(t=>{t.setModel(e,o,null,null)})),u>0))if(h){let e=0;this._labels.forEach(((i,s)=>{i.setText(o.getText(d[r?s:u-1-s])),e=t.maxv(i.getBBox().width)})),_+=e}else{let e=0;this._labels.forEach(((i,s)=>{i.setText(o.getText(d[r?u-1-s:s])),e=t.maxv(i.getBBox().height)})),g+=e}return{width:_,height:g}}_doLayout(){const e=this.model;e._vertical?this.$_layoutVert(e,this.width,this.height):this.$_layoutHorz(e,this.width,this.height)}$_layoutHorz(e,t,i){const s=e.options,a=this._line,n=e.tick,l=e._steps;l.length;const r="opposite"===s.position,h=r?-n.options.length:n.options.length;let o,c=r?i-s.gap:s.gap;if(a.setVis(e.line.visible)&&(a.setStyleOrClass(e.line._style),a.setHLine(c,0,t)),this._tickContainer.setVis(n.visible)&&this._ticks.forEach(((i,s)=>{o=e.getRate(l[s])*t,i.setVLine(o,c,c+h)})),this._labelContainer.visible){const i=this._labelContainer.textAlign()||"center";let s=Number.MIN_SAFE_INTEGER;c=r?0:c+h,this._labels.forEach(((a,n)=>{a.layout(i);const r=a.getBBox();o=e.getRate(l[n])*t,a.setVis(o-r.width/2>s)&&(a.trans(o-r.width/2,c),s=o+r.width/2)}))}}$_layoutVert(e,t,i){const s=e.options,a=this._line,n=e.tick,l=e._steps;this.height,l.length;const r="opposite"===s.position,h=r?n.options.length:-n.options.length;let o,c=r?s.gap:t-s.gap;if(a.setVis(e.line.visible)&&(a.setStyleOrClass(e.line._style),a.setVLine(c,0,i)),this._tickContainer.setVis(n.visible)&&this._ticks.forEach(((t,s)=>{o=e.getRate(l[s])*i,t.setHLine(o,c,c+h)})),this._labelContainer.visible){const a=this._labelContainer.textAlign()||(r?"left":"right");c=r?c+h:t-s.gap+h,this._labels.forEach(((t,s)=>{t.layout(a);const n=t.getBBox(),h=r?c:c-n.width;o=e.getRate(l[s])*i,t.trans(h,o-n.height/2)}))}}}class B extends t.ValueGaugeView{_measureLabelSize(e,i,s){const a=e.label,n=this.labelView();return a.setText(e.getLabel(a,e.options.value)),n.text=a.options.text,a.buildSvg(n,null,i,s,e,a._domain),t.rectToSize(n.getBBox())}_renderGauge(e,i){const s=this.model,a=t.pickNum(this._runValue,s.options.value);this._measureGauge(s,s.label,this.labelView(),a,s.isVertical(),e,i),this._renderValue()}_renderValue(){const e=this.model,i=e.label,s=e.scale,a=this.labelView(),n=t.pickNum(this._runValue,e.options.value),l=t.assignObj({},this._rBand);if(this._renderScale(l),this.background().setRect(l),l.height>0&&this._renderBand(e,l,n),"top"!==i._runPos&&"bottom"!==i._runPos||(this._rLabel.height=l.height),this._renderLabel(e,i,a,n),!this._vertical&&("left"===i._runPos||"right"===i._runPos)&&s.visible&&"opposite"===s.options.position){const e=a.getBBox();a.ty+e.height>this.height&&a.transY(t.maxv(0,this.height-e.height))}}_measureGauge(e,i,s,a,n,l,r){const h=this._rBand=t.createRect(0,0,l,r);if(this._vertical=e._group instanceof E?e._group.options.vertical:n,i.visible){const n=i._runPos=t.pickProp(i.options.position,this._vertical?"top":"left"),o=i._runVert="top"===n||"bottom"===n,c=e._group?e._group.itemLabel.options.gap:i._runGap=i.getGap(o?r:l);let d=o?l:i.getWidth(l),u=o?i.getHeight(r):r;const _=o?l:i.getMaxWidth(l),g=o?i.getMaxHeight(r):r,p=this._rLabel=t.createRect(0,0,l,r);s.setStyleOrClass(i._style),i.setText(e.getLabel(i,i.options.animatable?a:e.options.value)),s.text=i.options.text,i.buildSvg(s,null,t.pickNum(d,_),t.pickNum(u,g),e,i._domain);const b=s.getBBox();switch(o?(p.height=t.pickNum(u,b.height),h.height=t.maxv(0,h.height-(p.height+c))):(p.width=t.pickNum(d,b.width),this._wLabel=e._group?e._group._labelWidth:p.width,h.width=t.maxv(0,h.width-(this._wLabel+c))),n){case"top":h.y=p.height+c;break;case"bottom":p.y=h.height+c;break;case"right":p.x=h.width+c;break;default:h.x=this._wLabel+c}}else this._rLabel=null}_renderLabel(e,i,s,a){if(s.visible){const e=this._rLabel,a=s.getBBox();let n=e.x,l=e.y;switch(i._runPos){case"top":case"bottom":n+=e.width/2;break;case"right":n=this.width-e.width,s.anchor=t.TextAnchor.START,l+=t.maxv(0,(e.height-a.height)/2);break;default:s.anchor=t.TextAnchor.END,n+=this._wLabel,l+=t.maxv(0,(e.height-a.height)/2)}s.trans(n,l)}}_renderScale(e){const i=this.model,s=i.label,a=i.scale,n=this.scaleView(),l=this._vertical?e.height:e.width;let r,h;if(a._vertical=this._vertical,a._reversed=i.options.reversed,isNaN(this._runValue)&&a.buildSteps(l,i.options.value),n.setVis(i.scaleVisible())){const i=n.measure(this.doc,a,e.width,e.height,1);this._vertical?(r=0,h=e.y,e.width=t.maxv(0,e.width-i.width),"opposite"===a.options.position?r=e.x+e.width:(s._runVert||(r=e.x),e.x+=i.width)):(r=e.x,e.height=t.maxv(0,e.height-i.height),"opposite"===a.options.position?s._runVert?(h=e.y,e.y+=i.height):(this._rLabel.y=e.y+=i.height,h=e.y-i.height):h=e.y+e.height),n.resizeByMeasured().layout().trans(r,h)}}}class T extends t.ChartElement{constructor(e){super(e,"rct-linear-gauge-band"),this._thick=0,this._gap=0,this._labelGap=3,this._barViews=new t.ElementPool(this,t.RectElement),this.add(this._labelContainer=new t.LayerElement(e,"rct-linear-gauge-band-tick-labels")),this._labels=new t.ElementPool(this._labelContainer,t.TextElement)}_doMeasure(e,i,s,a,n){const l=i.gauge,r=this._vertical=l instanceof k?l.isVertical():l.options.vertical,h="inside"===i.options.position,o=this._thick=h?r?s:a:i.getThickness(r?s:a)+(this._gap=t.pickNum(i.options.gap,0));let c=r?o:s,d=r?a:o;const u=this._ranges=i.getRanges();if(this._labelContainer.setVis(i.tickLabel.visible&&u.length>0)){const e=[u[0].fromValue].concat(u.map((e=>e.toValue)));if(this._labelContainer.setStyleOrClass(i.tickLabel._style),this._labels.prepare(u.length+1),r){let i=0;this._labels.forEach(((s,a)=>{s.text=String(e[a]),i=t.maxv(s.getBBox().width)})),c+=i+this._labelGap}else{let i=0;this._labels.forEach(((s,a)=>{s.text=String(e[a]),i=t.maxv(s.getBBox().height)})),d+=i}}return{width:c,height:d}}_doLayout(e){const t=this.model,i=t.gauge,s=i.scale,a=s._max-s._min;this._labelContainer.setVis(this.$_layoutBars(i,a,this._ranges)&&this._labelContainer.visible&&"inside"!==t.options.position)&&this.$_layoutLabels(i,a,this._ranges)}$_layoutBars(e,t,i){if(this._barViews.prepare(i.length),!this._barViews.isEmpty&&t>0){const e=this._vertical,s="inside"===this.model.options.position,a="opposite"===this.model.options.position,n=this.width,l=this.height,r=e?l:n,h=this._thick;let o=0;return this._barViews.prepare(i.length).forEach(((c,d)=>{const u=i[d],_=r*(u.toValue-u.fromValue)/t;if(e){const e=s||a?0:n-h;c.setBounds(e,l-o-_,h,_)}else{const e=a?l-h:0;c.setBounds(o,e,_,this._thick)}c.internalClearStyleAndClass(),c.setFill(u.color),u.style&&c.addStyleOrClass(u.style),o+=_})),!0}}$_layoutLabels(e,i,s){const a="opposite"===this.model.options.position;if(this._vertical){const e=this.height,n=a?t.TextAnchor.START:t.TextAnchor.END,l=a?this._thick+this._labelGap:this.width-this._thick-this._labelGap;let r=this._labels.get(0);r.anchor=n,r.trans(l,e-r.getBBox().height/2);for(let t=1;t<=s.length;t++){const a=e-e*s[t-1].toValue/i;r=this._labels.get(t),r.anchor=n,r.trans(l,a-r.getBBox().height/2)}}else{const e=this.width,t=a?0:this._thick;this._labels.get(0).trans(0,t);for(let a=1;a<=s.length;a++){const n=e*s[a-1].toValue/i;this._labels.get(a).trans(n,t)}}}}class L extends B{constructor(e){super(e,"rct-linear-gauge")}_doInitContents(e,i){i.add(this._background=new t.RectElement(e,"rct-linear-gauge-background")),i.add(this._bandView=new T(e)),i.add(this._scaleView=new G(e)),i.add(this._valueView=new t.RectElement(e,"rct-linear-gauge-value")),i.add(this._labelView=new t.TextElement(e))}_backgroundView(){return this._background}labelView(){return this._labelView}scaleView(){return this._scaleView}background(){return this._background}_prepareGauge(e,t){}_renderScale(e){const t=this.model.band,i=this._bandView;if(super._renderScale(e),i.setVis(t.visible)){const s=+t.options.gap||0,a=i.measure(this.doc,t,e.width,e.height,1);i.resizeByMeasured().layout(),this._vertical?"inside"===t.options.position?i.trans(e.x,e.y):"opposite"===t.options.position?(i.trans(e.x+e.width-a.width,e.y),e.width-=a.width+s):(i.trans(e.x,e.y),e.width-=a.width+s,e.x+=a.width+s):"inside"===t.options.position?i.trans(e.x,e.y):"opposite"===t.options.position?(i.trans(e.x,e.y),e.height-=a.height+s,e.y+=a.height+s):(i.trans(e.x,e.y+e.height-a.height),e.height-=a.height+s)}}_renderBand(e,i,s){const a=this._valueView,n=e.options.reversed,l=e.valueBar,r=e._group?e._group.scale:e.scale;if(a.setVis(!t.isEmptyRect(i)&&l.visible&&!r.isEmpty()&&!isNaN(e.options.value)))if(a.setStyleOrClass(l._style),a.internalSetStyleOrClass(l.getStyle(e,s)),this._vertical){const e=i.height*r.getRate(s),t=n?i.y:i.y+i.height-e;a.setBounds(i.x,t,i.width,e)}else{const e=i.width*r.getRate(s),t=n?i.x+i.width-e:i.x;a.setBounds(t,i.y,e,i.height)}}}class P extends t.GaugeGroupView{constructor(e,t){super(e,t)}_doInitContents(e,i){super._doInitContents(e,i),i.insertFirst(this._scaleView=new G(e)),i.insertFirst(this._textView=new t.TextElement(e,"rct-linear-gauge-group-label"))}_prepareGauge(e,t){this._textView.setVis(t.label.visible)&&this._textView.setStyleOrClass(t.label._style),this._scaleView.setVis(t.scale.visible)&&this._scaleView.setStyleOrClass(t.scale._style),super._prepareGauge(e,t)}_doRenderGauges(e,i,s,a){const n=this.model,l=n.options,r=this._textView,h=t.createRect(0,0,s,a);if(r.visible){r.text=n.label.options.text,n.label.buildSvg(r,null,NaN,NaN,n,null);const e=this._textView.getBBox().height+n.label.getGap(a);h.y+=e,h.height-=e,r.trans(this.width/2,0)}n._labelWidth=n._labelHeight=0,this._gaugeViews.forEach(((e,i)=>{const l=e._measureLabelSize(n.get(i),s,a);n._labelWidth=t.maxv(n._labelWidth,l.width),n._labelHeight=t.maxv(n._labelHeight,l.height)}));const o=t.copyObj(h),c=n.itemLabel.options.gap;l.vertical?(o.height-=n._labelHeight+c,n.itemLabel.options.opposite||(o.y+=n._labelHeight+c)):(o.width-=n._labelWidth+c,n.itemLabel.options.opposite||(o.x+=n._labelWidth+c)),this._renderScale(n,h,o),l.vertical?this.$_layoutVert(this.doc,n,i,h):this.$_layoutHorz(this.doc,n,i,h)}_renderScale(e,i,s){const a=this._scaleView,n=e.scale,l=e.options.vertical,r=l?i.height:i.width,h=[];let o,c;if(this._gaugeViews.forEach(((i,s)=>{h.push(t.pickNum(i._runValue,e.get(s).options.value))})),n.buildGroupSteps(r,h),n._vertical=l,a.setVis(n.visible)){const e=a.measure(this.doc,n,s.width,s.height,1);if(l){const t=e.width;s.width-=t,i.width-=t,c=s.y,"opposite"===n.options.position?o=s.x+s.width:(o=s.x,s.x+=t,i.x+=t)}else{const t=e.height;s.height-=t,i.height-=t,o=s.x,"opposite"===n.options.position?(c=s.y,s.y+=t,i.y+=t):c=s.y+s.height}a.resizeByMeasured().layout().trans(o,c)}}$_layoutVert(e,t,i,s){const a=s.height,n=(s.width-t.options.itemGap*(i.count-1))/i.count,l=s.y;let r=s.x;i.forEach(((i,s)=>{i.measure(e,t.get(s),n,a,0),i.resize(n,a),i.layout(),i.trans(r,l),r+=n+t.options.itemGap}))}$_layoutHorz(e,t,i,s){const a=t.options.itemGap,n=s.width,l=(s.height-a*(i.count-1))/i.count,r=s.x;let h=s.y;i.forEach(((i,s)=>{i.measure(e,t.get(s),n,l,0),i.resize(n,l),i.layout(),i.trans(r,h),h+=l+a}))}}class I extends P{constructor(e){super(e,"rct-linear-gauge-group")}_doInitContents(e,t){super._doInitContents(e,t),t.insertChild(this._bandView=new T(e),this._scaleView)}_createPool(e){return new t.ElementPool(e,L)}_renderScale(e,t,i){super._renderScale(e,t,i);const s=this._bandView,a=e.band;let n,l;if(s.setVis(a.visible)){const r=+a.options.gap||0,h=s.measure(this.doc,a,i.width,i.height,1);if(e.options.vertical){const e=h.width+r;i.width-=e,t.width-=e,l=i.y,"opposite"===a.options.position?n=i.x+i.width+r:(n=i.x,i.x+=e,t.x+=e)}else{const e=h.height+r;i.height-=e,t.height-=e,n=i.x,"opposite"===a.options.position?(l=i.y,i.y+=e,t.y+=e):l=i.y+i.height+r}s.resizeByMeasured().layout().trans(n,l)}}}class D extends t.ChartItem{constructor(e){super(e.chart),this.gauge=e}getRanges(){var e;return null===(e=this.$_internalRanges())||void 0===e?void 0:e.slice(0)}_doApply(e){const t=this;var i;super._doApply(e),(i=e.ranges)!==t._ranges&&(t._ranges=i,t._runRanges=null)}$_internalRanges(){if(!this._runRanges){const e=this.gauge.options;this._runRanges=t.buildValueRanges(this._ranges,e.minValue,e.maxValue,this._op.rangeInclusive)}return this._runRanges}}D.defaults=t.extend(t.ChartItem.defaults,{vertical:!0,rangeInclusive:!0});class O extends t.GaugeItem{}O.defaults=t.extend(t.ChartItem.defaults,{visible:!0});class N extends f{}class A extends v{_doInitChildren(e){super._doInitChildren(e),e.band=(this._band=new D(this)).init(),e.targetBar=(this._targetBar=new O(this)).init(),e.valueBar=(this._valueBar=new N(this)).init()}get band(){return this._band}get targetBar(){return this._targetBar}get valueBar(){return this._valueBar}getRanges(e,i,s){return t.buildValueRanges(this._op.ranges,e,i,t.pickProp(s,this._op.rangeInclusive))}}A.type=t.BulletGaugeType,A.defaults=t.extend(v.defaults,{rangeInclusive:!0});class H extends E{getRanges(e,i,s){return t.buildValueRanges(this._op.ranges,e,i,t.pickProp(s,this._op.rangeInclusive))}_gaugesType(){return"bullet"}}H.type=t.BulletGaugeGroupType,H.gaugeType=t.BulletGaugeType,H.defaults=t.extend(E.defaults,{rangeInclusive:!0});class $ extends B{constructor(e){super(e,"rct-bullet-gage")}_doInitContents(e,i){i.add(this._background=new t.RectElement(e,"rct-bullet-gauge-background")),i.add(this._barContainer=new t.LayerElement(e,void 0)),this._barViews=new t.ElementPool(this._barContainer,t.RectElement),i.add(this._valueView=new t.RectElement(e,"rct-bullet-gauge-value")),i.add(this._targetView=new t.RectElement(e,"rct-bullet-gauge-target")),i.add(this._scaleView=new G(e)),i.add(this._labelView=new t.TextElement(e))}_backgroundView(){return this._background}labelView(){return this._labelView}scaleView(){return this._scaleView}background(){return this._background}_prepareGauge(e,t){}_renderBand(e,i,s){const a=e.options,n=e._group,l=e.options.reversed,r=this._vertical,h=n?n.scale:e.scale,o=this._valueView,c=this._targetView;if(this._barContainer.setVis(!t.isEmptyRect(i)&&!h.isEmpty())){const t=e.getRanges(h._min,h._max,!1)||(null==n?void 0:n.getRanges(h._min,h._max,!1));t&&(this._barContainer.setRect(i),this._barViews.prepare(t.length),r?this._barViews.forEach(((e,s)=>{const a=t[s],n=i.height*h.getRate(a.toValue-a.fromValue),r=i.height*h.getRate(a.fromValue);e.setBounds(0,l?r:i.height-r-n,i.width,n),e.internalClearStyleAndClass(),e.setFill(a.color),a.style&&e.addStyleOrClass(a.style)})):this._barViews.forEach(((e,s)=>{const a=t[s],n=i.width*h.getRate(a.toValue-a.fromValue),r=i.width*h.getRate(a.fromValue);e.setBounds(l?i.width-n-r:r,0,n,i.height),e.internalClearStyleAndClass(),e.setFill(a.color),a.style&&e.addStyleOrClass(a.style)})))}if(o.setVis(e.valueBar.visible&&!h.isEmpty()&&!isNaN(s)))if(o.setStyleOrClass(e.valueBar._style),s<a.targetValue&&e.valueBar.options.belowStyle&&o.internalSetStyleOrClass(e.valueBar.options.belowStyle),o.internalSetStyleOrClass(e.valueBar.getStyle(e,s)),r){const e=i.height*h.getRate(s),t=l?i.y:i.y+i.height-e;o.setBounds(i.x+i.width/3,t,i.width/3,e)}else{const e=i.width*h.getRate(s),t=l?i.x+i.width-e:i.x;o.setBounds(t,i.y+i.height/3,e,i.height/3)}if(c.setVis(e.targetBar.visible&&!h.isEmpty()&&!isNaN(a.targetValue)))if(c.setStyleOrClass(e.targetBar._style),r&&i.width>10){let e=i.height*h.getRate(a.targetValue);e=l?i.y+e:i.y+i.height-e,c.setBounds(i.x+5,e-1,i.width-10,3)}else if(!r&&i.height>10){let e=i.width*h.getRate(a.targetValue);e=l?i.x+i.width-e:i.x+e,c.setBounds(e-1,i.y+5,3,i.height-10)}}}class M extends P{constructor(e){super(e,"rct-bullet-gauge-group")}_createPool(e){return new t.ElementPool(e,$)}}class z extends t.GaugeItem{getThickness(e){return t.calcPercent(this._thicknessDim,e,e)}_doApply(e){super._doApply(e),this._setDim(e,"thickness")}}z.defaults=t.extend(t.ChartItem.defaults,{thickness:7});class W extends t.GaugeItem{getLength(e){return t.calcPercent(this._lengthDim,e,e)}_doApply(e){super._doApply(e),this._setDim(e,"length")}}W.defaults=t.extend(t.ChartItem.defaults,{thickness:7,length:"60%"});class F extends W{}F.defaults=t.extend(W.defaults,{thickness:5,length:"85%"});class j extends W{}j.defaults=t.extend(W.defaults,{thickness:2,length:"95%",animatable:!1,duration:200});class Y extends t.GaugeItem{constructor(e,t){super(e),this.length=t}}class X extends t.GaugeItem{}X.defaults=t.extend(t.ChartItem.defaults,{step:1,offset:1});class U extends t.GaugeItem{constructor(e,t){super(e),this.raidus=t}}class q extends t.ChartText{constructor(e){super(e.chart)}}q.defaults=t.extend(t.ChartText.defaults,{text:"RealChart Clock<br>ver1.0",position:"top"});class J extends t.Gauge{_doInitChildren(e){super._doInitChildren(e),e.rim=(this.rim=new z(this)).init(),e.hourHand=(this.hourHand=new W(this)).init(),e.minuteHand=(this.minuteHand=new F(this)).init(),e.secondHand=(this.secondHand=new j(this)).init(),e.tick=(this.tick=new Y(this,10)).init(),e.minorTick=(this.minorTick=new Y(this,5)).init(),e.tickLabel=(this.tickLabel=new X(this)).init(),e.pin=(this.pin=new U(this,5)).init(),e.label=(this.label=new q(this)).init()}getTime(){const e=this._op;return e.time instanceof Date?e.time:t.isString(e.time)?new Date(e.time):isNaN(e.time)?void 0:new Date(e.time)}getExtents(e,i){const s=t.minv(e,i);return{cx:t.calcPercent(this._centerXDim,e,e/2),cy:t.calcPercent(this._centerYDim,i,i/3),rd:t.calcPercent(this._radiusDim,s,s/2)}}_doApply(e){const i=this;var s,a,n;super._doApply(e),s=e.centerX,a=e.centerY,n=e.radius,(i._centerXDim||s!==i._centerX)&&(i._centerXDim=t.parsePercentSize(t.pickProp(i._centerX=s,t.CircularGauge.DEF_CENTER),!0)),i._centerYDim&&a===i._centerY||(i._centerYDim=t.parsePercentSize(t.pickProp(i._centerY=a,t.CircularGauge.DEF_CENTER),!0)),i._radiusDim&&n===i._radius||(i._radiusDim=t.parsePercentSize(t.pickProp(i._radius=n,t.CircularGauge.DEF_RADIUS),!0))}}J.type=t.ClockGaugeType,J.defaults=t.extend(t.Gauge.defaults,{centerX:"50%",centerY:"50%",radius:"40%",active:!0});class K extends t.RcAnimation{constructor(e){super(),this.view=e}_doUpdate(e){return this.view._secRate=e,this.view.$_renderHands(this.view.model,this.view._exts),!0}}class Q extends t.GaugeView{constructor(e){super(e,"rct-clock-gauge"),this._rimThick=0,this._secRate=1}_doInitContents(e,i){i.add(this._faceView=new t.CircleElement(e,"rct-clock-gauge-face")),i.add(this._rimView=new t.SectorElement(e,"rct-clock-gauge-rim")),i.add(this._labelView=new t.TextElement(e,"rct-clock-gauge-label")),this._labelView.layout=t.TextLayout.MIDDLE,i.add(this._tickContainer=new t.LayerElement(e,"rct-clock-gauge-ticks")),i.add(this._tickLabelContainer=new t.LayerElement(e,"rct-clock-gauge-tick-labels")),i.add(this._hourView=new t.PathElement(e,"rct-clock-gauge-hour")),i.add(this._minuteView=new t.PathElement(e,"rct-clock-gauge-minute")),i.add(this._secondView=new t.PathElement(e,"rct-clock-gauge-second")),i.add(this._pinView=new t.CircleElement(e,"rct-clock-gauge-pin")),this._tickViews=new t.ElementPool(this._tickContainer,t.LineElement,"rct-clock-gauge-tick"),this._minorTickViews=new t.ElementPool(this._tickContainer,t.LineElement,"rct-clock-gauge-minor-tick"),this._tickLabelViews=new t.ElementPool(this._tickLabelContainer,t.TextElement,"rct-clock-gauge-tick-label")}_prepareGauge(e,i){this._tickViews.prepare(i.tick.visible?12:0),this._minorTickViews.prepare(i.minorTick.visible?48:0);const s=Math.round(12/t.maxv(1,Math.floor(i.tickLabel.options.step)||1));this._tickLabelViews.prepare(i.tickLabel.visible?s:0,(e=>{e.layout=t.TextLayout.MIDDLE}))}_renderGauge(e,i){const s=this.model,a=this._exts=s.getExtents(e,i);this._secRate=1,this.$_renderFace(s,a),this.$_renderHands(s,a),s.options.active&&!s.getTime()?this._runner||(this._runner=setInterval((()=>{const e=this._prevSec;this.$_renderHands(this.model,this._exts),t.absv(e-this._prevSec)>=1&&this._secondView.visible&&s.chart.animatable()&&s.secondHand.options.animatable&&this.$_moveSecond(e)}),1e3)):this._runner&&(clearInterval(this._runner),this._runner=void 0)}$_renderFace(e,i){const s=this._labelView,a=this._rimView,n=this._minorTickViews,l=this._tickLabelViews,r=this._pinView,{cx:h,cy:o,rd:c}=i,d=this._rimThick=a.visible?e.rim.getThickness(c):0;this._faceView.setCircle(h,o,c),a.setVis(e.rim.visible)&&(a.internalSetStyleOrClass(e.rim._style),a.setSector({cx:h,cy:o,rx:c,ry:c,innerRadius:1-d/c,start:0,angle:2*Math.PI,clockwise:!0}));const u=c-d;let _=u-e.tick.length,g=t.ORG_ANGLE,p=t.PI_2/12;if(this._tickViews.forEach(((i,s)=>{i.setLine(h+t.cos(g)*u,o+t.sin(g)*u,h+t.cos(g)*_,o+t.sin(g)*_),i.internalSetStyleOrClass(e.tick._style),g+=p})),!n.isEmpty){let i=0;_=u-e.minorTick.length,g=t.ORG_ANGLE,p=t.PI_2/60,n.forEach((s=>{i%5==0&&(g+=p,i++),s.setLine(h+t.cos(g)*u,o+t.sin(g)*u,h+t.cos(g)*_,o+t.sin(g)*_),s.internalSetStyleOrClass(e.minorTick._style),g+=p,i++}))}if(!l.isEmpty){const i=12/l.count,s=t.PI_2/12*i;g=t.ORG_ANGLE,l.get(0).text="12",_=u-(e.tick.length+e.tickLabel.options.offset||0),_-=.5*l.get(0).getBBox().height,l.forEach(((a,n,l)=>{a.text=String(0===n?12:n*i),a.trans(h+t.cos(g)*_,o+t.sin(g)*_),a.internalSetStyleOrClass(e.tickLabel._style),g+=s}))}r.setVis(e.pin.visible)&&(r.setCircle(h,o,e.pin.raidus),r.setStyleOrClass(e.pin._style)),s.setVis(e.label.visible)&&(s.internalSetStyleOrClass(e.label._style),e.label.buildSvg(s,null,NaN,NaN,null,null),"bottom"===e.label.options.position?s.trans(h,o+_/2):s.trans(h,o-_/2))}$_getNow(){const e=this.model.options.timezone;let t=this.model.getTime()||new Date;if(!isNaN(e)){const i=t.getMinutes()+(t.getTimezoneOffset()+e);t.setMinutes(i)}return t}$_renderHands(e,i){const s=this.$_getNow(),a=s.getHours(),n=s.getMinutes(),l=s.getSeconds(),{cx:r,cy:h,rd:o}=i,c=new t.PathBuilder;let d,u,_,g;d=e.hourHand,u=this._hourView,u.setVis(d.visible)&&(g=t.PI_2*(a/12+n/60/12+l/60/60/12),_=d.getLength(o-this._rimThick),c.rect(-d.options.thickness/2,-_,d.options.thickness,_),u.internalSetStyleOrClass(d._style),u.setPath(c.close(!0)).trans(r,h).rotate(g*t.RAD_DEG)),d=e.minuteHand,u=this._minuteView,u.setVis(d.visible)&&(g=t.PI_2*(n/60+l/60/60),_=d.getLength(o-this._rimThick),c.rect(-d.options.thickness/2,-_,d.options.thickness,_),u.internalSetStyleOrClass(d._style),u.setPath(c.close(!0)).trans(r,h).rotate(g*t.RAD_DEG)),d=e.secondHand,u=this._secondView,u.setVis(d.visible)&&(g=this._secRate<1?t.PI_2*(this._aniSec+this._secRate)/60:t.PI_2*l/60,_=d.getLength(o-this._rimThick),c.rect(-d.options.thickness/2,-_,d.options.thickness,_),u.internalSetStyleOrClass(d._style),u.setPath(c.close(!0)).trans(r,h).rotate(g*t.RAD_DEG),this._prevSec=l)}$_moveSecond(e){if(!isNaN(e)){this._aniSec=e;const t=new K(this);t.duration=this.model.secondHand.options.duration||200,t.start()}}}function Z(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Gauge.register(A,d,J,k),e.GaugeGroup.register(H,u,R),e.GaugeView.register([d,m],[k,L],[A,$],[J,Q],[u,x],[R,I],[H,M]))}Z(s),e.BulletGauge=A,e.CircleGauge=d,e.ClockGauge=J,e.LinearGauge=k,e.default=Z,Object.defineProperty(e,"__esModule",{value:!0})}));
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealChartGauge={},e.RealChart)}(this,(function(e,t){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var s=i(t);class a extends t.GaugeItem{getRange(e,t){const i=this.$_internalRanges(e);if(i)for(const e of i)if(t>=e.fromValue&&t<e.toValue)return e}_doApply(e){const t=this;var i;super._doApply(e),(i=e.ranges)!==t._ranges&&(t._ranges=i,t._runRanges=null)}$_internalRanges(e){return this._runRanges||(this._runRanges=t.buildValueRanges(this._ranges,e.minValue,e.maxValue,this._op.rangeInclusive)),this._runRanges}}a.defaults=t.extend(t.ChartItem.defaults,{rangeInclusive:!0});class n extends a{getSegmentThickness(e){return t.calcPercent(this._segmentThicknessDim,e,e)}_doApply(e){super._doApply(e),this._setDim(e,"segmentThickness")}}n.defaults=t.extend(a.defaults,{segmentGap:0});class l extends a{getThickness(e){return t.calcPercent(this._thicknessDim,e,e)}_doApply(e){super._doApply(e),this._setDim(e,"thickness")}}l.defaults=t.extend(a.defaults,{thickness:"100%",stroked:!1});class r extends t.GaugeItem{}r.defaults=t.extend(t.ChartItem.defaults,{visible:!1});class h extends t.GaugeItem{getExtents(e){return{radius:t.calcPercent(this._radiusDim,e,0),length:t.calcPercent(this._lengthDim,e,0),offset:t.calcPercent(this._offsetDim,e,0)}}_doApply(e){super._doApply(e),this._setDims(e,"radius","length","offset")}}h.defaults=t.extend(t.ChartItem.defaults,{visible:!1,radius:3,length:"100%",offset:0});class o extends t.GaugeItem{getRadius(e){return t.calcPercent(this._radiusDim,e,0)}_doApply(e){super._doApply(e),this._setDim(e,"radius")}}o.defaults=t.extend(t.ChartItem.defaults,{visible:!1,radius:5});class c extends t.GaugeScale{_getStepMultiples(e){return[1,2,2.5,5,10]}}c.defaults=t.extend(t.GaugeScale.defaults,{visible:!1,stepPixels:72});class d extends t.CircularGauge{_doInitChildren(e){super._doInitChildren(e),e.band=(this._band=new t.GaugeRangeBand(this)).init(),e.scale=(this._scale=new c(this)).init(),e.rim=(this._rim=new n(this)).init(),e.valueRim=(this._valueRim=new l(this)).init(),e.hand=(this._hand=new h(this)).init(),e.pin=(this._pin=new o(this)).init()}get band(){return this._band}get scale(){return this._scale}get rim(){return this._rim}get valueRim(){return this._valueRim}get hand(){return this._hand}get pin(){return this._pin}getExtents(e){const i=super.getExtents(e),s=this.scale,a=this.band;let n=i.radius;const l=n-i.inner;if(a.visible)switch(i.bandThick=a.getThickness(l),a.options.position){case"inside":i.band=n-(l-i.bandThick)/2;break;case"opposite":i.band=i.inner-a.options.gap,i.inner=i.band-i.bandThick;break;default:i.band=n+=i.bandThick+a.options.gap}if(i.scaleTick=t.maxv(1,s.tick.options.length||0),i.scaleLabel=16,"opposite"===s.options.position)i.scale=i.inner-s.options.gap,i.inner=i.scale-i.scaleTick-i.scaleLabel;else i.scale=n+s.options.gap;return i}}d.type=t.CircleGaugeType;class u extends t.CircularGaugeGroup{_gaugesType(){return"circle"}}u.type=t.CircleGaugeGroupType,u.gaugeType=t.CircleGaugeType,u.defaults=t.extend(t.CircularGaugeGroup.defaults,{innerRadius:"50%"});class _ extends t.ValueGaugeView{}class g extends t.ScaleView{setExtents(e,t){this._center=e,this._exts=t}_createLine(e,i){return new t.ArcElement(e,i)}_doMeasure(e,t,i,s,a){const n=t._steps.length-(360===t.gauge.options.sweepAngle?1:0);return this._line.setVis(t.line.visible)&&this._line.internalSetStyleOrClass(t.line._style),this._tickContainer.setVis(t.tick.visible)&&(this._tickContainer.internalSetStyleOrClass(t.tick._style),this._ticks.prepare(n)),this._labelContainer.setVis(t.label.visible)&&(this._labelContainer.internalSetStyleOrClass(t.label._style),this._labels.prepare(n)),{width:i,height:s}}_doLayout(e){const i=this.model,s=i._steps,a=i.gauge,n=a.options,l="opposite"===i.options.position?-1:1,r=a._props,h=this._center.x,o=this._center.y,c=this._exts.scale,d=c+this.model.tick.options.length*l,u=r._sweepRad,_=r._startRad,g=n.maxValue-n.minValue,p=n.clockwise;let b,w,m,x;if(this._line.visible&&this._line.setArc(h,o,c,_,p?u:-u,p),this._tickContainer.visible&&this._ticks.forEach(((e,a,n)=>{const l=i.getRate(s[a])*(p?u:-u)+_;b=h+t.cos(l)*c,w=o+t.sin(l)*c,m=h+t.cos(l)*d,x=o+t.sin(l)*d,e.setLine(b,w,m,x)})),this._labelContainer.visible){this._labels.get(0).setText(String(n.maxValue));const e=d+.2*this._labels.get(0).getBBox().height*l;this._labels.forEach(((a,r)=>{const c=i.getRate(s[r])*(p?u:-u)+_;a.setText(String(t.fixnum(n.minValue+i.getRate(s[r])*g))),a.setContrast(null).layout("center");const d=a.getBBox();m=h+t.cos(c)*(e+d.width/2*l)-d.width/2,x=o+t.sin(c)*(e+d.height/2*l)-d.height/2,a.trans(m,x)}))}}}let p=class extends t.ChartElement{constructor(e){super(e,"rct-circle-gauge-band"),this._sectorViews=new t.ElementPool(this,t.SectorElement),this.add(this._labelContainer=new t.LayerElement(e,"rct-circle-gauge-band-tick-labels")),this._labels=new t.ElementPool(this._labelContainer,t.TextElement)}setExtends(e,t){this._center=e,this._exts=t}_doLayout(e){const t=this.model,i=t.gauge,s=i.scale,a=i._props,n=this._center.x,l=this._center.y,r=this._exts.band,h=i.options.clockwise,o=1-this._exts.bandThick/r,c=t.getRanges(),d=a._sweepRad;i.options.maxValue,i.options.minValue;let u=a._startRad;this._sectorViews.prepare(c.length).forEach(((e,t)=>{const i=s.getRate(c[t].toValue-c[t].fromValue)*d;e.setSector({cx:n,cy:l,rx:r,ry:r,innerRadius:o,start:u,angle:i,clockwise:h}),e.internalClearStyleAndClass(),e.setFill(c[t].color),c[t].style&&e.addStyleOrClass(c[t].style),u+=h?i:-i}))}};class b extends t.PathElement{render(e,i){const s=e.getRadius(i);return s!==this._radius&&(this._radius=s,this.setPath((new t.PathBuilder).circle(0,0,s).end())),this.internalSetStyleOrClass(e._style),this}}class w extends t.PathElement{render(e,i){const s=e.getExtents(i);if(s.radius!==this._radius||s.length!==this._length||s.offset!==this._offset){const e=this._radius=s.radius,i=this._offset=s.offset;if(this._length=s.length,this._radius>0&&this._length>0){const s=new t.PathBuilder;s.move(-e,i).line(0,-this._length+i).line(e,i),this.setPath(s.end())}else this.setPath("")}return this.internalSetStyleOrClass(e._style),this}}class m extends _{constructor(e){super(e,"rct-circle-gauge")}_doInitContents(e,i){i.add(this._rimView=new t.SectorElement(e,"rct-circle-gauge-rim")),i.add(this._valueView=new t.SectorElement(e,"rct-circle-gauge-value")),i.add(this._innerView=new t.SectorElement(e,"rct-circle-gauge-inner")),i.add(this._textView=new t.TextElement(e,"rct-circle-gauge-label")),i.add(this._handContainer=new t.LayerElement(e,void 0)),i.add(this._scaleView=new g(e)),i.add(this._bandView=new p(e))}_backgroundView(){return this._rimView}_prepareGauge(e,t){this._rimView.setVis(t.rim.visible),this._scaleView.setVis(t.scale.visible),this._bandView.setVis(t.band.visible),this._valueView.setVis(t.valueRim.visible),t.hand.visible?(this._handView||this._handContainer.add(this._handView=new w(e,"rct-circle-gauge-hand")),this._handView.visible=!0):this._handView&&(this._handView.visible=!1),t.pin.visible?(this._pinView||this._handContainer.add(this._pinView=new b(e,"rct-circle-gauge-pin")),this._pinView.visible=!0):this._pinView&&(this._pinView.visible=!1),this._textView.setVis(t.labelVisible())&&this._textView.setStyleOrClass(t.label._style)}_renderGauge(e,i){const s=this.model,a=s.getCenter(e,i),n=s.getExtents(t.minv(e,i));this.$_renderBackground(s,a,n),this._renderValue()}_renderValue(){const e=this.model,i=e.options,s=e.scale,a=e.getProps(),n=e.getValue(),l=s.getRate(t.pickNum(n,0)),r=this._center,h=this._exts,o=e.valueRim.getThickness(h.radiusThick),c=this._textView;if(this._valueView.visible){const s=e.valueRim,c=s.options,d=s.getRange(i,n),u=h.value+(c.stroked?0:o/2),_=this._valueView;_.setStyleOrClass(s._style),d&&(_.setStyle(c.stroked?"stroke":"fill",d.color),d.style&&_.addStyleOrClass(d.style)),c.stroked&&(_.setFill("none"),_.setStyle("strokeWidth",t.pixel(o))),_.setBoolData("stroked",c.stroked),_.setSectorEx({cx:r.x,cy:r.y,rx:u,ry:u,innerRadius:(u-o)/u,start:a._startRad,angle:a._sweepRad*l,clockwise:i.clockwise},c.stroked)}if(this._handView){const i=(a._handRad+a._sweepRad*l)*t.RAD_DEG;this._handView.render(e.hand,h.radius).transp(r).rotate(e.options.clockwise?i:-i)}if(c.visible){const t=e.label;if(t.setText(e.getLabel(t,t.options.animatable?n:i.value)),c.text=t.options.text,t.buildSvg(c,null,NaN,NaN,e,t._domain),c.setBoolData("grouped",!!e._group),e._group)this.$_layoutGroupedLabel(e,c,h);else{const e=c.getBBox(),i=t.getOffset(this.width,this.height);c.trans(r.x+i.x,r.y-e.height/2+i.y)}}}$_renderBackground(e,t,i){const s=e.getProps(),a=s._startRad;this._center=t,this._exts=i,e.scale.buildSteps(i.scale*s._sweepRad,NaN),this._rimView.visible&&(this._rimView.internalSetStyleOrClass(e.rim._style),this._rimView.setSector({cx:t.x,cy:t.y,rx:i.radius,ry:i.radius,innerRadius:1-i.radiusThick/i.radius,start:a,angle:s._sweepRad,clockwise:e.options.clockwise})),this._scaleView.visible&&(this._scaleView.setStyleOrClass(e.scale._style),this._scaleView.measure(this.doc,e.scale,this.width,this.height,0),this._scaleView.setExtents(t,i),this._scaleView.layout()),this._bandView.visible&&(this._bandView.setStyleOrClass(e.band._style),this._bandView.measure(this.doc,e.band,this.width,this.height,0),this._bandView.setExtends(t,i),this._bandView.layout()),this._innerView.setStyleOrClass(e.options.innerStyle);let n=i.inner;const l=getComputedStyle(this._innerView.dom),r=parseFloat(l.strokeWidth);r>1&&(n-=r/2),this._innerView.setSector({cx:t.x,cy:t.y,rx:n,ry:n,innerRadius:0,start:0,angle:2*Math.PI,clockwise:!0}),this._pinView&&this._pinView.render(e.pin,n).trans(t.x,t.y)}$_layoutGroupedLabel(e,i,s){const a=i.getBBox(),n=this._rimView.getBBox(),l=+e._group.options.labelGap||0;i.anchor=t.TextAnchor.END,i.trans(n.x+n.width/2-l,n.y+(s.radius-s.inner-a.height)/2)}}class x extends t.GaugeGroupView{constructor(e){super(e,"rct-circle-gauge-group")}_createPool(e){return new t.ElementPool(e,m)}_doRenderGauges(e,i,s,a){const n=this.doc,l=this.model,r=l.props.getCenter(s,a),h=l.props.getExtents(t.minv(s,a));l.setChildExtents(h),s=a=2*h.radius,i.forEach(((e,t)=>{e.measure(n,l.getVisible(t),s,a,0),e.resize(s,a),e.layout()})),e.trans(r.x-h.radius,r.y-h.radius)}}class y extends t.GaugeScale{}class V extends t.GaugeLabel{getWidth(e){return t.calcPercent(this._widthDim,e)}getHeight(e){return t.calcPercent(this._heightDim,e)}getMaxWidth(e){return t.calcPercent(this._maxWidthDim,e)}getMaxHeight(e){return t.calcPercent(this._maxHeightDim,e)}getGap(e){return t.calcPercent(this._gapDim,e,0)}_doApply(e){super._doApply(e),this._setDims(e,"width","height","maxWidth","maxHeight","gap")}}V.defaults=t.extend(t.GaugeLabel.defaults,{maxWidth:"30%",maxHeight:"30%",gap:10});class v extends t.ValueGauge{_doInitChildren(e){super._doInitChildren(e),e.label=(this._label=new V(this.chart)).init(),e.scale=(this._scale=new y(this)).init()}get label(){return this._label}get scale(){return this._scale}isVertical(){return this._group?this._group.options.vertical:this._op.vertical}scaleVisible(){return!this._group&&this._scale.visible}calcedMinMax(){return this._scale.range()}_doPrepareRender(e){super._doPrepareRender(e),this._label._prepareRender()}}v.defaults=t.extend(t.ValueGauge.defaults,{reversed:!1});class f extends t.GaugeItem{constructor(){super(...arguments),this._args={gauge:null,value:NaN}}getStyle(e,t){if(this._op.styleCallback){this._args.gauge=e,this._args.value=t;return this._op.styleCallback(this._args)}}}class k extends v{_doInitChildren(e){super._doInitChildren(e),e.valueBar=(this._valueBar=new f(this)).init(),e.band=(this._band=new t.GaugeRangeBand(this)).init()}get valueBar(){return this._valueBar}get band(){return this._band}}k.type=t.LinearGaugeType;class C extends t.ChartItem{}C.defaults=t.extend(t.ChartItem.defaults,{opposite:!1,gap:10});class S extends V{}S.defaults=t.extend(V.defaults,{gap:10});class E extends t.GaugeGroup{_doInitChildren(e){super._doInitChildren(e),e.label=(this._label=new S(this.chart)).init(),e.itemLabel=(this._itemLabel=new C(this.chart)).init(),e.scale=(this._scale=new y(this)).init()}get label(){return this._label}get itemLabel(){return this._itemLabel}get scale(){return this._scale}calcedMinMax(){return this.scale.range()}}E.defaults=t.extend(t.GaugeGroup.defaults,{vertical:!1,itemGap:10});class R extends E{_doInitChildren(e){super._doInitChildren(e),e.band=(this._band=new t.GaugeRangeBand(this)).init()}get band(){return this._band}_gaugesType(){return"linear"}_doPrepareRender(e){super._doPrepareRender(e),this.band.visible&&this.band._prepareRender()}}R.type=t.LinearGaugeGroupType,R.gaugeType=t.LinearGaugeType;class G extends t.ScaleView{_createLine(e,i){return new t.LineElement(e,i)}_doMeasure(e,i,s,a,n){const l=i.options,r=i._reversed,h=i._vertical,o=i.label,c=i.tick,d=i._steps,u=d.length;let _=h?l.gap:s,g=h?a:l.gap;if(this._tickContainer.setVis(c.visible)&&(this._tickContainer.setStyleOrClass(c._style),this._ticks.prepare(u)),h?_+=c.options.length:g+=c.options.length,this._labelContainer.setVis(o.visible)&&(this._labels.prepare(u,(t=>{t.setModel(e,o,null,null)})),u>0))if(h){let e=0;this._labels.forEach(((i,s)=>{i.setText(o.getText(d[r?s:u-1-s])),e=t.maxv(i.getBBox().width)})),_+=e}else{let e=0;this._labels.forEach(((i,s)=>{i.setText(o.getText(d[r?u-1-s:s])),e=t.maxv(i.getBBox().height)})),g+=e}return{width:_,height:g}}_doLayout(){const e=this.model;e._vertical?this.$_layoutVert(e,this.width,this.height):this.$_layoutHorz(e,this.width,this.height)}$_layoutHorz(e,t,i){const s=e.options,a=this._line,n=e.tick,l=e._steps;l.length;const r="opposite"===s.position,h=r?-n.options.length:n.options.length;let o,c=r?i-s.gap:s.gap;if(a.setVis(e.line.visible)&&(a.setStyleOrClass(e.line._style),a.setHLine(c,0,t)),this._tickContainer.setVis(n.visible)&&this._ticks.forEach(((i,s)=>{o=e.getRate(l[s])*t,i.setVLine(o,c,c+h)})),this._labelContainer.visible){const i=this._labelContainer.textAlign()||"center";let s=Number.MIN_SAFE_INTEGER;c=r?0:c+h,this._labels.forEach(((a,n)=>{a.layout(i);const r=a.getBBox();o=e.getRate(l[n])*t,a.setVis(o-r.width/2>s)&&(a.trans(o-r.width/2,c),s=o+r.width/2)}))}}$_layoutVert(e,t,i){const s=e.options,a=this._line,n=e.tick,l=e._steps;this.height,l.length;const r="opposite"===s.position,h=r?n.options.length:-n.options.length;let o,c=r?s.gap:t-s.gap;if(a.setVis(e.line.visible)&&(a.setStyleOrClass(e.line._style),a.setVLine(c,0,i)),this._tickContainer.setVis(n.visible)&&this._ticks.forEach(((t,s)=>{o=e.getRate(l[s])*i,t.setHLine(o,c,c+h)})),this._labelContainer.visible){const a=this._labelContainer.textAlign()||(r?"left":"right");c=r?c+h:t-s.gap+h,this._labels.forEach(((t,s)=>{t.layout(a);const n=t.getBBox(),h=r?c:c-n.width;o=e.getRate(l[s])*i,t.trans(h,o-n.height/2)}))}}}class B extends t.ValueGaugeView{_measureLabelSize(e,i,s){const a=e.label,n=this.labelView();return a.setText(e.getLabel(a,e.options.value)),n.text=a.options.text,a.buildSvg(n,null,i,s,e,a._domain),t.rectToSize(n.getBBox())}_renderGauge(e,i){const s=this.model,a=t.pickNum(s._runValue,s.options.value);this._measureGauge(s,s.label,this.labelView(),a,s.isVertical(),e,i),this._renderValue()}_renderValue(){const e=this.model,i=e.label,s=e.scale,a=this.labelView(),n=t.pickNum(e._runValue,e.options.value),l=t.assignObj({},this._rBand);if(this._renderScale(l),this.background().setRect(l),l.height>0&&this._renderBand(e,l,n),"top"!==i._runPos&&"bottom"!==i._runPos||(this._rLabel.height=l.height),this._renderLabel(e,i,a,n),!this._vertical&&("left"===i._runPos||"right"===i._runPos)&&s.visible&&"opposite"===s.options.position){const e=a.getBBox();a.ty+e.height>this.height&&a.transY(t.maxv(0,this.height-e.height))}}_measureGauge(e,i,s,a,n,l,r){const h=this._rBand=t.createRect(0,0,l,r);if(this._vertical=e._group instanceof E?e._group.options.vertical:n,i.visible){const n=i._runPos=t.pickProp(i.options.position,this._vertical?"top":"left"),o=i._runVert="top"===n||"bottom"===n,c=e._group?e._group.itemLabel.options.gap:i._runGap=i.getGap(o?r:l);let d=o?l:i.getWidth(l),u=o?i.getHeight(r):r;const _=o?l:i.getMaxWidth(l),g=o?i.getMaxHeight(r):r,p=this._rLabel=t.createRect(0,0,l,r);s.setStyleOrClass(i._style),i.setText(e.getLabel(i,i.options.animatable?a:e.options.value)),s.text=i.options.text,i.buildSvg(s,null,t.pickNum(d,_),t.pickNum(u,g),e,i._domain);const b=s.getBBox();switch(o?(p.height=t.pickNum(u,b.height),h.height=t.maxv(0,h.height-(p.height+c))):(p.width=t.pickNum(d,b.width),this._wLabel=e._group?e._group._labelWidth:p.width,h.width=t.maxv(0,h.width-(this._wLabel+c))),n){case"top":h.y=p.height+c;break;case"bottom":p.y=h.height+c;break;case"right":p.x=h.width+c;break;default:h.x=this._wLabel+c}}else this._rLabel=null}_renderLabel(e,i,s,a){if(s.visible){const e=this._rLabel,a=s.getBBox();let n=e.x,l=e.y;switch(i._runPos){case"top":case"bottom":n+=e.width/2;break;case"right":n=this.width-e.width,s.anchor=t.TextAnchor.START,l+=t.maxv(0,(e.height-a.height)/2);break;default:s.anchor=t.TextAnchor.END,n+=this._wLabel,l+=t.maxv(0,(e.height-a.height)/2)}s.trans(n,l)}}_renderScale(e){const i=this.model,s=i.label,a=i.scale,n=this.scaleView(),l=this._vertical?e.height:e.width;let r,h;if(a._vertical=this._vertical,a._reversed=i.options.reversed,isNaN(i._runValue)&&a.buildSteps(l,i.options.value),n.setVis(i.scaleVisible())){const i=n.measure(this.doc,a,e.width,e.height,1);this._vertical?(r=0,h=e.y,e.width=t.maxv(0,e.width-i.width),"opposite"===a.options.position?r=e.x+e.width:(s._runVert||(r=e.x),e.x+=i.width)):(r=e.x,e.height=t.maxv(0,e.height-i.height),"opposite"===a.options.position?s._runVert?(h=e.y,e.y+=i.height):(this._rLabel.y=e.y+=i.height,h=e.y-i.height):h=e.y+e.height),n.resizeByMeasured().layout().trans(r,h)}}}class T extends t.ChartElement{constructor(e){super(e,"rct-linear-gauge-band"),this._thick=0,this._gap=0,this._labelGap=3,this._barViews=new t.ElementPool(this,t.RectElement),this.add(this._labelContainer=new t.LayerElement(e,"rct-linear-gauge-band-tick-labels")),this._labels=new t.ElementPool(this._labelContainer,t.TextElement)}_doMeasure(e,i,s,a,n){const l=i.gauge,r=this._vertical=l instanceof k?l.isVertical():l.options.vertical,h="inside"===i.options.position,o=this._thick=h?r?s:a:i.getThickness(r?s:a)+(this._gap=t.pickNum(i.options.gap,0));let c=r?o:s,d=r?a:o;const u=this._ranges=i.getRanges();if(this._labelContainer.setVis(i.tickLabel.visible&&u.length>0)){const e=[u[0].fromValue].concat(u.map((e=>e.toValue)));if(this._labelContainer.setStyleOrClass(i.tickLabel._style),this._labels.prepare(u.length+1),r){let i=0;this._labels.forEach(((s,a)=>{s.text=String(e[a]),i=t.maxv(s.getBBox().width)})),c+=i+this._labelGap}else{let i=0;this._labels.forEach(((s,a)=>{s.text=String(e[a]),i=t.maxv(s.getBBox().height)})),d+=i}}return{width:c,height:d}}_doLayout(e){const t=this.model,i=t.gauge,s=i.scale,a=s._max-s._min;this._labelContainer.setVis(this.$_layoutBars(i,a,this._ranges)&&this._labelContainer.visible&&"inside"!==t.options.position)&&this.$_layoutLabels(i,a,this._ranges)}$_layoutBars(e,t,i){if(this._barViews.prepare(i.length),!this._barViews.isEmpty&&t>0){const e=this._vertical,s="inside"===this.model.options.position,a="opposite"===this.model.options.position,n=this.width,l=this.height,r=e?l:n,h=this._thick;let o=0;return this._barViews.prepare(i.length).forEach(((c,d)=>{const u=i[d],_=r*(u.toValue-u.fromValue)/t;if(e){const e=s||a?0:n-h;c.setBounds(e,l-o-_,h,_)}else{const e=a?l-h:0;c.setBounds(o,e,_,this._thick)}c.internalClearStyleAndClass(),c.setFill(u.color),u.style&&c.addStyleOrClass(u.style),o+=_})),!0}}$_layoutLabels(e,i,s){const a="opposite"===this.model.options.position;if(this._vertical){const e=this.height,n=a?t.TextAnchor.START:t.TextAnchor.END,l=a?this._thick+this._labelGap:this.width-this._thick-this._labelGap;let r=this._labels.get(0);r.anchor=n,r.trans(l,e-r.getBBox().height/2);for(let t=1;t<=s.length;t++){const a=e-e*s[t-1].toValue/i;r=this._labels.get(t),r.anchor=n,r.trans(l,a-r.getBBox().height/2)}}else{const e=this.width,t=a?0:this._thick;this._labels.get(0).trans(0,t);for(let a=1;a<=s.length;a++){const n=e*s[a-1].toValue/i;this._labels.get(a).trans(n,t)}}}}class L extends B{constructor(e){super(e,"rct-linear-gauge")}_doInitContents(e,i){i.add(this._background=new t.RectElement(e,"rct-linear-gauge-background")),i.add(this._bandView=new T(e)),i.add(this._scaleView=new G(e)),i.add(this._valueView=new t.RectElement(e,"rct-linear-gauge-value")),i.add(this._labelView=new t.TextElement(e))}_backgroundView(){return this._background}labelView(){return this._labelView}scaleView(){return this._scaleView}background(){return this._background}_prepareGauge(e,t){}_renderScale(e){const t=this.model.band,i=this._bandView;if(super._renderScale(e),i.setVis(t.visible)){const s=+t.options.gap||0,a=i.measure(this.doc,t,e.width,e.height,1);i.resizeByMeasured().layout(),this._vertical?"inside"===t.options.position?i.trans(e.x,e.y):"opposite"===t.options.position?(i.trans(e.x+e.width-a.width,e.y),e.width-=a.width+s):(i.trans(e.x,e.y),e.width-=a.width+s,e.x+=a.width+s):"inside"===t.options.position?i.trans(e.x,e.y):"opposite"===t.options.position?(i.trans(e.x,e.y),e.height-=a.height+s,e.y+=a.height+s):(i.trans(e.x,e.y+e.height-a.height),e.height-=a.height+s)}}_renderBand(e,i,s){const a=this._valueView,n=e.options.reversed,l=e.valueBar,r=e._group?e._group.scale:e.scale;if(a.setVis(!t.isEmptyRect(i)&&l.visible&&!r.isEmpty()&&!isNaN(e.options.value)))if(a.setStyleOrClass(l._style),a.internalSetStyleOrClass(l.getStyle(e,s)),this._vertical){const e=i.height*r.getRate(s),t=n?i.y:i.y+i.height-e;a.setBounds(i.x,t,i.width,e)}else{const e=i.width*r.getRate(s),t=n?i.x+i.width-e:i.x;a.setBounds(t,i.y,e,i.height)}}}class P extends t.GaugeGroupView{constructor(e,t){super(e,t)}_doInitContents(e,i){super._doInitContents(e,i),i.insertFirst(this._scaleView=new G(e)),i.insertFirst(this._textView=new t.TextElement(e,"rct-linear-gauge-group-label"))}_prepareGauge(e,t){this._textView.setVis(t.label.visible)&&this._textView.setStyleOrClass(t.label._style),this._scaleView.setVis(t.scale.visible)&&this._scaleView.setStyleOrClass(t.scale._style),super._prepareGauge(e,t)}_doRenderGauges(e,i,s,a){const n=this.model,l=n.options,r=this._textView,h=t.createRect(0,0,s,a);if(r.visible){r.text=n.label.options.text,n.label.buildSvg(r,null,NaN,NaN,n,null);const e=this._textView.getBBox().height+n.label.getGap(a);h.y+=e,h.height-=e,r.trans(this.width/2,0)}n._labelWidth=n._labelHeight=0,this._gaugeViews.forEach(((e,i)=>{const l=e._measureLabelSize(n.get(i),s,a);n._labelWidth=t.maxv(n._labelWidth,l.width),n._labelHeight=t.maxv(n._labelHeight,l.height)}));const o=t.copyObj(h),c=n.itemLabel.options.gap;l.vertical?(o.height-=n._labelHeight+c,n.itemLabel.options.opposite||(o.y+=n._labelHeight+c)):(o.width-=n._labelWidth+c,n.itemLabel.options.opposite||(o.x+=n._labelWidth+c)),this._renderScale(n,h,o),l.vertical?this.$_layoutVert(this.doc,n,i,h):this.$_layoutHorz(this.doc,n,i,h)}_renderScale(e,t,i){const s=this._scaleView,a=e.scale,n=e.options.vertical,l=n?t.height:t.width,r=[];let h,o;if(this._gaugeViews.forEach(((t,i)=>{r.push(e.get(i).getValue())})),a.buildGroupSteps(l,r),a._vertical=n,s.setVis(a.visible)){const e=s.measure(this.doc,a,i.width,i.height,1);if(n){const s=e.width;i.width-=s,t.width-=s,o=i.y,"opposite"===a.options.position?h=i.x+i.width:(h=i.x,i.x+=s,t.x+=s)}else{const s=e.height;i.height-=s,t.height-=s,h=i.x,"opposite"===a.options.position?(o=i.y,i.y+=s,t.y+=s):o=i.y+i.height}s.resizeByMeasured().layout().trans(h,o)}}$_layoutVert(e,t,i,s){const a=s.height,n=(s.width-t.options.itemGap*(i.count-1))/i.count,l=s.y;let r=s.x;i.forEach(((i,s)=>{i.measure(e,t.get(s),n,a,0),i.resize(n,a),i.layout(),i.trans(r,l),r+=n+t.options.itemGap}))}$_layoutHorz(e,t,i,s){const a=t.options.itemGap,n=s.width,l=(s.height-a*(i.count-1))/i.count,r=s.x;let h=s.y;i.forEach(((i,s)=>{i.measure(e,t.get(s),n,l,0),i.resize(n,l),i.layout(),i.trans(r,h),h+=l+a}))}}class I extends P{constructor(e){super(e,"rct-linear-gauge-group")}_doInitContents(e,t){super._doInitContents(e,t),t.insertChild(this._bandView=new T(e),this._scaleView)}_createPool(e){return new t.ElementPool(e,L)}_renderScale(e,t,i){super._renderScale(e,t,i);const s=this._bandView,a=e.band;let n,l;if(s.setVis(a.visible)){const r=+a.options.gap||0,h=s.measure(this.doc,a,i.width,i.height,1);if(e.options.vertical){const e=h.width+r;i.width-=e,t.width-=e,l=i.y,"opposite"===a.options.position?n=i.x+i.width+r:(n=i.x,i.x+=e,t.x+=e)}else{const e=h.height+r;i.height-=e,t.height-=e,n=i.x,"opposite"===a.options.position?(l=i.y,i.y+=e,t.y+=e):l=i.y+i.height+r}s.resizeByMeasured().layout().trans(n,l)}}}class D extends t.ChartItem{constructor(e){super(e.chart),this.gauge=e}getRanges(){var e;return null===(e=this.$_internalRanges())||void 0===e?void 0:e.slice(0)}_doApply(e){const t=this;var i;super._doApply(e),(i=e.ranges)!==t._ranges&&(t._ranges=i,t._runRanges=null)}$_internalRanges(){if(!this._runRanges){const e=this.gauge.options;this._runRanges=t.buildValueRanges(this._ranges,e.minValue,e.maxValue,this._op.rangeInclusive)}return this._runRanges}}D.defaults=t.extend(t.ChartItem.defaults,{vertical:!0,rangeInclusive:!0});class O extends t.GaugeItem{}O.defaults=t.extend(t.ChartItem.defaults,{visible:!0});class N extends f{}class A extends v{_doInitChildren(e){super._doInitChildren(e),e.band=(this._band=new D(this)).init(),e.targetBar=(this._targetBar=new O(this)).init(),e.valueBar=(this._valueBar=new N(this)).init()}get band(){return this._band}get targetBar(){return this._targetBar}get valueBar(){return this._valueBar}getRanges(e,i,s){return t.buildValueRanges(this._op.ranges,e,i,t.pickProp(s,this._op.rangeInclusive))}}A.type=t.BulletGaugeType,A.defaults=t.extend(v.defaults,{rangeInclusive:!0});class H extends E{getRanges(e,i,s){return t.buildValueRanges(this._op.ranges,e,i,t.pickProp(s,this._op.rangeInclusive))}_gaugesType(){return"bullet"}}H.type=t.BulletGaugeGroupType,H.gaugeType=t.BulletGaugeType,H.defaults=t.extend(E.defaults,{rangeInclusive:!0});class $ extends B{constructor(e){super(e,"rct-bullet-gage")}_doInitContents(e,i){i.add(this._background=new t.RectElement(e,"rct-bullet-gauge-background")),i.add(this._barContainer=new t.LayerElement(e,void 0)),this._barViews=new t.ElementPool(this._barContainer,t.RectElement),i.add(this._valueView=new t.RectElement(e,"rct-bullet-gauge-value")),i.add(this._targetView=new t.RectElement(e,"rct-bullet-gauge-target")),i.add(this._scaleView=new G(e)),i.add(this._labelView=new t.TextElement(e))}_backgroundView(){return this._background}labelView(){return this._labelView}scaleView(){return this._scaleView}background(){return this._background}_prepareGauge(e,t){}_renderBand(e,i,s){const a=e.options,n=e._group,l=e.options.reversed,r=this._vertical,h=n?n.scale:e.scale,o=this._valueView,c=this._targetView;if(this._barContainer.setVis(!t.isEmptyRect(i)&&!h.isEmpty())){const t=e.getRanges(h._min,h._max,!1)||(null==n?void 0:n.getRanges(h._min,h._max,!1));t&&(this._barContainer.setRect(i),this._barViews.prepare(t.length),r?this._barViews.forEach(((e,s)=>{const a=t[s],n=i.height*h.getRate(a.toValue-a.fromValue),r=i.height*h.getRate(a.fromValue);e.setBounds(0,l?r:i.height-r-n,i.width,n),e.internalClearStyleAndClass(),e.setFill(a.color),a.style&&e.addStyleOrClass(a.style)})):this._barViews.forEach(((e,s)=>{const a=t[s],n=i.width*h.getRate(a.toValue-a.fromValue),r=i.width*h.getRate(a.fromValue);e.setBounds(l?i.width-n-r:r,0,n,i.height),e.internalClearStyleAndClass(),e.setFill(a.color),a.style&&e.addStyleOrClass(a.style)})))}if(o.setVis(e.valueBar.visible&&!h.isEmpty()&&!isNaN(s)))if(o.setStyleOrClass(e.valueBar._style),s<a.targetValue&&e.valueBar.options.belowStyle&&o.internalSetStyleOrClass(e.valueBar.options.belowStyle),o.internalSetStyleOrClass(e.valueBar.getStyle(e,s)),r){const e=i.height*h.getRate(s),t=l?i.y:i.y+i.height-e;o.setBounds(i.x+i.width/3,t,i.width/3,e)}else{const e=i.width*h.getRate(s),t=l?i.x+i.width-e:i.x;o.setBounds(t,i.y+i.height/3,e,i.height/3)}if(c.setVis(e.targetBar.visible&&!h.isEmpty()&&!isNaN(a.targetValue)))if(c.setStyleOrClass(e.targetBar._style),r&&i.width>10){let e=i.height*h.getRate(a.targetValue);e=l?i.y+e:i.y+i.height-e,c.setBounds(i.x+5,e-1,i.width-10,3)}else if(!r&&i.height>10){let e=i.width*h.getRate(a.targetValue);e=l?i.x+i.width-e:i.x+e,c.setBounds(e-1,i.y+5,3,i.height-10)}}}class M extends P{constructor(e){super(e,"rct-bullet-gauge-group")}_createPool(e){return new t.ElementPool(e,$)}}class z extends t.GaugeItem{getThickness(e){return t.calcPercent(this._thicknessDim,e,e)}_doApply(e){super._doApply(e),this._setDim(e,"thickness")}}z.defaults=t.extend(t.ChartItem.defaults,{thickness:7});class W extends t.GaugeItem{getLength(e){return t.calcPercent(this._lengthDim,e,e)}_doApply(e){super._doApply(e),this._setDim(e,"length")}}W.defaults=t.extend(t.ChartItem.defaults,{thickness:7,length:"60%"});class F extends W{}F.defaults=t.extend(W.defaults,{thickness:5,length:"85%"});class j extends W{}j.defaults=t.extend(W.defaults,{thickness:2,length:"95%",animatable:!1,duration:200});class Y extends t.GaugeItem{constructor(e,t){super(e),this.length=t}}class X extends t.GaugeItem{}X.defaults=t.extend(t.ChartItem.defaults,{step:1,offset:1});class U extends t.GaugeItem{constructor(e,t){super(e),this.raidus=t}}class q extends t.ChartText{constructor(e){super(e.chart)}}q.defaults=t.extend(t.ChartText.defaults,{text:"RealChart Clock<br>ver1.0",position:"top"});class J extends t.Gauge{_doInitChildren(e){super._doInitChildren(e),e.rim=(this.rim=new z(this)).init(),e.hourHand=(this.hourHand=new W(this)).init(),e.minuteHand=(this.minuteHand=new F(this)).init(),e.secondHand=(this.secondHand=new j(this)).init(),e.tick=(this.tick=new Y(this,10)).init(),e.minorTick=(this.minorTick=new Y(this,5)).init(),e.tickLabel=(this.tickLabel=new X(this)).init(),e.pin=(this.pin=new U(this,5)).init(),e.label=(this.label=new q(this)).init()}getTime(){const e=this._op;return e.time instanceof Date?e.time:t.isString(e.time)?new Date(e.time):isNaN(e.time)?void 0:new Date(e.time)}getExtents(e,i){const s=t.minv(e,i);return{cx:t.calcPercent(this._centerXDim,e,e/2),cy:t.calcPercent(this._centerYDim,i,i/3),rd:t.calcPercent(this._radiusDim,s,s/2)}}_doApply(e){const i=this;var s,a,n;super._doApply(e),s=e.centerX,a=e.centerY,n=e.radius,(i._centerXDim||s!==i._centerX)&&(i._centerXDim=t.parsePercentSize(t.pickProp(i._centerX=s,t.CircularGauge.DEF_CENTER),!0)),i._centerYDim&&a===i._centerY||(i._centerYDim=t.parsePercentSize(t.pickProp(i._centerY=a,t.CircularGauge.DEF_CENTER),!0)),i._radiusDim&&n===i._radius||(i._radiusDim=t.parsePercentSize(t.pickProp(i._radius=n,t.CircularGauge.DEF_RADIUS),!0))}}J.type=t.ClockGaugeType,J.defaults=t.extend(t.Gauge.defaults,{centerX:"50%",centerY:"50%",radius:"40%",active:!0});class K extends t.RcAnimation{constructor(e){super(),this.view=e}_doUpdate(e){return this.view._secRate=e,this.view.$_renderHands(this.view.model,this.view._exts),!0}}class Q extends t.GaugeView{constructor(e){super(e,"rct-clock-gauge"),this._rimThick=0,this._secRate=1}_doInitContents(e,i){i.add(this._faceView=new t.CircleElement(e,"rct-clock-gauge-face")),i.add(this._rimView=new t.SectorElement(e,"rct-clock-gauge-rim")),i.add(this._labelView=new t.TextElement(e,"rct-clock-gauge-label")),this._labelView.layout=t.TextLayout.MIDDLE,i.add(this._tickContainer=new t.LayerElement(e,"rct-clock-gauge-ticks")),i.add(this._tickLabelContainer=new t.LayerElement(e,"rct-clock-gauge-tick-labels")),i.add(this._hourView=new t.PathElement(e,"rct-clock-gauge-hour")),i.add(this._minuteView=new t.PathElement(e,"rct-clock-gauge-minute")),i.add(this._secondView=new t.PathElement(e,"rct-clock-gauge-second")),i.add(this._pinView=new t.CircleElement(e,"rct-clock-gauge-pin")),this._tickViews=new t.ElementPool(this._tickContainer,t.LineElement,"rct-clock-gauge-tick"),this._minorTickViews=new t.ElementPool(this._tickContainer,t.LineElement,"rct-clock-gauge-minor-tick"),this._tickLabelViews=new t.ElementPool(this._tickLabelContainer,t.TextElement,"rct-clock-gauge-tick-label")}_prepareGauge(e,i){this._tickViews.prepare(i.tick.visible?12:0),this._minorTickViews.prepare(i.minorTick.visible?48:0);const s=Math.round(12/t.maxv(1,Math.floor(i.tickLabel.options.step)||1));this._tickLabelViews.prepare(i.tickLabel.visible?s:0,(e=>{e.layout=t.TextLayout.MIDDLE}))}_renderGauge(e,i){const s=this.model,a=this._exts=s.getExtents(e,i);this._secRate=1,this.$_renderFace(s,a),this.$_renderHands(s,a),s.options.active&&!s.getTime()?this._runner||(this._runner=setInterval((()=>{const e=this._prevSec;this.$_renderHands(this.model,this._exts),t.absv(e-this._prevSec)>=1&&this._secondView.visible&&s.chart.animatable()&&s.secondHand.options.animatable&&this.$_moveSecond(e)}),1e3)):this._runner&&(clearInterval(this._runner),this._runner=void 0)}$_renderFace(e,i){const s=this._labelView,a=this._rimView,n=this._minorTickViews,l=this._tickLabelViews,r=this._pinView,{cx:h,cy:o,rd:c}=i,d=this._rimThick=a.visible?e.rim.getThickness(c):0;this._faceView.setCircle(h,o,c),a.setVis(e.rim.visible)&&(a.internalSetStyleOrClass(e.rim._style),a.setSector({cx:h,cy:o,rx:c,ry:c,innerRadius:1-d/c,start:0,angle:2*Math.PI,clockwise:!0}));const u=c-d;let _=u-e.tick.length,g=t.ORG_ANGLE,p=t.PI_2/12;if(this._tickViews.forEach(((i,s)=>{i.setLine(h+t.cos(g)*u,o+t.sin(g)*u,h+t.cos(g)*_,o+t.sin(g)*_),i.internalSetStyleOrClass(e.tick._style),g+=p})),!n.isEmpty){let i=0;_=u-e.minorTick.length,g=t.ORG_ANGLE,p=t.PI_2/60,n.forEach((s=>{i%5==0&&(g+=p,i++),s.setLine(h+t.cos(g)*u,o+t.sin(g)*u,h+t.cos(g)*_,o+t.sin(g)*_),s.internalSetStyleOrClass(e.minorTick._style),g+=p,i++}))}if(!l.isEmpty){const i=12/l.count,s=t.PI_2/12*i;g=t.ORG_ANGLE,l.get(0).text="12",_=u-(e.tick.length+e.tickLabel.options.offset||0),_-=.5*l.get(0).getBBox().height,l.forEach(((a,n,l)=>{a.text=String(0===n?12:n*i),a.trans(h+t.cos(g)*_,o+t.sin(g)*_),a.internalSetStyleOrClass(e.tickLabel._style),g+=s}))}r.setVis(e.pin.visible)&&(r.setCircle(h,o,e.pin.raidus),r.setStyleOrClass(e.pin._style)),s.setVis(e.label.visible)&&(s.internalSetStyleOrClass(e.label._style),e.label.buildSvg(s,null,NaN,NaN,null,null),"bottom"===e.label.options.position?s.trans(h,o+_/2):s.trans(h,o-_/2))}$_getNow(){const e=this.model.options.timezone;let t=this.model.getTime()||new Date;if(!isNaN(e)){const i=t.getMinutes()+(t.getTimezoneOffset()+e);t.setMinutes(i)}return t}$_renderHands(e,i){const s=this.$_getNow(),a=s.getHours(),n=s.getMinutes(),l=s.getSeconds(),{cx:r,cy:h,rd:o}=i,c=new t.PathBuilder;let d,u,_,g;d=e.hourHand,u=this._hourView,u.setVis(d.visible)&&(g=t.PI_2*(a/12+n/60/12+l/60/60/12),_=d.getLength(o-this._rimThick),c.rect(-d.options.thickness/2,-_,d.options.thickness,_),u.internalSetStyleOrClass(d._style),u.setPath(c.close(!0)).trans(r,h).rotate(g*t.RAD_DEG)),d=e.minuteHand,u=this._minuteView,u.setVis(d.visible)&&(g=t.PI_2*(n/60+l/60/60),_=d.getLength(o-this._rimThick),c.rect(-d.options.thickness/2,-_,d.options.thickness,_),u.internalSetStyleOrClass(d._style),u.setPath(c.close(!0)).trans(r,h).rotate(g*t.RAD_DEG)),d=e.secondHand,u=this._secondView,u.setVis(d.visible)&&(g=this._secRate<1?t.PI_2*(this._aniSec+this._secRate)/60:t.PI_2*l/60,_=d.getLength(o-this._rimThick),c.rect(-d.options.thickness/2,-_,d.options.thickness,_),u.internalSetStyleOrClass(d._style),u.setPath(c.close(!0)).trans(r,h).rotate(g*t.RAD_DEG),this._prevSec=l)}$_moveSecond(e){if(!isNaN(e)){this._aniSec=e;const t=new K(this);t.duration=this.model.secondHand.options.duration||200,t.start()}}}function Z(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Gauge.register(A,d,J,k),e.GaugeGroup.register(H,u,R),e.GaugeView.register([d,m],[k,L],[A,$],[J,Q],[u,x],[R,I],[H,M]))}Z(s),e.BulletGauge=A,e.CircleGauge=d,e.ClockGauge=J,e.LinearGauge=k,e.default=Z,Object.defineProperty(e,"__esModule",{value:!0})}));