@spike-rabbit/charts-ng 49.0.0-next.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.
@@ -0,0 +1,3588 @@
1
+ import * as i0 from '@angular/core';
2
+ import { ChangeDetectionStrategy, Component, viewChild, input, output, viewChildren, model, signal, inject, ChangeDetectorRef, NgZone, HostListener, booleanAttribute, LOCALE_ID, computed, SimpleChange, NgModule } from '@angular/core';
3
+ import { Subscription } from 'rxjs';
4
+ import { BarChart, CandlestickChart, CustomChart, GaugeChart, HeatmapChart, LineChart, PieChart, ScatterChart, SankeyChart, SunburstChart } from 'echarts/charts';
5
+ import { AxisPointerComponent, BrushComponent, DataZoomInsideComponent, DataZoomSliderComponent, DatasetComponent, GridComponent, LegendComponent, LegendScrollComponent, MarkAreaComponent, MarkLineComponent, MarkPointComponent, PolarComponent, SingleAxisComponent, TitleComponent, ToolboxComponent, TooltipComponent, VisualMapComponent } from 'echarts/components';
6
+ import * as echarts from 'echarts/core';
7
+ export { echarts };
8
+ import { CanvasRenderer, SVGRenderer } from 'echarts/renderers';
9
+ import { CommonModule } from '@angular/common';
10
+
11
+ /**
12
+ * Copyright (c) Siemens 2016 - 2025
13
+ * SPDX-License-Identifier: MIT
14
+ */
15
+ echarts.use([
16
+ // components
17
+ AxisPointerComponent,
18
+ BrushComponent,
19
+ DataZoomInsideComponent,
20
+ DataZoomSliderComponent,
21
+ DatasetComponent,
22
+ GridComponent,
23
+ LegendComponent,
24
+ LegendScrollComponent,
25
+ MarkAreaComponent,
26
+ MarkLineComponent,
27
+ MarkPointComponent,
28
+ PolarComponent,
29
+ SingleAxisComponent,
30
+ TitleComponent,
31
+ ToolboxComponent,
32
+ TooltipComponent,
33
+ VisualMapComponent,
34
+ // chart types
35
+ BarChart,
36
+ CandlestickChart,
37
+ CustomChart,
38
+ GaugeChart,
39
+ HeatmapChart,
40
+ LineChart,
41
+ PieChart,
42
+ ScatterChart,
43
+ SankeyChart,
44
+ SunburstChart,
45
+ // renderers
46
+ CanvasRenderer,
47
+ SVGRenderer
48
+ ]);
49
+
50
+ /**
51
+ * Copyright (c) Siemens 2016 - 2025
52
+ * SPDX-License-Identifier: MIT
53
+ */
54
+ const getProp = (style, prop) => {
55
+ return style.getPropertyValue(prop);
56
+ };
57
+ const candleStickValues = ['open', 'close', 'lowest', 'highest'];
58
+ const tooltipFormatter = (p) => {
59
+ const params = Array.isArray(p) ? p : [p];
60
+ const label = params[0]?.axisValueLabel ?? '';
61
+ let html = label;
62
+ for (const series of params) {
63
+ const isCandle = series.componentSubType === 'candlestick';
64
+ const isPie = series.componentSubType === 'pie';
65
+ const useName = series.name != series.axisValue;
66
+ const name = isPie
67
+ ? series.data.name
68
+ : useName
69
+ ? // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
70
+ series.name || series.seriesName
71
+ : series.seriesName;
72
+ const valIndex = (series.encode.value ?? series.encode.y)[0];
73
+ const value = isCandle
74
+ ? ''
75
+ : isPie
76
+ ? series.percent + '%'
77
+ : Array.isArray(series.value)
78
+ ? series.value[valIndex]
79
+ : series.value;
80
+ html += '<div style="display: flex; align-items: center;">';
81
+ html += series.marker?.replace('margin-right', 'margin-inline-end');
82
+ html += `<span style="margin-inline: 4px 8px">${name}</span>`;
83
+ html += `<span style="margin-inline-start: auto">${value}</span>`;
84
+ html += '</div>';
85
+ if (isCandle) {
86
+ const miniMarker = `<span style="display:inline-block;vertical-align:middle;margin-inline:3px 8px;border-radius:4px;width:4px;height:4px;background:${series.color};"></span>`;
87
+ for (let i = 0; i < candleStickValues.length; i++) {
88
+ const v = candleStickValues[i];
89
+ const idx = series.encode.y[i];
90
+ html += '<div style="display: flex; align-items: center;">';
91
+ html += miniMarker;
92
+ html += `<span style="margin-inline-end: 8px">${v}</span>`;
93
+ html += `<span style="margin-inline-start: auto">${series.value[idx]}</span>`;
94
+ html += '</div>';
95
+ }
96
+ }
97
+ }
98
+ return html;
99
+ };
100
+ const themeElement = {
101
+ name: 'element',
102
+ style: () => {
103
+ const style = window.getComputedStyle(document.documentElement);
104
+ const elementUi0 = getProp(style, '--element-ui-0');
105
+ const elementUi0Hover = getProp(style, '--element-ui-0-hover');
106
+ const elementUi1 = getProp(style, '--element-ui-1');
107
+ const elementUi2 = getProp(style, '--element-ui-2');
108
+ const elementUi3 = getProp(style, '--element-ui-3');
109
+ const elementUi4 = getProp(style, '--element-ui-4');
110
+ const elementBase0 = getProp(style, '--element-base-0');
111
+ const elementBase1 = getProp(style, '--element-base-1');
112
+ const elementTextPrimary = getProp(style, '--element-text-primary');
113
+ const elementTextSecondary = getProp(style, '--element-text-secondary');
114
+ const elementTextInverse = getProp(style, '--element-text-inverse');
115
+ // The order of colors is provided by ux.
116
+ const colorPalettes = {
117
+ default: [
118
+ getProp(style, '--element-data-1'), // $siemens-data-petrol,
119
+ getProp(style, '--element-data-2'), // $siemens-data-turquoise-900,
120
+ getProp(style, '--element-data-4'), // $siemens-data-turquoise-700,
121
+ getProp(style, '--element-data-6'), // $siemens-data-interactive-coral-900,
122
+ getProp(style, '--element-data-5'), // $siemens-data-royal-blue-500,
123
+ getProp(style, '--element-data-7'), // $siemens-data-purple-700,
124
+ getProp(style, '--element-data-8'), // $siemens-data-purple-900,
125
+ getProp(style, '--element-data-9'), // $siemens-data-orchid-700,
126
+ getProp(style, '--element-data-11'), // $siemens-data-plum-900,
127
+ getProp(style, '--element-data-12'), // $siemens-data-plum-500
128
+ getProp(style, '--element-data-13'), // $siemens-data-royal-blue-700,
129
+ getProp(style, '--element-data-16'), // $siemens-data-sand-700,
130
+ getProp(style, '--element-data-17'), // $siemens-data-deep-blue-700
131
+ getProp(style, '--element-data-3'), // $siemens-data-green-700,
132
+ getProp(style, '--element-data-10'), // $siemens-data-red-700,
133
+ getProp(style, '--element-data-14'), // $siemens-data-orange-900,
134
+ getProp(style, '--element-data-15') // $siemens-data-yellow-900,
135
+ ]
136
+ };
137
+ const gradientColors = {
138
+ default: [
139
+ getProp(style, '--element-data-1'), // $siemens-data-petrol,
140
+ getProp(style, '--element-data-2') // $siemens-data-turquoise-900,
141
+ ]
142
+ };
143
+ const axisFontSize = 12;
144
+ const axisLineHeight = 12;
145
+ const axisLineColor = elementUi4;
146
+ const rootFontSizeRaw = getProp(style, 'font-size');
147
+ const rootFontSize = rootFontSizeRaw.endsWith('px') ? parseInt(rootFontSizeRaw) : 16;
148
+ // value based on body-2
149
+ const fontSize = rootFontSize * 0.875;
150
+ // diverging here by intention
151
+ const lineHeight = fontSize;
152
+ const textColor = elementTextPrimary;
153
+ const candlestickBull = colorPalettes.default[4];
154
+ const candlestickBear = colorPalettes.default[12];
155
+ const dataZoomFillerColor = echarts.color.modifyAlpha(elementUi4, 0.4);
156
+ const dataZoomBrushColor = elementUi0;
157
+ const dataZoomAreaColor = elementUi4;
158
+ const dataZoomLineColor = elementUi2;
159
+ const dataZoomHandleIcon = 'path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z';
160
+ const dataZoomHandleColor = elementUi0;
161
+ const tooltipBackground = echarts.color.modifyAlpha(elementUi1, 0.8);
162
+ const rtl = style.direction === 'rtl';
163
+ // For E2E testing to get rid of font-loading instability.
164
+ const fontFamily = navigator.webdriver ? 'sans-serif' : undefined;
165
+ return {
166
+ textStyle: {
167
+ fontFamily
168
+ },
169
+ color: colorPalettes.default,
170
+ gradientColor: gradientColors.default,
171
+ backgroundColor: 'transparent',
172
+ animationDuration: 700,
173
+ title: {
174
+ padding: [10, 0, 0, 10],
175
+ textStyle: {
176
+ fontFamily,
177
+ lineHeight,
178
+ fontSize,
179
+ color: textColor
180
+ },
181
+ subtextStyle: {
182
+ fontFamily,
183
+ lineHeight,
184
+ fontSize,
185
+ color: elementTextSecondary
186
+ }
187
+ },
188
+ legend: {
189
+ backgroundColor: 'transparent',
190
+ inactiveColor: elementUi3,
191
+ left: 'auto',
192
+ right: 20,
193
+ top: 35,
194
+ textStyle: {
195
+ fontFamily,
196
+ color: textColor,
197
+ lineHeight,
198
+ fontSize
199
+ },
200
+ icon: 'circle',
201
+ pageTextStyle: {
202
+ color: textColor
203
+ },
204
+ itemStyle: {
205
+ borderWidth: 0,
206
+ itemGap: 12
207
+ }
208
+ },
209
+ tooltip: {
210
+ borderWidth: 0,
211
+ backgroundColor: tooltipBackground,
212
+ textStyle: {
213
+ fontFamily,
214
+ color: 'var(--element-text-inverse)',
215
+ fontWeight: 400
216
+ },
217
+ padding: [8, 12, 8, 12],
218
+ axisPointer: {
219
+ crossStyle: {
220
+ color: elementUi3,
221
+ width: 1
222
+ }
223
+ },
224
+ formatter: tooltipFormatter
225
+ },
226
+ axisPointer: {
227
+ label: {
228
+ fontFamily,
229
+ color: elementTextInverse,
230
+ backgroundColor: elementUi1,
231
+ lineHeight: axisLineHeight,
232
+ fontSize: axisFontSize
233
+ },
234
+ lineStyle: {
235
+ color: elementUi3,
236
+ width: 2
237
+ },
238
+ handle: {
239
+ color: 'rgba(0,0,0,0)',
240
+ margin: 0
241
+ }
242
+ },
243
+ grid: {
244
+ top: 85,
245
+ left: 32,
246
+ right: 32,
247
+ bottom: 30,
248
+ containLabel: true
249
+ },
250
+ valueAxis: {
251
+ nameTextStyle: {
252
+ fontFamily,
253
+ color: elementTextSecondary
254
+ },
255
+ axisLine: {
256
+ show: true,
257
+ lineStyle: {
258
+ color: axisLineColor
259
+ }
260
+ },
261
+ axisLabel: {
262
+ fontFamily,
263
+ color: textColor,
264
+ lineHeight: axisLineHeight,
265
+ fontSize: axisFontSize,
266
+ hideOverlap: true
267
+ },
268
+ axisTick: {
269
+ alignWithLabel: true
270
+ },
271
+ splitLine: {
272
+ lineStyle: {
273
+ color: axisLineColor
274
+ }
275
+ }
276
+ },
277
+ timeAxis: {
278
+ inverse: rtl,
279
+ nameTextStyle: {
280
+ fontFamily,
281
+ color: elementTextSecondary
282
+ },
283
+ axisLine: {
284
+ show: true,
285
+ lineStyle: {
286
+ color: axisLineColor
287
+ }
288
+ },
289
+ axisLabel: {
290
+ fontFamily,
291
+ color: textColor,
292
+ lineHeight: axisLineHeight,
293
+ fontSize: axisFontSize,
294
+ hideOverlap: true
295
+ },
296
+ axisTick: {
297
+ alignWithLabel: true
298
+ },
299
+ splitLine: {
300
+ lineStyle: {
301
+ color: axisLineColor
302
+ }
303
+ }
304
+ },
305
+ categoryAxis: {
306
+ inverse: rtl,
307
+ nameTextStyle: {
308
+ fontFamily,
309
+ color: elementTextSecondary
310
+ },
311
+ axisLine: {
312
+ show: true,
313
+ lineStyle: {
314
+ color: axisLineColor
315
+ }
316
+ },
317
+ axisLabel: {
318
+ fontFamily,
319
+ color: textColor,
320
+ lineHeight: axisLineHeight,
321
+ fontSize: axisFontSize,
322
+ hideOverlap: true
323
+ },
324
+ axisTick: {
325
+ alignWithLabel: true
326
+ },
327
+ splitLine: {
328
+ lineStyle: {
329
+ color: axisLineColor
330
+ }
331
+ }
332
+ },
333
+ dataZoom: {
334
+ textStyle: {
335
+ fontFamily,
336
+ color: textColor,
337
+ lineHeight: axisLineHeight,
338
+ fontSize: axisFontSize
339
+ },
340
+ borderColor: elementUi4,
341
+ fillerColor: dataZoomFillerColor,
342
+ handleIcon: dataZoomHandleIcon,
343
+ handleStyle: {
344
+ color: dataZoomHandleColor,
345
+ borderColor: elementUi4
346
+ },
347
+ moveHandleStyle: {
348
+ color: elementUi4,
349
+ opacity: 1
350
+ },
351
+ brushStyle: {
352
+ color: dataZoomBrushColor
353
+ },
354
+ dataBackground: {
355
+ areaStyle: {
356
+ color: dataZoomAreaColor
357
+ },
358
+ lineStyle: {
359
+ color: dataZoomLineColor
360
+ }
361
+ },
362
+ selectedDataBackground: {
363
+ areaStyle: {
364
+ color: dataZoomLineColor
365
+ },
366
+ lineStyle: {
367
+ color: dataZoomLineColor
368
+ }
369
+ },
370
+ emphasis: {
371
+ moveHandleStyle: {
372
+ color: elementUi0Hover,
373
+ opacity: 1
374
+ },
375
+ handleStyle: {
376
+ color: elementUi0Hover,
377
+ borderColor: elementUi4
378
+ }
379
+ }
380
+ },
381
+ toolbox: {
382
+ feature: {
383
+ dataZoom: {
384
+ brushStyle: {
385
+ color: dataZoomFillerColor
386
+ }
387
+ }
388
+ }
389
+ },
390
+ // different chart types
391
+ graph: {
392
+ color: colorPalettes.default
393
+ },
394
+ bar: {
395
+ barGap: 0,
396
+ label: {
397
+ fontFamily,
398
+ color: elementTextSecondary,
399
+ fontSize
400
+ }
401
+ },
402
+ line: {
403
+ areaStyle: {
404
+ opacity: 0.3
405
+ },
406
+ symbol: 'circle'
407
+ },
408
+ pie: {
409
+ label: {
410
+ fontFamily,
411
+ formatter: '{d}%',
412
+ color: elementTextSecondary,
413
+ lineHeight,
414
+ fontSize
415
+ },
416
+ labelLine: {
417
+ lineStyle: {
418
+ color: elementTextSecondary
419
+ }
420
+ },
421
+ itemStyle: {
422
+ borderWidth: 2,
423
+ borderColor: elementBase1
424
+ }
425
+ },
426
+ candlestick: {
427
+ itemStyle: {
428
+ color: candlestickBull,
429
+ color0: candlestickBear,
430
+ borderColor: candlestickBull,
431
+ borderColor0: candlestickBear
432
+ }
433
+ },
434
+ gauge: {
435
+ detail: {
436
+ color: elementTextPrimary,
437
+ rich: {
438
+ value: {
439
+ color: elementTextPrimary
440
+ },
441
+ unit: {
442
+ color: elementTextPrimary
443
+ }
444
+ }
445
+ },
446
+ axisLabel: {
447
+ fontFamily,
448
+ color: elementTextPrimary
449
+ },
450
+ axisTick: {
451
+ lineStyle: {
452
+ color: axisLineColor
453
+ }
454
+ },
455
+ splitLine: {
456
+ lineStyle: {
457
+ color: axisLineColor
458
+ }
459
+ }
460
+ },
461
+ sankey: {
462
+ label: {
463
+ fontFamily,
464
+ textBorderColor: 'transparent',
465
+ color: textColor
466
+ }
467
+ },
468
+ sunburst: {
469
+ label: {
470
+ fontFamily,
471
+ textBorderColor: 'transparent',
472
+ color: textColor
473
+ }
474
+ },
475
+ simpl: {
476
+ colorPalettes,
477
+ dataZoom: {
478
+ options: {
479
+ height: 36,
480
+ bottom: 20
481
+ },
482
+ grid: {
483
+ bottom: 80
484
+ }
485
+ },
486
+ timeRangeBar: {
487
+ height: 32
488
+ },
489
+ externalZoomSlider: {
490
+ grid: {
491
+ bottom: 10
492
+ }
493
+ },
494
+ legendLeft: {
495
+ left: 10,
496
+ width: '45%'
497
+ },
498
+ legendRight: {
499
+ right: 20,
500
+ width: '45%'
501
+ },
502
+ noTitle: {
503
+ grid: {
504
+ top: 60
505
+ },
506
+ legend: {
507
+ top: 15
508
+ }
509
+ },
510
+ subTitle: {
511
+ grid: {
512
+ top: 110
513
+ },
514
+ legend: {
515
+ top: 65
516
+ }
517
+ },
518
+ customLegend: {
519
+ grid: {
520
+ top: 64
521
+ }
522
+ },
523
+ progress: {
524
+ itemWidth: 6,
525
+ itemGap: 6,
526
+ grey: elementUi4
527
+ },
528
+ progressBar: {
529
+ labelColor: textColor,
530
+ itemWidth: 20,
531
+ grid: {
532
+ left: 16,
533
+ right: 52,
534
+ containLabel: true
535
+ }
536
+ },
537
+ gauge: {
538
+ grey: elementBase0,
539
+ value: elementTextPrimary,
540
+ unit: elementUi3,
541
+ defaultColor: elementUi0
542
+ }
543
+ }
544
+ };
545
+ }
546
+ };
547
+
548
+ /**
549
+ * Copyright (c) Siemens 2016 - 2025
550
+ * SPDX-License-Identifier: MIT
551
+ */
552
+ const themeSupport = {
553
+ _defaultTheme: themeElement,
554
+ _themes: {},
555
+ registerTheme(theme) {
556
+ if (theme.name) {
557
+ this._themes[theme.name] = theme;
558
+ }
559
+ },
560
+ getThemeNames() {
561
+ return Object.keys(this._themes);
562
+ },
563
+ getThemeByName(name) {
564
+ return this._themes[name];
565
+ },
566
+ setDefault(theme) {
567
+ this._defaultTheme = theme;
568
+ },
569
+ getDefault() {
570
+ return this._defaultTheme;
571
+ }
572
+ };
573
+
574
+ /**
575
+ * Copyright (c) Siemens 2016 - 2025
576
+ * SPDX-License-Identifier: MIT
577
+ */
578
+ class SiChartLoadingSpinnerComponent {
579
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartLoadingSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
580
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: SiChartLoadingSpinnerComponent, isStandalone: true, selector: "si-chart-loading-spinner", ngImport: i0, template: "<div class=\"loading\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <g>\n <path d=\"M256,156a16,16,0,0,1-16-16V80a16,16,0,0,1,32,0v60A16,16,0,0,1,256,156Z\" />\n <path\n d=\"M314.78,175.1a16,16,0,0,1-3.54-22.35l35.27-48.54A16,16,0,1,1,372.39,123l-35.26,48.54A16,16,0,0,1,314.78,175.1Z\"\n />\n <path\n d=\"M351.11,225.1a16,16,0,0,1,10.27-20.16l57.06-18.54a16,16,0,1,1,9.89,30.43l-57.06,18.54A16,16,0,0,1,351.11,225.1Z\"\n />\n <path\n d=\"M351.11,286.9a16,16,0,0,1,20.16-10.27l57.06,18.54a16,16,0,1,1-9.89,30.43l-57.06-18.54A16,16,0,0,1,351.11,286.9Z\"\n />\n <path\n d=\"M314.78,336.9a16,16,0,0,1,22.35,3.54L372.39,389a16,16,0,1,1-25.88,18.81l-35.27-48.54A16,16,0,0,1,314.78,336.9Z\"\n />\n <path d=\"M256,356a16,16,0,0,1,16,16v60a16,16,0,0,1-32,0V372A16,16,0,0,1,256,356Z\" />\n <path\n d=\"M197.22,336.9a16,16,0,0,1,3.54,22.35l-35.27,48.54A16,16,0,1,1,139.61,389l35.26-48.54A16,16,0,0,1,197.22,336.9Z\"\n />\n <path\n d=\"M160.89,286.9a16,16,0,0,1-10.27,20.16L93.56,325.6a16,16,0,0,1-9.89-30.43l57.06-18.54A16,16,0,0,1,160.89,286.9Z\"\n />\n <path\n d=\"M160.89,225.1a16,16,0,0,1-20.16,10.27L83.67,216.83a16,16,0,1,1,9.89-30.43l57.06,18.54A16,16,0,0,1,160.89,225.1Z\"\n />\n <path\n d=\"M197.22,175.1a16,16,0,0,1-22.35-3.54L139.61,123a16,16,0,1,1,25.88-18.81l35.27,48.54A16,16,0,0,1,197.22,175.1Z\"\n />\n </g>\n </svg>\n</div>\n", styles: ["@keyframes spinner-fade{0%{opacity:1}to{opacity:.05}}.loading{display:block;text-align:center}svg{inline-size:var(--loading-spinner-size, 64px);block-size:var(--loading-spinner-size, 64px)}path{fill:var(--element-ui-2, #656a6f);animation:spinner-fade 1s infinite linear}path:nth-child(1){animation-delay:0s;opacity:1}path:nth-child(2){animation-delay:.1s;opacity:.9}path:nth-child(3){animation-delay:.2s;opacity:.8}path:nth-child(4){animation-delay:.3s;opacity:.7}path:nth-child(5){animation-delay:.4s;opacity:.6}path:nth-child(6){animation-delay:.5s;opacity:.5}path:nth-child(7){animation-delay:.6s;opacity:.4}path:nth-child(8){animation-delay:.7s;opacity:.3}path:nth-child(9){animation-delay:.8s;opacity:.2}path:nth-child(10){animation-delay:.9s;opacity:.1}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
581
+ }
582
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartLoadingSpinnerComponent, decorators: [{
583
+ type: Component,
584
+ args: [{ selector: 'si-chart-loading-spinner', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"loading\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <g>\n <path d=\"M256,156a16,16,0,0,1-16-16V80a16,16,0,0,1,32,0v60A16,16,0,0,1,256,156Z\" />\n <path\n d=\"M314.78,175.1a16,16,0,0,1-3.54-22.35l35.27-48.54A16,16,0,1,1,372.39,123l-35.26,48.54A16,16,0,0,1,314.78,175.1Z\"\n />\n <path\n d=\"M351.11,225.1a16,16,0,0,1,10.27-20.16l57.06-18.54a16,16,0,1,1,9.89,30.43l-57.06,18.54A16,16,0,0,1,351.11,225.1Z\"\n />\n <path\n d=\"M351.11,286.9a16,16,0,0,1,20.16-10.27l57.06,18.54a16,16,0,1,1-9.89,30.43l-57.06-18.54A16,16,0,0,1,351.11,286.9Z\"\n />\n <path\n d=\"M314.78,336.9a16,16,0,0,1,22.35,3.54L372.39,389a16,16,0,1,1-25.88,18.81l-35.27-48.54A16,16,0,0,1,314.78,336.9Z\"\n />\n <path d=\"M256,356a16,16,0,0,1,16,16v60a16,16,0,0,1-32,0V372A16,16,0,0,1,256,356Z\" />\n <path\n d=\"M197.22,336.9a16,16,0,0,1,3.54,22.35l-35.27,48.54A16,16,0,1,1,139.61,389l35.26-48.54A16,16,0,0,1,197.22,336.9Z\"\n />\n <path\n d=\"M160.89,286.9a16,16,0,0,1-10.27,20.16L93.56,325.6a16,16,0,0,1-9.89-30.43l57.06-18.54A16,16,0,0,1,160.89,286.9Z\"\n />\n <path\n d=\"M160.89,225.1a16,16,0,0,1-20.16,10.27L83.67,216.83a16,16,0,1,1,9.89-30.43l57.06,18.54A16,16,0,0,1,160.89,225.1Z\"\n />\n <path\n d=\"M197.22,175.1a16,16,0,0,1-22.35-3.54L139.61,123a16,16,0,1,1,25.88-18.81l35.27,48.54A16,16,0,0,1,197.22,175.1Z\"\n />\n </g>\n </svg>\n</div>\n", styles: ["@keyframes spinner-fade{0%{opacity:1}to{opacity:.05}}.loading{display:block;text-align:center}svg{inline-size:var(--loading-spinner-size, 64px);block-size:var(--loading-spinner-size, 64px)}path{fill:var(--element-ui-2, #656a6f);animation:spinner-fade 1s infinite linear}path:nth-child(1){animation-delay:0s;opacity:1}path:nth-child(2){animation-delay:.1s;opacity:.9}path:nth-child(3){animation-delay:.2s;opacity:.8}path:nth-child(4){animation-delay:.3s;opacity:.7}path:nth-child(5){animation-delay:.4s;opacity:.6}path:nth-child(6){animation-delay:.5s;opacity:.5}path:nth-child(7){animation-delay:.6s;opacity:.4}path:nth-child(8){animation-delay:.7s;opacity:.3}path:nth-child(9){animation-delay:.8s;opacity:.2}path:nth-child(10){animation-delay:.9s;opacity:.1}\n"] }]
585
+ }] });
586
+
587
+ /**
588
+ * Copyright (c) Siemens 2016 - 2025
589
+ * SPDX-License-Identifier: MIT
590
+ */
591
+ class SiCustomLegendComponent {
592
+ /** @internal */
593
+ customLegendContainer = viewChild.required('customLegendContainer');
594
+ customLegend = input();
595
+ title = input();
596
+ subTitle = input();
597
+ titleColor = input();
598
+ subTitleColor = input();
599
+ textColor = input();
600
+ legendIconClickEvent = output();
601
+ legendClickEvent = output();
602
+ legendHoverStartEvent = output();
603
+ legendHoverEndEvent = output();
604
+ legendIconClick(legend) {
605
+ legend.selected = !legend.selected;
606
+ this.legendIconClickEvent.emit(legend);
607
+ }
608
+ legendClick(legend) {
609
+ legend.selected = !legend.selected;
610
+ this.legendClickEvent.emit(legend);
611
+ }
612
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiCustomLegendComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
613
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiCustomLegendComponent, isStandalone: true, selector: "si-custom-legend", inputs: { customLegend: { classPropertyName: "customLegend", publicName: "customLegend", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, subTitle: { classPropertyName: "subTitle", publicName: "subTitle", isSignal: true, isRequired: false, transformFunction: null }, titleColor: { classPropertyName: "titleColor", publicName: "titleColor", isSignal: true, isRequired: false, transformFunction: null }, subTitleColor: { classPropertyName: "subTitleColor", publicName: "subTitleColor", isSignal: true, isRequired: false, transformFunction: null }, textColor: { classPropertyName: "textColor", publicName: "textColor", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { legendIconClickEvent: "legendIconClickEvent", legendClickEvent: "legendClickEvent", legendHoverStartEvent: "legendHoverStartEvent", legendHoverEndEvent: "legendHoverEndEvent" }, viewQueries: [{ propertyName: "customLegendContainer", first: true, predicate: ["customLegendContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (customLegend() && customLegend()?.customLegends) {\n <div #customLegendContainer class=\"legend-container si-body-2\">\n @for (leg of customLegend()?.customLegends; track legendIndex; let legendIndex = $index) {\n @if (legendIndex === 0 && leg && leg.list && leg.list.length > 0) {\n <div\n class=\"left-legends legend-item-container\"\n [class.legend-empty]=\"\n customLegend()?.legendAxis !== 'left' && customLegend()?.legendAxis !== 'both'\n \"\n [class.legend-single-axis]=\"customLegend()?.legendAxis === 'left'\"\n [class.both-legend-container]=\"customLegend()?.legendAxis === 'both'\"\n >\n <div\n class=\"both-scenario-left-unit-container\"\n [class.left-scenario-unit-container]=\"customLegend()?.legendAxis === 'left'\"\n >\n <span class=\"text-secondary\">{{ leg.unit }}</span>\n </div>\n <div\n class=\"legend-item-container both-scenario-legend-container custom-legend-left\"\n [class.legend-single-axis]=\"customLegend()?.legendAxis === 'left'\"\n >\n @for (legendItem of leg.list; track legendItem.name) {\n <div class=\"legend-item\" [class.hidden-legend]=\"!legendItem.selected\">\n <div\n class=\"me-2 mb-2\"\n (click)=\"legendIconClick(legendItem)\"\n (mouseenter)=\"legendHoverStartEvent.emit(legendItem)\"\n (mouseleave)=\"legendHoverEndEvent.emit(legendItem)\"\n >\n <svg width=\"12\" height=\"12\" xmlns=\"http://www.w3.org/2000/svg\">\n <path [attr.d]=\"legendItem.symbol\" [attr.fill]=\"legendItem.color\" />\n </svg>\n </div>\n <span\n class=\"legend-text text-truncate\"\n [style.color]=\"textColor()\"\n (click)=\"legendClick(legendItem)\"\n (mouseenter)=\"legendHoverStartEvent.emit(legendItem)\"\n (mouseleave)=\"legendHoverEndEvent.emit(legendItem)\"\n >\n {{ legendItem.displayName }}\n </span>\n @if (legendItem.tooltip) {\n <div class=\"tooltip show bs-tooltip-bottom\" role=\"tooltip\">\n <div class=\"tooltip-arrow\"></div>\n <div class=\"tooltip-inner\">{{ legendItem.tooltip }}</div>\n </div>\n }\n </div>\n }\n </div>\n </div>\n }\n }\n\n @for (leg of customLegend()?.customLegends; track legendIndex; let legendIndex = $index) {\n @if (legendIndex === 1 && leg && leg.list && leg.list.length > 0) {\n <div\n class=\"right-legends legend-item-container\"\n [class.legend-empty]=\"\n customLegend()?.legendAxis !== 'right' && customLegend()?.legendAxis !== 'both'\n \"\n [class.legend-single-axis]=\"customLegend()?.legendAxis === 'right'\"\n [class.both-legend-container]=\"customLegend()?.legendAxis === 'both'\"\n >\n <div\n class=\"legend-item-container custom-legend-right legend-item-container-right-floating-inner\"\n >\n @for (legendItem of leg.list; track legendItem.name) {\n <div\n class=\"legend-item legend-item-right\"\n [class.hidden-legend]=\"!legendItem.selected\"\n >\n <span\n class=\"legend-text text-truncate\"\n [style.color]=\"textColor()\"\n (click)=\"legendClick(legendItem)\"\n >\n {{ legendItem.displayName }}\n </span>\n <div class=\"right-legend-circle\" (click)=\"legendIconClick(legendItem)\">\n <svg width=\"12\" height=\"12\" xmlns=\"http://www.w3.org/2000/svg\">\n <path [attr.d]=\"legendItem.symbol\" [attr.fill]=\"legendItem.color\" />\n </svg>\n </div>\n @if (legendItem.tooltip) {\n <div class=\"tooltip show bs-tooltip-bottom\" role=\"tooltip\">\n <div class=\"tooltip-arrow\"></div>\n <div class=\"tooltip-inner\">{{ legendItem.tooltip }}</div>\n </div>\n }\n </div>\n }\n </div>\n <div\n class=\"both-scenario-right-unit-container\"\n [class.right-scenario-unit-container]=\"customLegend()?.legendAxis === 'right'\"\n >\n <span class=\"right-unit-text text-secondary\">{{ leg.unit }}</span>\n </div>\n </div>\n }\n }\n </div>\n}\n", styles: [":host{--flex-dir1: row;--flex-dir2: row-reverse;margin:12px;display:flex;flex-direction:column}:host-context(:dir(rtl)){--flex-dir1: row-reverse;--flex-dir2: row}:host-context([dir=rtl]){--flex-dir1: row-reverse;--flex-dir2: row}.legend-container{display:flex;flex-direction:var(--flex-dir1);max-height:40px;flex:1 1 auto}.legend-item-container{width:50%;vertical-align:top;display:flex;flex-wrap:wrap;flex:1 1 100%;flex-direction:var(--flex-dir1);height:fit-content;max-height:40px;max-width:50%;min-width:50%;overflow-y:auto;scrollbar-width:thin}.legend-item-container::-webkit-scrollbar{width:4px;height:6px;background-color:var(--element-base-0, #f0f2f5)}.legend-item-container::-webkit-scrollbar-thumb{border-radius:12px;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.3)}.legend-item-container::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.3);border-radius:12px;background-color:var(--element-base-0, #f0f2f5)}.legend-item-container .custom-legend-left{flex-direction:var(--flex-dir1);flex:1 1 50%}.legend-item-container .custom-legend-right{flex-direction:var(--flex-dir2);flex:1 1 50%}.legend-item-container-right-floating-inner{max-width:calc(100% - 32px);min-width:calc(100% - 32px);padding-right:12px;float:left}.legend-single-axis{max-width:100%;min-width:100%}.legend-empty{width:0%}.tooltip{display:none;max-width:375px;word-break:break-word;margin-top:16px;inset-block-start:0;margin-inline-start:-6px}.tooltip-arrow{left:12px}.legend-item{cursor:pointer;margin-right:8px;display:flex;flex-direction:var(--flex-dir1);align-items:center;height:20px;position:initial;width:calc(100% - 12px);max-width:fit-content}.legend-item:hover .tooltip{display:block}.legend-item-right{margin-right:0;margin-left:12px}.right-legend-circle{margin-right:0;margin-left:4px}.legend-text{box-sizing:inherit;display:inline;cursor:pointer}.hidden-legend .right-legend-circle,.hidden-legend div:first-child,.hidden-legend .legend-text{opacity:.4}.both-scenario-left-unit-container,.both-scenario-right-unit-container{min-width:32px;max-width:32px;overflow:hidden}.both-scenario-right-unit-container{max-height:100%}.both-scenario-left-unit-container{min-height:100%}.both-scenario-legend-container{max-width:calc(100% - 32px);min-width:calc(100% - 32px);padding-left:12px}.right-unit-text{min-width:100%;min-height:100%;padding-left:2px}.left-legends{padding-right:36px}.right-legends{padding-left:28px}.both-legend-container{padding-right:0;padding-left:0}\n"] });
614
+ }
615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiCustomLegendComponent, decorators: [{
616
+ type: Component,
617
+ args: [{ selector: 'si-custom-legend', template: "@if (customLegend() && customLegend()?.customLegends) {\n <div #customLegendContainer class=\"legend-container si-body-2\">\n @for (leg of customLegend()?.customLegends; track legendIndex; let legendIndex = $index) {\n @if (legendIndex === 0 && leg && leg.list && leg.list.length > 0) {\n <div\n class=\"left-legends legend-item-container\"\n [class.legend-empty]=\"\n customLegend()?.legendAxis !== 'left' && customLegend()?.legendAxis !== 'both'\n \"\n [class.legend-single-axis]=\"customLegend()?.legendAxis === 'left'\"\n [class.both-legend-container]=\"customLegend()?.legendAxis === 'both'\"\n >\n <div\n class=\"both-scenario-left-unit-container\"\n [class.left-scenario-unit-container]=\"customLegend()?.legendAxis === 'left'\"\n >\n <span class=\"text-secondary\">{{ leg.unit }}</span>\n </div>\n <div\n class=\"legend-item-container both-scenario-legend-container custom-legend-left\"\n [class.legend-single-axis]=\"customLegend()?.legendAxis === 'left'\"\n >\n @for (legendItem of leg.list; track legendItem.name) {\n <div class=\"legend-item\" [class.hidden-legend]=\"!legendItem.selected\">\n <div\n class=\"me-2 mb-2\"\n (click)=\"legendIconClick(legendItem)\"\n (mouseenter)=\"legendHoverStartEvent.emit(legendItem)\"\n (mouseleave)=\"legendHoverEndEvent.emit(legendItem)\"\n >\n <svg width=\"12\" height=\"12\" xmlns=\"http://www.w3.org/2000/svg\">\n <path [attr.d]=\"legendItem.symbol\" [attr.fill]=\"legendItem.color\" />\n </svg>\n </div>\n <span\n class=\"legend-text text-truncate\"\n [style.color]=\"textColor()\"\n (click)=\"legendClick(legendItem)\"\n (mouseenter)=\"legendHoverStartEvent.emit(legendItem)\"\n (mouseleave)=\"legendHoverEndEvent.emit(legendItem)\"\n >\n {{ legendItem.displayName }}\n </span>\n @if (legendItem.tooltip) {\n <div class=\"tooltip show bs-tooltip-bottom\" role=\"tooltip\">\n <div class=\"tooltip-arrow\"></div>\n <div class=\"tooltip-inner\">{{ legendItem.tooltip }}</div>\n </div>\n }\n </div>\n }\n </div>\n </div>\n }\n }\n\n @for (leg of customLegend()?.customLegends; track legendIndex; let legendIndex = $index) {\n @if (legendIndex === 1 && leg && leg.list && leg.list.length > 0) {\n <div\n class=\"right-legends legend-item-container\"\n [class.legend-empty]=\"\n customLegend()?.legendAxis !== 'right' && customLegend()?.legendAxis !== 'both'\n \"\n [class.legend-single-axis]=\"customLegend()?.legendAxis === 'right'\"\n [class.both-legend-container]=\"customLegend()?.legendAxis === 'both'\"\n >\n <div\n class=\"legend-item-container custom-legend-right legend-item-container-right-floating-inner\"\n >\n @for (legendItem of leg.list; track legendItem.name) {\n <div\n class=\"legend-item legend-item-right\"\n [class.hidden-legend]=\"!legendItem.selected\"\n >\n <span\n class=\"legend-text text-truncate\"\n [style.color]=\"textColor()\"\n (click)=\"legendClick(legendItem)\"\n >\n {{ legendItem.displayName }}\n </span>\n <div class=\"right-legend-circle\" (click)=\"legendIconClick(legendItem)\">\n <svg width=\"12\" height=\"12\" xmlns=\"http://www.w3.org/2000/svg\">\n <path [attr.d]=\"legendItem.symbol\" [attr.fill]=\"legendItem.color\" />\n </svg>\n </div>\n @if (legendItem.tooltip) {\n <div class=\"tooltip show bs-tooltip-bottom\" role=\"tooltip\">\n <div class=\"tooltip-arrow\"></div>\n <div class=\"tooltip-inner\">{{ legendItem.tooltip }}</div>\n </div>\n }\n </div>\n }\n </div>\n <div\n class=\"both-scenario-right-unit-container\"\n [class.right-scenario-unit-container]=\"customLegend()?.legendAxis === 'right'\"\n >\n <span class=\"right-unit-text text-secondary\">{{ leg.unit }}</span>\n </div>\n </div>\n }\n }\n </div>\n}\n", styles: [":host{--flex-dir1: row;--flex-dir2: row-reverse;margin:12px;display:flex;flex-direction:column}:host-context(:dir(rtl)){--flex-dir1: row-reverse;--flex-dir2: row}:host-context([dir=rtl]){--flex-dir1: row-reverse;--flex-dir2: row}.legend-container{display:flex;flex-direction:var(--flex-dir1);max-height:40px;flex:1 1 auto}.legend-item-container{width:50%;vertical-align:top;display:flex;flex-wrap:wrap;flex:1 1 100%;flex-direction:var(--flex-dir1);height:fit-content;max-height:40px;max-width:50%;min-width:50%;overflow-y:auto;scrollbar-width:thin}.legend-item-container::-webkit-scrollbar{width:4px;height:6px;background-color:var(--element-base-0, #f0f2f5)}.legend-item-container::-webkit-scrollbar-thumb{border-radius:12px;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.3)}.legend-item-container::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.3);border-radius:12px;background-color:var(--element-base-0, #f0f2f5)}.legend-item-container .custom-legend-left{flex-direction:var(--flex-dir1);flex:1 1 50%}.legend-item-container .custom-legend-right{flex-direction:var(--flex-dir2);flex:1 1 50%}.legend-item-container-right-floating-inner{max-width:calc(100% - 32px);min-width:calc(100% - 32px);padding-right:12px;float:left}.legend-single-axis{max-width:100%;min-width:100%}.legend-empty{width:0%}.tooltip{display:none;max-width:375px;word-break:break-word;margin-top:16px;inset-block-start:0;margin-inline-start:-6px}.tooltip-arrow{left:12px}.legend-item{cursor:pointer;margin-right:8px;display:flex;flex-direction:var(--flex-dir1);align-items:center;height:20px;position:initial;width:calc(100% - 12px);max-width:fit-content}.legend-item:hover .tooltip{display:block}.legend-item-right{margin-right:0;margin-left:12px}.right-legend-circle{margin-right:0;margin-left:4px}.legend-text{box-sizing:inherit;display:inline;cursor:pointer}.hidden-legend .right-legend-circle,.hidden-legend div:first-child,.hidden-legend .legend-text{opacity:.4}.both-scenario-left-unit-container,.both-scenario-right-unit-container{min-width:32px;max-width:32px;overflow:hidden}.both-scenario-right-unit-container{max-height:100%}.both-scenario-left-unit-container{min-height:100%}.both-scenario-legend-container{max-width:calc(100% - 32px);min-width:calc(100% - 32px);padding-left:12px}.right-unit-text{min-width:100%;min-height:100%;padding-left:2px}.left-legends{padding-right:36px}.right-legends{padding-left:28px}.both-legend-container{padding-right:0;padding-left:0}\n"] }]
618
+ }] });
619
+
620
+ /**
621
+ * Copyright (c) Siemens 2016 - 2025
622
+ * SPDX-License-Identifier: MIT
623
+ */
624
+ class SiChartComponent {
625
+ /**
626
+ * reference to the wrapper container. Used for setting scroll position, etc.
627
+ *
628
+ * @defaultValue
629
+ * ```
630
+ * viewChild.required<ElementRef>('chartContainerWrapper')
631
+ * ```
632
+ */
633
+ chartContainerWrapper = viewChild.required('chartContainerWrapper');
634
+ chartContainer = viewChild('chart');
635
+ externalZoomSliderContainer = viewChild('externalZoomSlider');
636
+ siCustomLegend = viewChildren('siCustomLegend', {
637
+ read: SiCustomLegendComponent
638
+ });
639
+ /**
640
+ * See [ECharts 5.x Documentation]{@link https://echarts.apache.org/en/option.html}
641
+ * for all available options.
642
+ */
643
+ options = input();
644
+ /** Used to override specific properties set in `options`. */
645
+ additionalOptions = input();
646
+ title = input();
647
+ subTitle = input();
648
+ /** @defaultValue true */
649
+ showLegend = model(true);
650
+ /** @defaultValue false */
651
+ showCustomLegend = input(false);
652
+ /**
653
+ * the renderer to use: canvas or svg
654
+ *
655
+ * @defaultValue 'canvas'
656
+ */
657
+ renderer = input('canvas');
658
+ /**
659
+ * Enables the zoom slider below the chart.
660
+ *
661
+ * @defaultValue false
662
+ */
663
+ zoomSlider = input(false);
664
+ /**
665
+ * Shows data shadow in dataZoom slider, use together with `zoomSlider`.
666
+ *
667
+ * @defaultValue true
668
+ */
669
+ zoomSliderShadow = input(true);
670
+ /**
671
+ * realtime update mode for zoom slider
672
+ *
673
+ * @defaultValue true
674
+ */
675
+ zoomSliderRealtime = input(true);
676
+ /**
677
+ * enable brush mode for zoom slider
678
+ *
679
+ * @defaultValue true
680
+ */
681
+ zoomSliderBrush = input(true);
682
+ /**
683
+ * Enables zooming inside the chart with the mouse wheel/touch.
684
+ *
685
+ * @defaultValue false
686
+ */
687
+ zoomInside = input(false);
688
+ /** @defaultValue 1000 */
689
+ maxEntries = input(1000);
690
+ /**
691
+ * No auto dataZoom update) by default. Use together with `autoZoomSeriesIndex`.
692
+ *
693
+ * @defaultValue -1
694
+ */
695
+ visibleEntries = model(-1);
696
+ /**
697
+ * No auto dataZoom update) by default. Use together with `autoZoomSeriesIndex`.
698
+ *
699
+ * @defaultValue -1
700
+ */
701
+ visibleRange = model(-1);
702
+ /**
703
+ * No auto dataZoom update) by default. Use together with `visibleEntries`.
704
+ *
705
+ * @defaultValue -1
706
+ */
707
+ autoZoomSeriesIndex = input(-1);
708
+ /** The desired theme to load. */
709
+ theme = input();
710
+ /** Used to override specific options of loaded `theme`. */
711
+ themeCustomization = input();
712
+ /**
713
+ * The name of the color palette (if any) of the loaded `theme`.
714
+ *
715
+ * @defaultValue undefined
716
+ */
717
+ palette = input();
718
+ /**
719
+ * Used to display `axisPointer` line either by click or mouse-move.
720
+ *
721
+ * @defaultValue false
722
+ */
723
+ axisPointer = input(false);
724
+ dataZoomRange = input();
725
+ dataZoomMinValueSpan = input();
726
+ dataZoomMaxValueSpan = input();
727
+ /** @defaultValue 'none' */
728
+ dataZoomFilterMode = input('none');
729
+ customLegendAction = input();
730
+ /**
731
+ * @defaultValue
732
+ * ```
733
+ * { legendItemName: '' }
734
+ * ```
735
+ */
736
+ selectedItem = input({ legendItemName: '' });
737
+ eChartContainerHeight = input();
738
+ /**
739
+ * Flag to use external zoom slider
740
+ *
741
+ * @defaultValue false
742
+ */
743
+ externalZoomSlider = input(false);
744
+ /** External XAxis Formatter from consumer */
745
+ externalXAxisFormatter = input();
746
+ /**
747
+ * If true, add consumer-provided time range bar. Use together with `zoomSlider`.
748
+ * @deprecated The input will be removed in future versions as the time range bar slot is deprecated.
749
+ *
750
+ * @defaultValue false
751
+ */
752
+ showTimeRangeBar = input(false);
753
+ /** Event emitted when data zoom changes. */
754
+ dataZoom = output();
755
+ /** Event emitted when axis pointer moves. */
756
+ pointer = output();
757
+ selectionChanged = output();
758
+ chartSeriesClick = output();
759
+ /** Event emitted when chart grid is resized. */
760
+ chartGridResized = output();
761
+ customLegendMultiLineInfoEvent = output();
762
+ /** Emitted when datazoom changes, indicating the time range in milliseconds, 0 for full range */
763
+ timeRangeChange = output();
764
+ /** Allow to override options specific for a chart type. */
765
+ actualOptions = {};
766
+ customLegend = [
767
+ {
768
+ customLegends: [
769
+ { list: [], unit: '' },
770
+ { list: [], unit: '' }
771
+ ],
772
+ legendAxis: 'both'
773
+ }
774
+ ];
775
+ /** @internal */
776
+ chart;
777
+ extZoomSliderChart;
778
+ echartElement;
779
+ eChartExtSliderElement;
780
+ inProgress = signal(false);
781
+ backgroundColor = signal('');
782
+ textColor = signal('');
783
+ titleColor = signal('');
784
+ subTitleColor = signal('');
785
+ selectedSeriesColors = {};
786
+ unselectedSeriesColors = {};
787
+ seriesSelectionState = {};
788
+ containerHeight = signal(null);
789
+ activeTheme;
790
+ autoZoomUpdate = true;
791
+ subscriptions = new Subscription();
792
+ prevAxisPointer = {};
793
+ lastValidDataZoom = {};
794
+ presetDataZoomRange;
795
+ dataZoomSetupDone = false;
796
+ requestedDataZoom;
797
+ measureCanvas;
798
+ cdRef = inject(ChangeDetectorRef);
799
+ curWidth = 0;
800
+ curHeight = 0;
801
+ timeBarBottom = signal(50);
802
+ timeBarLeft = signal(32);
803
+ timeBarRight = signal(32);
804
+ timeBarHeight = signal(32);
805
+ gridCoordinates = {
806
+ x: 0,
807
+ y: 0,
808
+ width: 0,
809
+ height: 0,
810
+ containerWidth: 0,
811
+ containerHeight: 0
812
+ };
813
+ customLegendsMultiLineInfo = [];
814
+ extZoomSliderOptions = {
815
+ animation: false,
816
+ dataZoom: [
817
+ { type: 'slider', showDataShadow: false },
818
+ { type: 'inside', showDataShadow: false }
819
+ ],
820
+ grid: [{ left: 32, right: 32, top: 0, height: 0, containLabel: false }],
821
+ xAxis: [{ type: 'time', axisLine: { onZero: true }, zlevel: 1 }],
822
+ yAxis: [{ type: 'value', boundaryGap: [0, '100%'], splitLine: { show: false }, show: false }],
823
+ series: [{ type: 'line', showSymbol: false, lineStyle: { opacity: 0 }, data: [] }]
824
+ };
825
+ echartMouseDown = () => this.handleChartMouseDown();
826
+ echartMouseUp = (event) => this.handleChartMouseUp(event);
827
+ echartExtSliderMouseDown = () => this.handleExtChartMouseDown();
828
+ echartExtSliderMouseUp = (event) => this.handleExtChartMouseUp(event);
829
+ ngZone = inject(NgZone);
830
+ shapePaths = {
831
+ circle: 'M6 0A6 6 0 1 1 6 12A6 6 0 1 1 6 0Z',
832
+ rect: 'M0 0H12V12H0Z',
833
+ roundRect: 'M2 0H10A2 2 0 0 1 12 2V10A2 2 0 0 1 10 12H2A2 2 0 0 1 0 10V2A2 2 0 0 1 2 0Z',
834
+ triangle: 'M6 0L12 12H0L6 0Z',
835
+ diamond: 'M6 0L12 6L6 12L0 6L6 0Z',
836
+ pin: 'M6.00049 0C8.48577 0 10.5005 2.01472 10.5005 4.5C10.5005 5.51817 10.0175 6.461 9.46826 7.31836C8.42358 8.94924 7.16317 10.4497 6.00049 12C4.83781 10.4497 3.57642 8.94924 2.53174 7.31836C1.98255 6.461 1.49951 5.51817 1.49951 4.5C1.49951 2.01472 3.51521 0 6.00049 0Z'
837
+ };
838
+ /**
839
+ * Allow consuming applications to re-draw chart on window resizes.
840
+ */
841
+ resize() {
842
+ if (!this.chart) {
843
+ return;
844
+ }
845
+ const rect = this.chartContainer()?.nativeElement.getBoundingClientRect();
846
+ const width = Math.floor(rect.width);
847
+ const height = Math.floor(rect.height);
848
+ if (width && height && (width !== this.curWidth || height !== this.curHeight)) {
849
+ this.curWidth = width;
850
+ this.curHeight = height;
851
+ this.ngZone.runOutsideAngular(() => {
852
+ this.chart.resize({ width, height: this.containerHeight() ?? height });
853
+ if (this.externalZoomSlider()) {
854
+ this.extZoomSliderChart.resize();
855
+ }
856
+ setTimeout(() => this.checkGridSizeChange());
857
+ });
858
+ this.afterChartResize();
859
+ }
860
+ this.updateCustomLegendMultiLineInfo();
861
+ }
862
+ ngOnChanges(changes) {
863
+ if (changes.options?.currentValue) {
864
+ this.actualOptions = this.options();
865
+ }
866
+ if (!this.chart) {
867
+ return;
868
+ }
869
+ if (changes.eChartContainerHeight) {
870
+ this.setContainerHeight();
871
+ }
872
+ const selectedLegendItem = changes.selectedItem;
873
+ if (selectedLegendItem &&
874
+ !selectedLegendItem.isFirstChange() &&
875
+ selectedLegendItem.currentValue) {
876
+ const event = {
877
+ name: selectedLegendItem.currentValue.legendItemName,
878
+ type: 'legendToggleSelect'
879
+ };
880
+ this.dispatchEChartAction(event);
881
+ }
882
+ if (this.customLegendAction() &&
883
+ changes.options &&
884
+ !changes.options.isFirstChange() &&
885
+ !changes.options.currentValue.color.length) {
886
+ this.actualOptions.color = changes.options.previousValue.color;
887
+ }
888
+ if (changes.theme || changes.renderer) {
889
+ // need to completely redo the chart for the theme change to take effect
890
+ return this.resetChart();
891
+ }
892
+ let updates = 0;
893
+ let applyAll = false;
894
+ let skipMerge = false;
895
+ if (changes.forceAll ||
896
+ changes.yAxis ||
897
+ changes.xAxis ||
898
+ changes.options ||
899
+ changes.series ||
900
+ changes.value) {
901
+ // this is to clean the legend item list
902
+ if (this.showCustomLegend() && this.customLegend && this.customLegend.length > 0) {
903
+ this.customLegend.forEach(cl => {
904
+ cl.customLegends = [
905
+ { list: [], unit: '' },
906
+ { list: [], unit: '' }
907
+ ];
908
+ });
909
+ }
910
+ this.applyOptions();
911
+ applyAll = true;
912
+ skipMerge =
913
+ changes.series?.previousValue &&
914
+ changes.series.currentValue &&
915
+ changes.series.currentValue.length < changes.series.previousValue.length;
916
+ updates++;
917
+ }
918
+ if (!applyAll && (changes.title || changes.subTitle)) {
919
+ // already called when `applyOptions()` has been called
920
+ this.applyTitles();
921
+ updates++;
922
+ }
923
+ if (applyAll ||
924
+ changes.forceAll ||
925
+ changes.zoomSlider ||
926
+ changes.zoomSliderShadow ||
927
+ changes.zoomSliderRealtime ||
928
+ changes.zoomSliderBrush ||
929
+ changes.zoomInside ||
930
+ changes.axisPointer ||
931
+ changes.autoZoomSeriesIndex ||
932
+ changes.visibleEntries ||
933
+ changes.visibleRange) {
934
+ this.applyDataZoom();
935
+ updates++;
936
+ }
937
+ if (applyAll || changes.forceAll || changes.palette || changes.additionalOptions) {
938
+ this.applyAdditionalOptions();
939
+ updates++;
940
+ }
941
+ if (applyAll) {
942
+ this.applyStyles();
943
+ setTimeout(() => this.updateCustomLegendMultiLineInfo());
944
+ }
945
+ let skipDz = false;
946
+ if (updates) {
947
+ if (changes.dataZoomRange) {
948
+ this.setDataZoomRange(true);
949
+ skipDz = true;
950
+ }
951
+ const dz = this.actualOptions.dataZoom;
952
+ let currentDataZoom;
953
+ if (skipMerge && this.hasDataZoom() && this.hasData() && !skipDz) {
954
+ // forced updated is required when adding/removing series, see:
955
+ // https://github.com/apache/incubator-echarts/issues/6202
956
+ // in order not to mess up current datazoom, save the current value and add it to options
957
+ this.saveCurrentDataZoom();
958
+ if (this.lastValidDataZoom) {
959
+ currentDataZoom = dz[0];
960
+ const newDataZoom = {};
961
+ echarts.util.merge(newDataZoom, dz[0], true);
962
+ echarts.util.merge(newDataZoom, this.lastValidDataZoom, true);
963
+ dz[0] = newDataZoom;
964
+ }
965
+ }
966
+ this.updateEChart(skipMerge);
967
+ if (currentDataZoom) {
968
+ dz[0] = currentDataZoom;
969
+ this.updateEChart(false, { dataZoom: this.actualOptions.dataZoom });
970
+ }
971
+ this.applyColorsToCustomLegends();
972
+ }
973
+ if (!skipDz && changes.dataZoomRange) {
974
+ // this is done after a possible setOptions call to ensure echarts has all the desired states
975
+ this.setDataZoomRange();
976
+ }
977
+ this.cdRef.markForCheck();
978
+ }
979
+ ngOnInit() {
980
+ const canvas = document.createElement('canvas');
981
+ this.measureCanvas = canvas.getContext('2d');
982
+ this.measureCanvas.font = '12px "Siemens Sans"';
983
+ const externalXAxisFormatter = this.externalXAxisFormatter();
984
+ if (this.externalZoomSlider() && externalXAxisFormatter) {
985
+ const consumerFormatter = externalXAxisFormatter;
986
+ this.extZoomSliderOptions.xAxis[0].axisLabel = {
987
+ formatter: (value) => consumerFormatter(value, this.visibleRange())
988
+ };
989
+ }
990
+ this.applyTheme();
991
+ // this is to clean the legend item list
992
+ if (this.showCustomLegend() && this.customLegend && this.customLegend.length > 0) {
993
+ this.customLegend.forEach(cl => {
994
+ cl.customLegends = [
995
+ { list: [], unit: '' },
996
+ { list: [], unit: '' }
997
+ ];
998
+ });
999
+ }
1000
+ this.applyOptions();
1001
+ this.applyAdditionalOptions();
1002
+ this.applyDataZoom();
1003
+ this.applyStyles();
1004
+ if (this.customLegendAction()) {
1005
+ this.fetchSeriesColors();
1006
+ }
1007
+ }
1008
+ ngAfterViewInit(skipZoom) {
1009
+ this.ngZone.runOutsideAngular(() => {
1010
+ const chartContainerEl = this.chartContainer().nativeElement;
1011
+ // set current dimension to avoid initial resize() call on chart
1012
+ const rect = chartContainerEl.getBoundingClientRect();
1013
+ this.curWidth = Math.floor(rect.width);
1014
+ this.curHeight = Math.floor(rect.height);
1015
+ const opts = { renderer: this.renderer() };
1016
+ this.chart = echarts.init(chartContainerEl, this.activeTheme, opts);
1017
+ this.echartElement = chartContainerEl;
1018
+ this.getEChartInner()?.addEventListener('mousedown', this.echartMouseDown);
1019
+ this.chart.setOption(this.actualOptions);
1020
+ setTimeout(() => this.checkGridSizeChange());
1021
+ if (this.externalZoomSlider()) {
1022
+ this.extZoomSliderChart = echarts.init(this.externalZoomSliderContainer().nativeElement, this.activeTheme, opts);
1023
+ this.eChartExtSliderElement = this.externalZoomSliderContainer()
1024
+ .nativeElement;
1025
+ this.getEChartExternalSliderInner()?.addEventListener('mousedown', this.echartExtSliderMouseDown);
1026
+ this.extZoomSliderChart.setOption(this.extZoomSliderOptions);
1027
+ this.extZoomSliderChart.on('datazoom', (event) => this.handleExtDataZoom(event));
1028
+ }
1029
+ this.afterChartInit(skipZoom);
1030
+ });
1031
+ setTimeout(() => {
1032
+ this.resize();
1033
+ this.applyColorsToCustomLegends();
1034
+ });
1035
+ }
1036
+ calculateTextWidth(text) {
1037
+ if (!this.measureCanvas) {
1038
+ return 150;
1039
+ }
1040
+ return Math.ceil(this.measureCanvas.measureText(text).width);
1041
+ }
1042
+ disposeChart() {
1043
+ if (this.chart && !this.chart.isDisposed()) {
1044
+ this.chart.dispose();
1045
+ }
1046
+ if (this.extZoomSliderChart && !this.extZoomSliderChart.isDisposed()) {
1047
+ this.extZoomSliderChart.dispose();
1048
+ }
1049
+ }
1050
+ ngOnDestroy() {
1051
+ this.subscriptions.unsubscribe();
1052
+ this.disposeChart();
1053
+ }
1054
+ /**
1055
+ * Re-render the whole chart.
1056
+ */
1057
+ resetChart() {
1058
+ this.applyTheme();
1059
+ if (!this.actualOptions) {
1060
+ // this can happen if the SiThemeService fires the theme switch when the chart is not
1061
+ // yet completely initialized
1062
+ return;
1063
+ }
1064
+ this.disposeChart();
1065
+ this.applyPalette();
1066
+ const addOpts = this.additionalOptions();
1067
+ if (addOpts?.palette) {
1068
+ echarts.util.merge(this.actualOptions.palette, addOpts.palette, true);
1069
+ }
1070
+ this.themeChanged();
1071
+ this.applyStyles();
1072
+ this.applyTitles();
1073
+ this.ngAfterViewInit(true); // eslint-disable-line @angular-eslint/no-lifecycle-call
1074
+ this.cdRef.markForCheck();
1075
+ }
1076
+ handleLegendClick(legend) {
1077
+ this.doToggleSeriesVisibility(legend.name, legend.selected, legend);
1078
+ this.cdRef.markForCheck();
1079
+ }
1080
+ handleLegendHover(legend, start) {
1081
+ this.dispatchEChartAction({
1082
+ type: start ? 'highlight' : 'downplay',
1083
+ [legend.alternativeNaming ? 'name' : 'seriesName']: legend.name
1084
+ });
1085
+ }
1086
+ /**
1087
+ * Toggle visibility of a series.
1088
+ */
1089
+ toggleSeriesVisibility(name, visible) {
1090
+ const legendItem = this.findCustomLegendItem(name);
1091
+ this.doToggleSeriesVisibility(name, visible, legendItem);
1092
+ this.cdRef.markForCheck();
1093
+ }
1094
+ doToggleSeriesVisibility(name, visible, legendItem) {
1095
+ if (legendItem) {
1096
+ legendItem.selected = visible;
1097
+ }
1098
+ this.dispatchEChartAction({ type: visible ? 'legendSelect' : 'legendUnSelect', name });
1099
+ if (this.externalZoomSlider()) {
1100
+ this.ngZone.runOutsideAngular(() => {
1101
+ this.extZoomSliderChart.dispatchAction({
1102
+ type: visible ? 'legendSelect' : 'legendUnSelect',
1103
+ name
1104
+ });
1105
+ });
1106
+ }
1107
+ const opt = this.getOptionNoClone();
1108
+ if (Array.isArray(opt.legend)) {
1109
+ const selection = {};
1110
+ opt.legend.forEach((l) => Object.assign(selection, l.selected));
1111
+ this.handleSelectionChanged({ selected: selection });
1112
+ }
1113
+ }
1114
+ findCustomLegendItem(name) {
1115
+ if (this.showCustomLegend()) {
1116
+ for (const cl of this.customLegend) {
1117
+ for (const l of cl.customLegends) {
1118
+ for (const item of l.list) {
1119
+ if (item.name === name) {
1120
+ return item;
1121
+ }
1122
+ }
1123
+ }
1124
+ }
1125
+ }
1126
+ return undefined;
1127
+ }
1128
+ getValidXAxis() {
1129
+ return undefined;
1130
+ }
1131
+ setZoomMode() { }
1132
+ applyTheme() {
1133
+ // Set default theme if no theme provided
1134
+ const theme = this.theme();
1135
+ if (theme?.style) {
1136
+ this.activeTheme = theme.style();
1137
+ }
1138
+ else if (themeSupport._defaultTheme?.style) {
1139
+ this.activeTheme = themeSupport._defaultTheme.style();
1140
+ }
1141
+ const themeCustomization = this.themeCustomization();
1142
+ if (themeCustomization) {
1143
+ const custom = echarts.util.merge({}, themeCustomization);
1144
+ this.activeTheme = echarts.util.merge(custom, this.activeTheme);
1145
+ }
1146
+ }
1147
+ themeChanged() { }
1148
+ applyOptions() { }
1149
+ applyCustomLegendPosition() {
1150
+ if (this.showLegend() && this.showCustomLegend()) {
1151
+ this.customLegend.forEach(cl => {
1152
+ if (cl.customLegends?.[0].list && cl.customLegends?.[1].list) {
1153
+ const leftLegend = cl.customLegends[0];
1154
+ const rightLegend = cl.customLegends[1];
1155
+ // if we have left and right axis
1156
+ if (leftLegend.list.length > 0 && rightLegend.list.length > 0) {
1157
+ cl.legendAxis = 'both';
1158
+ }
1159
+ else if (leftLegend.list.length > 0 && rightLegend.list.length === 0) {
1160
+ // if we have only left axis data
1161
+ cl.legendAxis = 'left';
1162
+ }
1163
+ else if (leftLegend.list.length === 0 && rightLegend.list.length > 0) {
1164
+ // if we have only right axis data
1165
+ cl.legendAxis = 'right';
1166
+ }
1167
+ else {
1168
+ cl.legendAxis = 'both';
1169
+ }
1170
+ }
1171
+ else {
1172
+ cl.legendAxis = 'both';
1173
+ }
1174
+ });
1175
+ this.cdRef.markForCheck();
1176
+ }
1177
+ }
1178
+ applyAdditionalOptions() {
1179
+ // need to merge palette before the additionalOptions so that overrides work as expected
1180
+ this.applyPalette();
1181
+ if (this.additionalOptions()) {
1182
+ echarts.util.merge(this.actualOptions, this.additionalOptions(), true);
1183
+ }
1184
+ }
1185
+ applyPalette() {
1186
+ const paletteValue = this.palette() ?? 'default';
1187
+ if (paletteValue) {
1188
+ const palette = this.getThemeCustomValue(['colorPalettes', paletteValue], null);
1189
+ if (palette) {
1190
+ this.actualOptions.color = palette;
1191
+ if (this.customLegendAction()) {
1192
+ this.fetchSeriesColors(palette);
1193
+ }
1194
+ }
1195
+ }
1196
+ }
1197
+ applyDataZoom() {
1198
+ if (!this.actualOptions.grid) {
1199
+ return;
1200
+ }
1201
+ this.actualOptions.dataZoom ??= [];
1202
+ const sliderOptions = {};
1203
+ const dataZoomMinValueSpan = this.dataZoomMinValueSpan();
1204
+ if (dataZoomMinValueSpan) {
1205
+ sliderOptions.minValueSpan = dataZoomMinValueSpan;
1206
+ }
1207
+ const dataZoomMaxValueSpan = this.dataZoomMaxValueSpan();
1208
+ if (dataZoomMaxValueSpan) {
1209
+ sliderOptions.maxValueSpan = dataZoomMaxValueSpan;
1210
+ }
1211
+ sliderOptions.realtime = this.zoomSliderRealtime();
1212
+ sliderOptions.brushSelect = this.zoomSliderBrush();
1213
+ sliderOptions.showDataShadow = this.zoomSliderShadow();
1214
+ sliderOptions.filterMode = this.dataZoomFilterMode();
1215
+ sliderOptions.showDetail = false;
1216
+ // keep external zoom slider in sync, always at index 0
1217
+ Object.assign(this.extZoomSliderOptions.dataZoom[0], sliderOptions);
1218
+ const dz = this.actualOptions.dataZoom;
1219
+ const sliderIdx = dz.findIndex(z => z.type === 'slider');
1220
+ const insideIdx = dz.findIndex(z => z.type === 'inside');
1221
+ const zoomSlider = this.zoomSlider();
1222
+ if (zoomSlider && sliderIdx === -1) {
1223
+ // for the non-external, merge with other options
1224
+ const customOptions = this.getThemeCustomValue(['dataZoom', 'options'], {});
1225
+ const dzSliderOptions = Object.assign({ type: 'slider' }, customOptions, sliderOptions);
1226
+ Object.assign(this.extZoomSliderOptions.dataZoom[0], customOptions);
1227
+ const externalZoomSlider = this.externalZoomSlider();
1228
+ if (externalZoomSlider) {
1229
+ dzSliderOptions.show = false;
1230
+ }
1231
+ dz.push(dzSliderOptions);
1232
+ const gridOptions = externalZoomSlider
1233
+ ? this.getThemeCustomValue(['externalZoomSlider', 'grid'], {})
1234
+ : this.getThemeCustomValue(['dataZoom', 'grid'], {});
1235
+ if (this.showTimeRangeBar()) {
1236
+ const timeBarOptions = this.getThemeCustomValue(['timeRangeBar'], {});
1237
+ if (customOptions.height && customOptions.bottom) {
1238
+ this.timeBarBottom.set(customOptions.height + customOptions.bottom);
1239
+ }
1240
+ this.timeBarHeight.set(timeBarOptions?.height ?? 32);
1241
+ if (!externalZoomSlider) {
1242
+ gridOptions.bottom = (gridOptions?.bottom ?? 0) + this.timeBarHeight();
1243
+ }
1244
+ }
1245
+ echarts.util.merge(this.actualOptions.grid, gridOptions, true);
1246
+ }
1247
+ else if (zoomSlider && sliderIdx >= 0) {
1248
+ // update existing
1249
+ const dzSliderOptions = dz[sliderIdx];
1250
+ Object.assign(dzSliderOptions, sliderOptions);
1251
+ }
1252
+ else if (!zoomSlider && sliderIdx >= 0) {
1253
+ dz.splice(sliderIdx, 1);
1254
+ }
1255
+ const zoomInside = this.zoomInside();
1256
+ if (zoomInside && insideIdx === -1) {
1257
+ dz.push({ type: 'inside', filterMode: this.dataZoomFilterMode() });
1258
+ }
1259
+ else if (!zoomInside && insideIdx >= 0) {
1260
+ dz.splice(insideIdx, 1);
1261
+ }
1262
+ if (this.actualOptions.xAxis) {
1263
+ this.handleAxisPointer(this.actualOptions);
1264
+ }
1265
+ this.cdRef.markForCheck();
1266
+ }
1267
+ handleAxisPointer(options) {
1268
+ const axisPointer = this.axisPointer();
1269
+ if (axisPointer !== undefined) {
1270
+ options.axisPointer ??= {};
1271
+ }
1272
+ if (axisPointer === true) {
1273
+ options.axisPointer.triggerOn = 'click';
1274
+ }
1275
+ else if (axisPointer === false) {
1276
+ options.axisPointer.triggerOn = 'mousemove|click';
1277
+ }
1278
+ else if (typeof axisPointer === 'string') {
1279
+ options.axisPointer.triggerOn = axisPointer;
1280
+ }
1281
+ if (Array.isArray(options.xAxis)) {
1282
+ const xAxisArray = options.xAxis;
1283
+ xAxisArray.forEach(axis => this.handleAxisPointerSingleAxis(axis));
1284
+ }
1285
+ else {
1286
+ this.handleAxisPointerSingleAxis(options.xAxis);
1287
+ }
1288
+ }
1289
+ handleAxisPointerSingleAxis(xAxis) {
1290
+ if (this.axisPointer()) {
1291
+ echarts.util.merge(xAxis, { axisPointer: { handle: { show: true } } }, true);
1292
+ }
1293
+ else {
1294
+ echarts.util.merge(xAxis, { axisPointer: { handle: { show: false } } }, true);
1295
+ }
1296
+ }
1297
+ hasDataZoom() {
1298
+ return !!this.actualOptions.dataZoom?.length;
1299
+ }
1300
+ getThemeValue(props, defaultValue, ns) {
1301
+ if (!this.activeTheme) {
1302
+ return defaultValue;
1303
+ }
1304
+ let currentValue = this.activeTheme;
1305
+ if (ns) {
1306
+ currentValue = currentValue[ns];
1307
+ }
1308
+ for (let i = 0; currentValue && i < props.length; i++) {
1309
+ currentValue = currentValue[props[i]];
1310
+ }
1311
+ return currentValue ?? defaultValue;
1312
+ }
1313
+ getThemeCustomValue(props, defaultValue) {
1314
+ return this.getThemeValue(props, defaultValue, 'simpl');
1315
+ }
1316
+ applyTitles() {
1317
+ const title = this.title();
1318
+ const subTitle = this.subTitle();
1319
+ const options = this.actualOptions;
1320
+ if (this.showLegend() && this.showCustomLegend()) {
1321
+ if (options.title) {
1322
+ options.title.show = false;
1323
+ }
1324
+ options.legend?.forEach(legend => {
1325
+ legend.show = false;
1326
+ legend.height = 0;
1327
+ });
1328
+ if (options.grid) {
1329
+ const gridOptions = this.getThemeCustomValue(['customLegend', 'grid'], {});
1330
+ echarts.util.merge(options.grid, gridOptions, true);
1331
+ }
1332
+ this.titleColor.set(this.getThemeValue(['title', 'textStyle', 'color'], null));
1333
+ this.subTitleColor.set(this.getThemeValue(['title', 'subtextStyle', 'color'], this.titleColor));
1334
+ this.textColor.set(this.getThemeValue(['legend', 'textStyle', 'color'], null));
1335
+ this.backgroundColor.set(this.getThemeValue(['backgroundColor'], null));
1336
+ }
1337
+ else if (title || subTitle) {
1338
+ options.title = {
1339
+ text: title,
1340
+ subtext: subTitle
1341
+ };
1342
+ if (subTitle) {
1343
+ this.modifyTopAlignment('subTitle');
1344
+ }
1345
+ }
1346
+ else if (!title && !subTitle) {
1347
+ this.modifyTopAlignment('noTitle');
1348
+ }
1349
+ }
1350
+ modifyTopAlignment(key) {
1351
+ const options = this.actualOptions;
1352
+ if (options.grid) {
1353
+ const gridOptions = this.getThemeCustomValue([key, 'grid'], {});
1354
+ echarts.util.merge(options.grid, gridOptions, true);
1355
+ }
1356
+ const legendOptions = this.getThemeCustomValue([key, 'legend'], {});
1357
+ options.legend?.forEach(legend => echarts.util.merge(legend, legendOptions, true));
1358
+ }
1359
+ afterChartInit(skipZoom) {
1360
+ this.chart.on('datazoom', (event) => this.handleDataZoom(event, 'echart'));
1361
+ if (!this.customLegendAction()) {
1362
+ // default generic si-chart behavior
1363
+ this.chart.on('legendselectchanged', (event) => this.handleSelectionChanged(event));
1364
+ this.chart.on('click', (event) => this.handleClickOnChart(event, false));
1365
+ }
1366
+ else {
1367
+ // custom chart behaviour
1368
+ this.chart.on('legendselectchanged', (event) => this.handleSelectionChangedCustom(event));
1369
+ this.chart.on('click', (event) => this.handleClickOnChart(event, true));
1370
+ }
1371
+ this.chart.on('updateaxispointer', (event) => this.handleUpdateAxisPointer(event));
1372
+ if (!skipZoom) {
1373
+ this.setDataZoomRange();
1374
+ }
1375
+ this.cdRef.markForCheck();
1376
+ }
1377
+ afterChartResize() { }
1378
+ getEChartInner() {
1379
+ return this.echartElement.querySelector(':scope > div:first-child');
1380
+ }
1381
+ getEChartExternalSliderInner() {
1382
+ return this.eChartExtSliderElement.querySelector(':scope > div:first-child');
1383
+ }
1384
+ handleExtChartMouseDown() {
1385
+ window.addEventListener('mouseup', this.echartExtSliderMouseUp);
1386
+ }
1387
+ handleExtChartMouseUp(event) {
1388
+ window.removeEventListener('mouseup', this.echartExtSliderMouseUp);
1389
+ const newEvent = new MouseEvent('mouseup', event);
1390
+ setTimeout(() => {
1391
+ this.getEChartExternalSliderInner()?.dispatchEvent(newEvent);
1392
+ this.cdRef.markForCheck();
1393
+ }, 1);
1394
+ }
1395
+ handleChartMouseDown() {
1396
+ window.addEventListener('mouseup', this.echartMouseUp);
1397
+ }
1398
+ handleChartMouseUp(event) {
1399
+ window.removeEventListener('mouseup', this.echartMouseUp);
1400
+ const newEvent = new MouseEvent('mouseup', event);
1401
+ setTimeout(() => {
1402
+ this.getEChartInner()?.dispatchEvent(newEvent);
1403
+ this.cdRef.markForCheck();
1404
+ }, 1);
1405
+ }
1406
+ setDataZoomRange(skipUpdate) {
1407
+ // Checking if we received a valid dataZoomRange Object
1408
+ const dataZoomRange = this.dataZoomRange();
1409
+ if (dataZoomRange && Object.keys(dataZoomRange).length > 0) {
1410
+ // If series has data, then directly dispatch action for the dataZoom event
1411
+ // Else, Store the dataZoomRange values in presetDataZoomRange variable for applying zoom
1412
+ // after data is received in chart
1413
+ // No need to reassign presetDataZoomRange if earlier value is not consumed
1414
+ if (this.hasData()) {
1415
+ const dz = this.getPresetDataZoom(dataZoomRange);
1416
+ if (dz) {
1417
+ const requested = { ...dataZoomRange };
1418
+ this.presetDataZoomRange = undefined;
1419
+ this.updateDataZoom(dz);
1420
+ if (!skipUpdate) {
1421
+ this.updateEChart(false, { dataZoom: [dz] });
1422
+ }
1423
+ // update user with proper data
1424
+ setTimeout(() => {
1425
+ this.ngZone.runOutsideAngular(() => {
1426
+ this.requestedDataZoom = requested;
1427
+ this.handleDataZoom(dz, 'setDataZoomRange');
1428
+ });
1429
+ });
1430
+ return;
1431
+ }
1432
+ }
1433
+ this.presetDataZoomRange = dataZoomRange;
1434
+ }
1435
+ }
1436
+ handleDataZoom(event, source) {
1437
+ // events can be batched
1438
+ if (event.batch?.length) {
1439
+ event = event.batch[0];
1440
+ }
1441
+ if (Number.isNaN(event.start) || Number.isNaN(event.end)) {
1442
+ // need to fix to the last valid dataZoom setting, see below
1443
+ this.chart.dispatchAction({ type: 'dataZoom', ...this.lastValidDataZoom });
1444
+ return;
1445
+ }
1446
+ const effectiveOpts = this.getOptionNoClone();
1447
+ // in case of pane by chart area, event.start and event.end are always undefined.
1448
+ // and in case of slider move, they has values in percentage(0-100)
1449
+ // so, to handle in case of pane, we need to get start and end values from datazoom property
1450
+ // following condition will be executed only if autozoom is false; and start and end are undefined(undefined means call is from pane)
1451
+ const dz = effectiveOpts.dataZoom[0];
1452
+ this.autoZoomUpdate = !!dz && dz.end === 100;
1453
+ // Due to chart updates outside Angular, we need to emit events back
1454
+ // inside Angular to activate Angular's change detection.
1455
+ const range = this.getVisibleRange();
1456
+ if (range) {
1457
+ range.source = source ?? event.source;
1458
+ this.calculateVisibleRange(range);
1459
+ if (this.requestedDataZoom) {
1460
+ range.requested = this.requestedDataZoom;
1461
+ this.requestedDataZoom = undefined;
1462
+ }
1463
+ this.ngZone.run(() => {
1464
+ this.dataZoom.emit(range);
1465
+ this.timeRangeChange.emit(dz.start === 0 && dz.end === 100 ? 0 : range.rangeEnd - range.rangeStart);
1466
+ });
1467
+ setTimeout(() => this.checkGridSizeChange());
1468
+ this.presetDataZoomRange = undefined;
1469
+ this.dataZoomSetupDone = true;
1470
+ // sync/store values
1471
+ this.updateDataZoom({ startValue: range.rangeStart, endValue: range.rangeEnd });
1472
+ if (event.source !== 'extSlider') {
1473
+ this.extZoomSliderChart?.dispatchAction({
1474
+ type: 'dataZoom',
1475
+ source: 'mainChart',
1476
+ startValue: range.rangeStart,
1477
+ endValue: range.rangeEnd
1478
+ });
1479
+ }
1480
+ }
1481
+ this.cdRef.markForCheck();
1482
+ }
1483
+ handleExtDataZoom(event) {
1484
+ if (event.batch?.length) {
1485
+ event = event.batch[0];
1486
+ }
1487
+ if (event.source === 'mainChart') {
1488
+ return;
1489
+ }
1490
+ const zoomModel = this.extZoomSliderChart._model;
1491
+ const range = this.doGetVisibleRange(zoomModel);
1492
+ if (range) {
1493
+ this.calculateVisibleRange(range);
1494
+ this.chart?.dispatchAction({
1495
+ type: 'dataZoom',
1496
+ source: 'extSlider',
1497
+ startValue: range.rangeStart,
1498
+ endValue: range.rangeEnd
1499
+ });
1500
+ }
1501
+ }
1502
+ handleSelectionChanged(event) {
1503
+ this.selectionChanged.emit(event);
1504
+ for (const a in event.selected) {
1505
+ if (event.selected[a] !== false) {
1506
+ return;
1507
+ }
1508
+ }
1509
+ this.saveCurrentDataZoom();
1510
+ }
1511
+ /**
1512
+ * Creates two objects that stores the colors for selected and unselected series. Used only for custom legend actions.
1513
+ */
1514
+ fetchSeriesColors(colorsToBeUSed) {
1515
+ const options = this.actualOptions;
1516
+ if (!options.color?.length && this.activeTheme) {
1517
+ options.color = [...this.activeTheme.color];
1518
+ }
1519
+ if (!colorsToBeUSed && !this.activeTheme) {
1520
+ return;
1521
+ }
1522
+ options.series?.forEach((element, index) => {
1523
+ this.unselectedSeriesColors[element.name] = {
1524
+ color: this.getThemeValue(['legend', 'unselected', 'color'], '#ccc'),
1525
+ index
1526
+ };
1527
+ const colors = colorsToBeUSed ?? this.activeTheme.color;
1528
+ this.selectedSeriesColors[element.name] = { color: colors[index], index };
1529
+ });
1530
+ }
1531
+ /**
1532
+ * Handles legend select event in non echart native way.
1533
+ * @param event - legend select
1534
+ */
1535
+ handleSelectionChangedCustom(event) {
1536
+ const optionsToChange = this.styleSelectedSeries(event.name, false, event.dataIndex);
1537
+ this.ngZone.runOutsideAngular(() => {
1538
+ this.chart.setOption(optionsToChange);
1539
+ this.chart.dispatchAction({ type: 'legendSelect', name: event.name });
1540
+ });
1541
+ }
1542
+ /**
1543
+ * Handles click on series in non echart native way.
1544
+ * @param event - click
1545
+ */
1546
+ handleClickOnChart(event, toggleVisibility) {
1547
+ if (event.componentType !== 'series') {
1548
+ return;
1549
+ }
1550
+ if (toggleVisibility) {
1551
+ const optionsToChange = this.styleSelectedSeries(event.seriesName, true, event.dataIndex);
1552
+ this.chart.setOption(optionsToChange);
1553
+ }
1554
+ else {
1555
+ this.ngZone.run(() => this.chartSeriesClick.emit({
1556
+ itemName: event.seriesName,
1557
+ dataIndex: event.dataIndex
1558
+ }));
1559
+ }
1560
+ }
1561
+ /**
1562
+ * Selects or unselects the series based on series state object
1563
+ * @param seriesName - series to be selected/unselected
1564
+ * @param emit - if true event is emitted otherwise no event is emitted
1565
+ */
1566
+ styleSelectedSeries(seriesName, emit, seriesDataIndex) {
1567
+ if (this.seriesSelectionState?.[seriesName]) {
1568
+ const elementToStyle = this.actualOptions.series?.find(element => element.name === seriesName);
1569
+ this.seriesSelectionState[seriesName] = false;
1570
+ return this.selectSeries(elementToStyle, emit, seriesDataIndex);
1571
+ }
1572
+ else {
1573
+ const elementToStyle = this.actualOptions.series?.find(element => element.name === seriesName);
1574
+ this.seriesSelectionState[seriesName] = true;
1575
+ return this.unselectSeries(elementToStyle, emit, seriesDataIndex);
1576
+ }
1577
+ }
1578
+ /**
1579
+ * Selects the series
1580
+ * @param element - to be styled as selected
1581
+ * @param emit - if true event is emitted otherwise no event is emitted
1582
+ */
1583
+ selectSeries(element, emit, seriesDataIndex) {
1584
+ const options = this.actualOptions;
1585
+ const optionsToChange = { color: options.color, series: [options.series] };
1586
+ const optionsColorIndex = this.selectedSeriesColors[element.name].index;
1587
+ optionsToChange.color[optionsColorIndex] = this.selectedSeriesColors[element.name].color;
1588
+ if (element.areaStyle) {
1589
+ element.areaStyle.opacity = 0.4;
1590
+ optionsToChange.series[this.selectedSeriesColors[element.name].index] = element;
1591
+ }
1592
+ if (emit) {
1593
+ this.chartSeriesClick.emit({
1594
+ itemName: element.name,
1595
+ dataIndex: seriesDataIndex,
1596
+ selected: false,
1597
+ color: this.selectedSeriesColors[element.name].color
1598
+ });
1599
+ }
1600
+ return optionsToChange;
1601
+ }
1602
+ /**
1603
+ * Unselects the series
1604
+ * @param element - to be styled as unselected
1605
+ * @param emit - if true event is emitted otherwise no event is emitted
1606
+ */
1607
+ unselectSeries(element, emit, seriesDataIndex) {
1608
+ const options = this.actualOptions;
1609
+ const optionsToChange = { color: options.color, series: [options.series] };
1610
+ const optionsColorIndex = this.selectedSeriesColors[element.name].index;
1611
+ optionsToChange.color[optionsColorIndex] = this.unselectedSeriesColors[element.name].color;
1612
+ if (element.areaStyle) {
1613
+ element.areaStyle.opacity = 0;
1614
+ optionsToChange.series[this.unselectedSeriesColors[element.name].index] = element;
1615
+ }
1616
+ if (emit) {
1617
+ this.chartSeriesClick.emit({
1618
+ itemName: element.name,
1619
+ dataIndex: seriesDataIndex,
1620
+ selected: true,
1621
+ color: this.selectedSeriesColors[element.name].color
1622
+ });
1623
+ }
1624
+ return optionsToChange;
1625
+ }
1626
+ isValidDataZoomValue(val) {
1627
+ return val !== null && val !== undefined && !Number.isNaN(val);
1628
+ }
1629
+ saveCurrentDataZoom() {
1630
+ const options = this.actualOptions;
1631
+ if (!options.grid || !options.dataZoom) {
1632
+ return;
1633
+ }
1634
+ // When the last item on the legend is disabled, remember the current valid
1635
+ // dataZoom setting. Due to a bug in ECharts it happens
1636
+ // that the zoom slider disappears not to ever reappear again. To work around
1637
+ // the problem, we simply inject the last valid dataZoom settings saved here
1638
+ // once the invalid values (NaN) are detected
1639
+ const currentOpts = this.getOptionNoClone();
1640
+ if (!currentOpts?.dataZoom?.[0]) {
1641
+ return;
1642
+ }
1643
+ const dz = currentOpts.dataZoom[0];
1644
+ if (dz) {
1645
+ this.lastValidDataZoom = {};
1646
+ if (this.isValidDataZoomValue(dz.startValue)) {
1647
+ this.lastValidDataZoom.startValue = dz.startValue;
1648
+ }
1649
+ else if (this.isValidDataZoomValue(dz.start)) {
1650
+ this.lastValidDataZoom.start = dz.start;
1651
+ }
1652
+ if (this.isValidDataZoomValue(dz.endValue)) {
1653
+ this.lastValidDataZoom.endValue = dz.endValue;
1654
+ }
1655
+ else if (this.isValidDataZoomValue(dz.end)) {
1656
+ this.lastValidDataZoom.end = dz.end;
1657
+ }
1658
+ }
1659
+ }
1660
+ /**
1661
+ * Get color by series name.
1662
+ */
1663
+ getSeriesColorBySeriesName(seriesName) {
1664
+ return this.doGetSeriesColorBySeriesName(seriesName).color;
1665
+ }
1666
+ doGetSeriesColorBySeriesName(seriesName) {
1667
+ const ecModel = this.internalGetModel();
1668
+ const ecSeries = ecModel.getSeriesByName(seriesName);
1669
+ if (ecSeries && ecSeries.length > 0) {
1670
+ return { color: ecSeries[0].getData().getVisual('style')?.fill, altName: false };
1671
+ }
1672
+ let ret = { color: undefined, altName: false };
1673
+ ecModel.eachRawSeries((seriesModel) => {
1674
+ const idx = seriesModel.legendVisualProvider?.indexOfName(seriesName) ?? -1;
1675
+ if (idx >= 0) {
1676
+ ret = {
1677
+ color: seriesModel.legendVisualProvider.getItemVisual(idx, 'style')?.fill,
1678
+ altName: true
1679
+ };
1680
+ }
1681
+ });
1682
+ return ret;
1683
+ }
1684
+ applyColorsToCustomLegends() {
1685
+ if (!this.showLegend() || !this.showCustomLegend()) {
1686
+ return;
1687
+ }
1688
+ this.customLegend.forEach(cl => {
1689
+ cl.customLegends.forEach(legendAxis => {
1690
+ legendAxis?.list.forEach(legend => {
1691
+ const color = this.doGetSeriesColorBySeriesName(legend.name);
1692
+ legend.color = color.color;
1693
+ legend.alternativeNaming = color.altName;
1694
+ });
1695
+ });
1696
+ });
1697
+ this.cdRef.markForCheck();
1698
+ }
1699
+ handleUpdateAxisPointer(event) {
1700
+ if (event.seriesIndex !== this.prevAxisPointer.seriesIndex ||
1701
+ event.dataIndex !== this.prevAxisPointer.dataIndex) {
1702
+ this.prevAxisPointer.seriesIndex = event.seriesIndex;
1703
+ this.prevAxisPointer.dataIndex = event.dataIndex;
1704
+ if (this.axisPointer() && event.seriesIndex === undefined) {
1705
+ return;
1706
+ }
1707
+ // Due to chart updates outside Angular, we need to emit events back
1708
+ // inside Angular to activate Angular's change detection.
1709
+ this.ngZone.run(() => {
1710
+ this.pointer.emit({
1711
+ seriesIndex: event.seriesIndex,
1712
+ dataIndex: event.dataIndex
1713
+ });
1714
+ });
1715
+ }
1716
+ }
1717
+ /**
1718
+ * Get current data zoom range.
1719
+ */
1720
+ getVisibleRange() {
1721
+ return this.doGetVisibleRange(this.internalGetModel());
1722
+ }
1723
+ internalGetModel() {
1724
+ return this.chart._model;
1725
+ }
1726
+ /**
1727
+ * returns the current EChart options, w/o cloning anything. Be very careful
1728
+ * not to change anything in the data structure in it.
1729
+ */
1730
+ getOptionNoClone() {
1731
+ return this.internalGetModel().option;
1732
+ }
1733
+ parsePercent(percent, all) {
1734
+ if (typeof percent === 'string') {
1735
+ if (percent.match(/\d+%/)) {
1736
+ return (parseFloat(percent) / 100) * all;
1737
+ }
1738
+ return parseFloat(percent);
1739
+ }
1740
+ return percent;
1741
+ }
1742
+ doGetVisibleRange(zoomModel) {
1743
+ const effectiveOpts = zoomModel.option;
1744
+ const xAxis = effectiveOpts.xAxis?.[0];
1745
+ const dz = effectiveOpts.dataZoom[0];
1746
+ const rangeStartArray = [];
1747
+ const rangeEndArray = [];
1748
+ for (let i = 0; i < effectiveOpts.xAxis?.length; i++) {
1749
+ const axis = zoomModel.getComponent('xAxis', i);
1750
+ const extent = axis?.axis?.scale?.getExtent();
1751
+ if (extent?.length) {
1752
+ if (this.isValidDataZoomValue(extent[0])) {
1753
+ rangeStartArray.push(extent[0]);
1754
+ }
1755
+ if (this.isValidDataZoomValue(extent[1])) {
1756
+ rangeEndArray.push(extent[1]);
1757
+ }
1758
+ }
1759
+ }
1760
+ const rangeStart = rangeStartArray.length ? Math.min(...rangeStartArray) : dz?.startValue;
1761
+ const rangeEnd = rangeEndArray.length ? Math.max(...rangeEndArray) : dz?.endValue;
1762
+ if (!this.isValidDataZoomValue(rangeEnd)) {
1763
+ return;
1764
+ }
1765
+ let gridWidth;
1766
+ if (effectiveOpts.grid && effectiveOpts.grid.length > 0) {
1767
+ const width = this.chart.getWidth();
1768
+ const grid = effectiveOpts.grid[0];
1769
+ gridWidth =
1770
+ width - this.parsePercent(grid.left, width) - this.parsePercent(grid.right, width);
1771
+ }
1772
+ return {
1773
+ rangeType: xAxis.type,
1774
+ rangeStart,
1775
+ rangeEnd,
1776
+ width: gridWidth,
1777
+ autoZoomUpdate: this.autoZoomUpdate
1778
+ };
1779
+ }
1780
+ updateEChart(force = false, options) {
1781
+ if (!this.chart) {
1782
+ return;
1783
+ }
1784
+ let axisDZUpdated = this.updateAxisAndDataZoom(options);
1785
+ options ??= this.actualOptions;
1786
+ const isFilledArray = (v) => Array.isArray(v) && v.length > 0;
1787
+ if (isFilledArray(options.grid) &&
1788
+ isFilledArray(options.xAxis) &&
1789
+ isFilledArray(options.dataZoom)) {
1790
+ // adjust grid for axis labels
1791
+ let max = 0;
1792
+ options.yAxis.forEach((axis) => {
1793
+ if (axis.position !== 'right' && isFilledArray(axis.data)) {
1794
+ axis.data.forEach((label) => {
1795
+ const width = this.calculateTextWidth(label);
1796
+ max = Math.max(max, width);
1797
+ });
1798
+ }
1799
+ });
1800
+ max += 16; // long text getting truncated, so add some padding
1801
+ const grids = options.grid;
1802
+ grids.forEach(g => (g.left = Math.max(g.left, max)));
1803
+ // update dataZoom if not already set
1804
+ const zoom = options.dataZoom[0];
1805
+ if (!this.isValidDataZoomValue(zoom?.startValue) &&
1806
+ !this.isValidDataZoomValue(zoom?.endValue) &&
1807
+ !this.isValidDataZoomValue(zoom?.end)) {
1808
+ const range = this.getVisibleRange();
1809
+ if (range) {
1810
+ this.updateDataZoom({ startValue: range.rangeStart, endValue: range.rangeEnd });
1811
+ }
1812
+ }
1813
+ // change in grid/axis requires a full update
1814
+ force = true;
1815
+ axisDZUpdated = true;
1816
+ }
1817
+ this.ngZone.runOutsideAngular(() => {
1818
+ this.chart.setOption(options, force);
1819
+ this.setZoomMode();
1820
+ if (axisDZUpdated && this.externalZoomSlider()) {
1821
+ this.extZoomSliderChart.setOption(this.extZoomSliderOptions, false);
1822
+ }
1823
+ });
1824
+ setTimeout(() => this.checkGridSizeChange());
1825
+ }
1826
+ updateAxisAndDataZoom(inOptions) {
1827
+ const options = this.actualOptions;
1828
+ if (!options.xAxis) {
1829
+ return false;
1830
+ }
1831
+ const isFull = !inOptions || inOptions === options;
1832
+ inOptions = inOptions ?? {};
1833
+ if (!isFull && !inOptions.series && !options.dataZoom) {
1834
+ return false;
1835
+ }
1836
+ const xAxis = Array.isArray(options.xAxis) ? options.xAxis : [options.xAxis];
1837
+ if (!isFull && !inOptions.xAxis) {
1838
+ // for delta update, make sure we have same-sized axis array
1839
+ inOptions.xAxis = xAxis.map(() => ({}));
1840
+ }
1841
+ const minMax = this.getSeriesMinMax();
1842
+ // extend range if DZ is bigger than actual data
1843
+ const dz = inOptions?.dataZoom?.[0];
1844
+ if (dz?.startValue != null &&
1845
+ (minMax.min === undefined || dz.startValue < minMax.min)) {
1846
+ minMax.min = dz.startValue;
1847
+ }
1848
+ if (dz?.endValue != null &&
1849
+ (minMax.max === undefined || dz.endValue > minMax.max)) {
1850
+ minMax.max = dz.endValue;
1851
+ }
1852
+ // Update all sub chart index to be controlled by the dataZoom
1853
+ let xAxisIndexes = [];
1854
+ xAxis.forEach((axis, index) => {
1855
+ if (axis.gridIndex >= 0) {
1856
+ // set min/max the same on all axis so that datazoom can work
1857
+ axis.min = minMax.min;
1858
+ axis.max = minMax.max;
1859
+ if (!isFull) {
1860
+ inOptions.xAxis[index].min = minMax.min;
1861
+ inOptions.xAxis[index].max = minMax.max;
1862
+ }
1863
+ xAxisIndexes.push(index);
1864
+ }
1865
+ });
1866
+ // update dataZoom
1867
+ const effectiveOpts = this.getOptionNoClone();
1868
+ const effectiveXAxis = effectiveOpts.xAxis;
1869
+ if (effectiveXAxis.length > 1) {
1870
+ // 1. find out all visible series
1871
+ // 2. find out valid x index
1872
+ // 3. remove invalid x axis from the xAxisIndex array
1873
+ const validXAxis = this.getValidXAxis();
1874
+ if (validXAxis) {
1875
+ xAxisIndexes = xAxisIndexes.filter(index => validXAxis.has(index));
1876
+ }
1877
+ }
1878
+ if (xAxisIndexes.length) {
1879
+ const allDataZoom = options.dataZoom;
1880
+ allDataZoom.forEach(zoom => (zoom.xAxisIndex = xAxisIndexes));
1881
+ if (!isFull && inOptions.dataZoom) {
1882
+ inOptions.dataZoom.forEach(zoom => (zoom.xAxisIndex = xAxisIndexes));
1883
+ }
1884
+ }
1885
+ // update external slider if required
1886
+ if (this.externalZoomSlider()) {
1887
+ const extSliderAxis = this.extZoomSliderOptions.xAxis[0];
1888
+ if (extSliderAxis.min !== minMax.min || extSliderAxis.max !== minMax.max) {
1889
+ extSliderAxis.min = minMax.min;
1890
+ extSliderAxis.max = minMax.max;
1891
+ this.extZoomSliderOptions.series[0].data = [
1892
+ [minMax.min, null],
1893
+ [minMax.max, null]
1894
+ ];
1895
+ }
1896
+ }
1897
+ return true;
1898
+ }
1899
+ /**
1900
+ * Send action to echart.
1901
+ * @see https://echarts.apache.org/en/api.html#action
1902
+ */
1903
+ dispatchEChartAction(action) {
1904
+ if (!this.chart) {
1905
+ return;
1906
+ }
1907
+ this.ngZone.runOutsideAngular(() => {
1908
+ this.chart.dispatchAction(action);
1909
+ });
1910
+ this.cdRef.markForCheck();
1911
+ }
1912
+ getSeriesMinMax(visibleOnly = false) {
1913
+ const legend = visibleOnly ? this.internalGetModel().getComponent('legend') : undefined;
1914
+ let min;
1915
+ let max;
1916
+ this.actualOptions.series?.forEach(s => {
1917
+ const seriesData = s.data;
1918
+ if (seriesData?.length > 1 && (!legend || legend.isSelected(s.name))) {
1919
+ const start = seriesData[0][0]?.valueOf();
1920
+ const last = seriesData[seriesData.length - 1];
1921
+ // end value is can be undefined sometimes, if we don't have milliseconds as a value, instead
1922
+ // we have value[] array of Date, so to handle that scenario we are taking value[0].valueOf() to
1923
+ // calculate the millisecond value i.e from Date(value[0])
1924
+ const end = last[0]?.valueOf() ?? last.value?.[0]?.valueOf();
1925
+ if (this.isValidDataZoomValue(start) && this.isValidDataZoomValue(end)) {
1926
+ if (min === undefined || start < min) {
1927
+ min = start;
1928
+ }
1929
+ if (max === undefined || end > max) {
1930
+ max = end;
1931
+ }
1932
+ }
1933
+ }
1934
+ });
1935
+ return { min, max };
1936
+ }
1937
+ calculateVisibleRange(range) {
1938
+ const options = this.actualOptions;
1939
+ if (!options.xAxis || !this.hasDataZoom() || !range) {
1940
+ return;
1941
+ }
1942
+ if (!Array.isArray(options.xAxis) && options.xAxis.type === 'category') {
1943
+ this.visibleRange.set(Math.ceil(range.rangeEnd) - Math.floor(range.rangeStart));
1944
+ }
1945
+ else {
1946
+ this.visibleRange.set(Math.round(range.rangeEnd - range.rangeStart));
1947
+ }
1948
+ // once in range mode, disable the entries mode to prevent overriding the user
1949
+ this.visibleEntries.set(-1);
1950
+ }
1951
+ getValueFromSeriesPoint(point) {
1952
+ return Array.isArray(point) ? point : point.value;
1953
+ }
1954
+ calculateZoomStartValue() {
1955
+ const options = this.actualOptions;
1956
+ if (!options.series) {
1957
+ return null;
1958
+ }
1959
+ const seriesData = options.series[this.autoZoomSeriesIndex()]?.data;
1960
+ if (!seriesData) {
1961
+ return null;
1962
+ }
1963
+ if (this.visibleEntries() > -1) {
1964
+ const offset = Math.min(seriesData.length, this.visibleEntries());
1965
+ const data = seriesData[seriesData.length - offset];
1966
+ return data ? this.getValueFromSeriesPoint(data)[0] : null;
1967
+ }
1968
+ else if (this.visibleRange() > -1) {
1969
+ const minMax = this.getSeriesMinMax(true);
1970
+ if (minMax.min && minMax.max) {
1971
+ // make sure startValue is >= the min data value
1972
+ return Math.max(minMax.min, minMax.max - this.visibleRange());
1973
+ }
1974
+ const data = seriesData[seriesData.length - 1];
1975
+ return data ? this.getValueFromSeriesPoint(data)[0] - this.visibleRange() : null;
1976
+ }
1977
+ return null;
1978
+ }
1979
+ hasData() {
1980
+ return this.actualOptions.series?.some(s => s.data?.length > 0) ?? false;
1981
+ }
1982
+ /**
1983
+ * Re-render the chart series data. This method should be called on series data changes.
1984
+ */
1985
+ refreshSeries(isLive = true, dzToSet) {
1986
+ dzToSet ??= this.presetDataZoomRange;
1987
+ const optionsToUpdate = {
1988
+ series: this.actualOptions.series
1989
+ };
1990
+ if (!isLive) {
1991
+ this.updateEChart(false, optionsToUpdate);
1992
+ return;
1993
+ }
1994
+ if (this.hasDataZoom() && this.hasData()) {
1995
+ if (dzToSet) {
1996
+ this.dataZoomSetupDone = true;
1997
+ const dz = this.getPresetDataZoom(dzToSet);
1998
+ if (dz) {
1999
+ const requested = { ...dzToSet };
2000
+ this.presetDataZoomRange = undefined;
2001
+ this.updateDataZoom(dz, optionsToUpdate);
2002
+ // dispatch the same async. reasoning: the sync here is needed to prevent
2003
+ // flickering, the async dispatch to ensure a DataZoomEvent is fired so
2004
+ // that any consumer of this event work as expected
2005
+ setTimeout(() => {
2006
+ this.ngZone.runOutsideAngular(() => {
2007
+ this.requestedDataZoom = requested;
2008
+ this.handleDataZoom(dz, 'refreshSeries');
2009
+ });
2010
+ });
2011
+ }
2012
+ }
2013
+ else if (!this.dataZoomSetupDone) {
2014
+ // need to do this async to have the data in ECharts
2015
+ setTimeout(() => {
2016
+ if (!this.dataZoomSetupDone && !this.dataZoomRange() && this.chart) {
2017
+ this.calculateVisibleRange(this.getVisibleRange());
2018
+ }
2019
+ this.dataZoomSetupDone = true;
2020
+ });
2021
+ }
2022
+ else if (this.zoomSlider() && this.autoZoomUpdate && this.autoZoomSeriesIndex() !== -1) {
2023
+ // this ensures the slider is at the end and the window size remains stable, showing new data
2024
+ const startValue = this.calculateZoomStartValue();
2025
+ if (this.isValidDataZoomValue(startValue)) {
2026
+ this.updateDataZoom({ startValue, end: 100 }, optionsToUpdate);
2027
+ }
2028
+ if (isLive) {
2029
+ this.dispatchEChartAction({ type: 'hideTip' });
2030
+ }
2031
+ }
2032
+ else {
2033
+ // this ensures the current displayed window stays stable as new data arrives
2034
+ const dz = this.getOptionNoClone().dataZoom[0];
2035
+ if (this.isValidDataZoomValue(dz.startValue) &&
2036
+ this.isValidDataZoomValue(dz.endValue) &&
2037
+ dz.end !== 100) {
2038
+ this.updateDataZoom({ startValue: dz.startValue, endValue: dz.endValue }, optionsToUpdate);
2039
+ }
2040
+ }
2041
+ }
2042
+ this.updateEChart(false, optionsToUpdate);
2043
+ }
2044
+ // this ensures DZ is in sync everywhere
2045
+ updateDataZoom(dz, optionsToUpdate) {
2046
+ const options = this.actualOptions;
2047
+ if (options.dataZoom?.[0]) {
2048
+ this.doUpdateDZ(dz, options.dataZoom[0]);
2049
+ }
2050
+ if (optionsToUpdate && optionsToUpdate !== options) {
2051
+ if (Array.isArray(optionsToUpdate.dataZoom)) {
2052
+ this.doUpdateDZ(dz, optionsToUpdate.dataZoom[0]);
2053
+ }
2054
+ else if (optionsToUpdate.dataZoom) {
2055
+ this.doUpdateDZ(dz, optionsToUpdate.dataZoom);
2056
+ }
2057
+ else {
2058
+ optionsToUpdate.dataZoom = [{ ...dz }];
2059
+ }
2060
+ }
2061
+ if (this.externalZoomSlider()) {
2062
+ this.doUpdateDZ(dz, this.extZoomSliderOptions.dataZoom[0]);
2063
+ }
2064
+ }
2065
+ doUpdateDZ(dz, dzOptions) {
2066
+ // make sure only to have value or percent
2067
+ if (this.isValidDataZoomValue(dz.startValue)) {
2068
+ dzOptions.startValue = dz.startValue;
2069
+ dzOptions.start = undefined;
2070
+ }
2071
+ else if (this.isValidDataZoomValue(dz.start)) {
2072
+ dzOptions.start = dz.start;
2073
+ dzOptions.startValue = undefined;
2074
+ }
2075
+ if (this.isValidDataZoomValue(dz.endValue)) {
2076
+ dzOptions.endValue = dz.endValue;
2077
+ dzOptions.end = undefined;
2078
+ }
2079
+ else if (this.isValidDataZoomValue(dz.end)) {
2080
+ dzOptions.end = dz.end;
2081
+ dzOptions.endValue = undefined;
2082
+ }
2083
+ }
2084
+ applyStyles() {
2085
+ const bodyStyle = window.getComputedStyle(document.body);
2086
+ const options = this.actualOptions;
2087
+ options.textStyle = {
2088
+ fontFamily: bodyStyle.fontFamily,
2089
+ fontSize: bodyStyle.fontSize
2090
+ };
2091
+ this.extZoomSliderOptions.textStyle = options.textStyle;
2092
+ }
2093
+ addLegendItem(name, visible, index = 0, gridIndex = 0, customLegendProp, seriesSymbol) {
2094
+ const options = this.actualOptions;
2095
+ if (!options.legend?.length) {
2096
+ return;
2097
+ }
2098
+ const legend = options.legend[options.legend.length > index ? index : 0];
2099
+ const unitText = customLegendProp ? customLegendProp.unit : undefined;
2100
+ const customLegendItem = {
2101
+ name: '',
2102
+ displayName: '',
2103
+ color: '',
2104
+ selected: false,
2105
+ tooltip: customLegendProp ? customLegendProp.tooltip : '',
2106
+ symbol: this.getPath(seriesSymbol, false)
2107
+ };
2108
+ legend.data?.push({
2109
+ name,
2110
+ icon: this.getPath(seriesSymbol, true)
2111
+ });
2112
+ legend.selected ??= {};
2113
+ if (visible !== null && visible !== undefined) {
2114
+ legend.selected[name] = visible;
2115
+ customLegendItem.selected = visible;
2116
+ }
2117
+ const showCustomLegend = this.showCustomLegend();
2118
+ if (this.showLegend() && showCustomLegend) {
2119
+ if (visible !== false) {
2120
+ customLegendItem.selected = true;
2121
+ }
2122
+ customLegendItem.name = name;
2123
+ customLegendItem.displayName = customLegendProp?.displayName ?? name;
2124
+ if (showCustomLegend) {
2125
+ this.addCustomLegend(customLegendItem, unitText, index, gridIndex);
2126
+ }
2127
+ }
2128
+ this.cdRef.markForCheck();
2129
+ }
2130
+ getPath(seriesSymbol, prefix) {
2131
+ const path = seriesSymbol ? this.shapePaths[seriesSymbol] : this.shapePaths.circle;
2132
+ return prefix ? 'path://' + path : path;
2133
+ }
2134
+ addCustomLegend(customLegendItem, unitText, index, gridIndex = 0) {
2135
+ if (this.actualOptions.legend) {
2136
+ if (!this.customLegend[gridIndex].customLegends) {
2137
+ this.customLegend[gridIndex].customLegends = [
2138
+ { list: [], unit: '' },
2139
+ { list: [], unit: '' }
2140
+ ];
2141
+ }
2142
+ // index = 0 means left legend
2143
+ if (index === 0) {
2144
+ if (!this.customLegend[gridIndex]?.customLegends[0]?.list) {
2145
+ this.customLegend[gridIndex].customLegends[0] = { list: [customLegendItem] };
2146
+ }
2147
+ else {
2148
+ // legend with same id and name not found
2149
+ this.customLegend[gridIndex].customLegends[0].list.push(customLegendItem);
2150
+ }
2151
+ this.customLegend[gridIndex].customLegends[0].unit = unitText;
2152
+ }
2153
+ else {
2154
+ // index = 1 means right legend
2155
+ if (!this.customLegend[gridIndex]?.customLegends[1]?.list) {
2156
+ this.customLegend[gridIndex].customLegends[1] = { list: [customLegendItem] };
2157
+ }
2158
+ else {
2159
+ this.customLegend[gridIndex].customLegends[1].list.push(customLegendItem);
2160
+ }
2161
+ this.customLegend[gridIndex].customLegends[1].unit = unitText;
2162
+ }
2163
+ this.applyCustomLegendPosition();
2164
+ }
2165
+ }
2166
+ /**
2167
+ * Show loading indicator.
2168
+ */
2169
+ startProgressIndication() {
2170
+ this.inProgress.set(true);
2171
+ }
2172
+ /**
2173
+ * Hide loading indicator.
2174
+ */
2175
+ stopProgressIndication() {
2176
+ this.inProgress.set(false);
2177
+ }
2178
+ /**
2179
+ * Set the data zoom range for the chart in milliseconds.
2180
+ * As an example one hour is the value 3600000.
2181
+ */
2182
+ setTimeRange(range) {
2183
+ const currentDZ = this.getVisibleRange();
2184
+ const minMax = this.getSeriesMinMax(true);
2185
+ if (!currentDZ || minMax.min == null || minMax.max == null) {
2186
+ return;
2187
+ }
2188
+ const mid = (currentDZ.rangeStart + currentDZ.rangeEnd) / 2;
2189
+ const halfRange = range / 2;
2190
+ let start = 0;
2191
+ let end = 0;
2192
+ if (range === 0 || range > minMax.max - minMax.min) {
2193
+ start = minMax.min;
2194
+ end = minMax.max;
2195
+ }
2196
+ else {
2197
+ start = mid - halfRange;
2198
+ end = mid + halfRange;
2199
+ // at start
2200
+ if (start < minMax.min) {
2201
+ start = minMax.min;
2202
+ end = start + range;
2203
+ }
2204
+ // at end. Special case: if already at end, keep end
2205
+ if (end > minMax.max || currentDZ.rangeEnd === minMax.max) {
2206
+ start = minMax.max - range;
2207
+ end = minMax.max;
2208
+ }
2209
+ }
2210
+ this.dispatchEChartAction({ type: 'dataZoom', startValue: start, endValue: end });
2211
+ }
2212
+ addDataInternal(series) {
2213
+ const options = this.actualOptions;
2214
+ series.forEach(update => {
2215
+ const currentSeries = options.series[update.index];
2216
+ if (!currentSeries) {
2217
+ return;
2218
+ }
2219
+ const seriesData = currentSeries.data;
2220
+ seriesData.push(update.data);
2221
+ if (this.maxEntries() > 0 && seriesData.length > this.maxEntries()) {
2222
+ seriesData.splice(0, seriesData.length - this.maxEntries());
2223
+ }
2224
+ });
2225
+ this.refreshSeries();
2226
+ }
2227
+ getPresetDataZoom(range) {
2228
+ let ret;
2229
+ if (range.visibleWidth && this.autoZoomSeriesIndex() !== -1) {
2230
+ this.visibleRange.set(range.visibleWidth);
2231
+ const startValue = this.calculateZoomStartValue();
2232
+ if (this.isValidDataZoomValue(startValue)) {
2233
+ this.autoZoomUpdate = true;
2234
+ ret = { startValue, end: 100 };
2235
+ }
2236
+ }
2237
+ else if (this.isValidDataZoomValue(range.startValue) &&
2238
+ this.isValidDataZoomValue(range.endValue)) {
2239
+ // handling the case when startValue and endValue is given as a fixed time interval
2240
+ ret = {
2241
+ startValue: range.startValue,
2242
+ endValue: range.endValue
2243
+ };
2244
+ this.autoZoomUpdate = false;
2245
+ }
2246
+ else {
2247
+ ret = { ...range };
2248
+ }
2249
+ return ret;
2250
+ }
2251
+ checkGridSizeChange() {
2252
+ if (!this.chart) {
2253
+ return;
2254
+ }
2255
+ const gridRectNew = this.internalGetModel()?.getComponent('grid')?.coordinateSystem?._rect;
2256
+ if (gridRectNew) {
2257
+ const nativeWrapper = this.chartContainerWrapper().nativeElement;
2258
+ gridRectNew.containerWidth = nativeWrapper.offsetWidth;
2259
+ gridRectNew.containerHeight = nativeWrapper.offsetHeight;
2260
+ let isGridResized = false;
2261
+ for (const objKey of Object.keys(this.gridCoordinates)) {
2262
+ if (this.gridSizeItemChanged(gridRectNew[objKey], this.gridCoordinates[objKey])) {
2263
+ isGridResized = true;
2264
+ break;
2265
+ }
2266
+ }
2267
+ if (isGridResized) {
2268
+ // update new coordinates and emit event
2269
+ this.gridCoordinates = gridRectNew;
2270
+ this.timeBarLeft.set(this.gridCoordinates.x);
2271
+ this.timeBarRight.set(this.gridCoordinates.containerWidth - this.gridCoordinates.x - this.gridCoordinates.width);
2272
+ if (this.externalZoomSlider() && Array.isArray(this.extZoomSliderOptions?.grid)) {
2273
+ this.extZoomSliderOptions.grid[0].left = this.timeBarLeft();
2274
+ this.extZoomSliderOptions.grid[0].right = this.timeBarRight();
2275
+ this.extZoomSliderChart.setOption({ grid: this.extZoomSliderOptions.grid }, false);
2276
+ }
2277
+ this.ngZone.run(() => this.chartGridResized.emit(this.gridCoordinates));
2278
+ }
2279
+ }
2280
+ this.cdRef.markForCheck();
2281
+ }
2282
+ gridSizeItemChanged(a, b) {
2283
+ return Array.isArray(a)
2284
+ ? a.length !== b.length || a.some((item, index) => item !== b[index])
2285
+ : a !== b;
2286
+ }
2287
+ setContainerHeight() {
2288
+ const newHeight = parseInt(this.eChartContainerHeight(), 10) || null;
2289
+ if (newHeight !== this.containerHeight()) {
2290
+ this.containerHeight.set(newHeight);
2291
+ this.ngZone.runOutsideAngular(() => {
2292
+ this.chart?.resize({ width: this.curWidth, height: newHeight ?? this.curHeight });
2293
+ if (this.externalZoomSlider()) {
2294
+ this.extZoomSliderChart.resize();
2295
+ }
2296
+ });
2297
+ }
2298
+ }
2299
+ updateCustomLegendMultiLineInfo() {
2300
+ const event = [];
2301
+ this.siCustomLegend().forEach((legend, index) => {
2302
+ event.push({
2303
+ customLegendId: index,
2304
+ isCustomLegendMultilined: legend.customLegendContainer().nativeElement.offsetHeight > 20
2305
+ });
2306
+ });
2307
+ if (event.length !== this.customLegendsMultiLineInfo.length ||
2308
+ event.some((e, index) => e.isCustomLegendMultilined !==
2309
+ this.customLegendsMultiLineInfo[index].isCustomLegendMultilined)) {
2310
+ this.customLegendsMultiLineInfo = event;
2311
+ this.customLegendMultiLineInfoEvent.emit(event);
2312
+ }
2313
+ this.cdRef.markForCheck();
2314
+ }
2315
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2316
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiChartComponent, isStandalone: true, selector: "si-chart", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, additionalOptions: { classPropertyName: "additionalOptions", publicName: "additionalOptions", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, subTitle: { classPropertyName: "subTitle", publicName: "subTitle", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, showCustomLegend: { classPropertyName: "showCustomLegend", publicName: "showCustomLegend", isSignal: true, isRequired: false, transformFunction: null }, renderer: { classPropertyName: "renderer", publicName: "renderer", isSignal: true, isRequired: false, transformFunction: null }, zoomSlider: { classPropertyName: "zoomSlider", publicName: "zoomSlider", isSignal: true, isRequired: false, transformFunction: null }, zoomSliderShadow: { classPropertyName: "zoomSliderShadow", publicName: "zoomSliderShadow", isSignal: true, isRequired: false, transformFunction: null }, zoomSliderRealtime: { classPropertyName: "zoomSliderRealtime", publicName: "zoomSliderRealtime", isSignal: true, isRequired: false, transformFunction: null }, zoomSliderBrush: { classPropertyName: "zoomSliderBrush", publicName: "zoomSliderBrush", isSignal: true, isRequired: false, transformFunction: null }, zoomInside: { classPropertyName: "zoomInside", publicName: "zoomInside", isSignal: true, isRequired: false, transformFunction: null }, maxEntries: { classPropertyName: "maxEntries", publicName: "maxEntries", isSignal: true, isRequired: false, transformFunction: null }, visibleEntries: { classPropertyName: "visibleEntries", publicName: "visibleEntries", isSignal: true, isRequired: false, transformFunction: null }, visibleRange: { classPropertyName: "visibleRange", publicName: "visibleRange", isSignal: true, isRequired: false, transformFunction: null }, autoZoomSeriesIndex: { classPropertyName: "autoZoomSeriesIndex", publicName: "autoZoomSeriesIndex", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, themeCustomization: { classPropertyName: "themeCustomization", publicName: "themeCustomization", isSignal: true, isRequired: false, transformFunction: null }, palette: { classPropertyName: "palette", publicName: "palette", isSignal: true, isRequired: false, transformFunction: null }, axisPointer: { classPropertyName: "axisPointer", publicName: "axisPointer", isSignal: true, isRequired: false, transformFunction: null }, dataZoomRange: { classPropertyName: "dataZoomRange", publicName: "dataZoomRange", isSignal: true, isRequired: false, transformFunction: null }, dataZoomMinValueSpan: { classPropertyName: "dataZoomMinValueSpan", publicName: "dataZoomMinValueSpan", isSignal: true, isRequired: false, transformFunction: null }, dataZoomMaxValueSpan: { classPropertyName: "dataZoomMaxValueSpan", publicName: "dataZoomMaxValueSpan", isSignal: true, isRequired: false, transformFunction: null }, dataZoomFilterMode: { classPropertyName: "dataZoomFilterMode", publicName: "dataZoomFilterMode", isSignal: true, isRequired: false, transformFunction: null }, customLegendAction: { classPropertyName: "customLegendAction", publicName: "customLegendAction", isSignal: true, isRequired: false, transformFunction: null }, selectedItem: { classPropertyName: "selectedItem", publicName: "selectedItem", isSignal: true, isRequired: false, transformFunction: null }, eChartContainerHeight: { classPropertyName: "eChartContainerHeight", publicName: "eChartContainerHeight", isSignal: true, isRequired: false, transformFunction: null }, externalZoomSlider: { classPropertyName: "externalZoomSlider", publicName: "externalZoomSlider", isSignal: true, isRequired: false, transformFunction: null }, externalXAxisFormatter: { classPropertyName: "externalXAxisFormatter", publicName: "externalXAxisFormatter", isSignal: true, isRequired: false, transformFunction: null }, showTimeRangeBar: { classPropertyName: "showTimeRangeBar", publicName: "showTimeRangeBar", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { showLegend: "showLegendChange", visibleEntries: "visibleEntriesChange", visibleRange: "visibleRangeChange", dataZoom: "dataZoom", pointer: "pointer", selectionChanged: "selectionChanged", chartSeriesClick: "chartSeriesClick", chartGridResized: "chartGridResized", customLegendMultiLineInfoEvent: "customLegendMultiLineInfoEvent", timeRangeChange: "timeRangeChange" }, host: { listeners: { "window:theme-switch": "resetChart()" } }, viewQueries: [{ propertyName: "chartContainerWrapper", first: true, predicate: ["chartContainerWrapper"], descendants: true, isSignal: true }, { propertyName: "chartContainer", first: true, predicate: ["chart"], descendants: true, isSignal: true }, { propertyName: "externalZoomSliderContainer", first: true, predicate: ["externalZoomSlider"], descendants: true, isSignal: true }, { propertyName: "siCustomLegend", predicate: ["siCustomLegend"], descendants: true, read: SiCustomLegendComponent, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: SiCustomLegendComponent, selector: "si-custom-legend", inputs: ["customLegend", "title", "subTitle", "titleColor", "subTitleColor", "textColor"], outputs: ["legendIconClickEvent", "legendClickEvent", "legendHoverStartEvent", "legendHoverEndEvent"] }, { kind: "component", type: SiChartLoadingSpinnerComponent, selector: "si-chart-loading-spinner" }] });
2317
+ }
2318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartComponent, decorators: [{
2319
+ type: Component,
2320
+ args: [{ selector: 'si-chart', imports: [SiCustomLegendComponent, SiChartLoadingSpinnerComponent], template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"] }]
2321
+ }], propDecorators: { resetChart: [{
2322
+ type: HostListener,
2323
+ args: ['window:theme-switch']
2324
+ }] } });
2325
+
2326
+ /**
2327
+ * Copyright (c) Siemens 2016 - 2025
2328
+ * SPDX-License-Identifier: MIT
2329
+ */
2330
+
2331
+ /**
2332
+ * Copyright (c) Siemens 2016 - 2025
2333
+ * SPDX-License-Identifier: MIT
2334
+ */
2335
+ class SiChartCartesianComponent extends SiChartComponent {
2336
+ series = input();
2337
+ subChartGrids = input();
2338
+ yAxis = input();
2339
+ xAxis = input();
2340
+ tooltipFormatter = input();
2341
+ /**
2342
+ * Used to display the chart as a stacked one.
2343
+ *
2344
+ * @defaultValue false
2345
+ */
2346
+ stacked = input(false);
2347
+ /** Enable or disable brush zoom mode */
2348
+ zoomMode = input();
2349
+ // Used to toggle different chart types
2350
+ ngOnChanges(changes) {
2351
+ if (changes.zoomMode) {
2352
+ this.setZoomMode();
2353
+ }
2354
+ if (changes.stacked) {
2355
+ changes.forceAll = changes.stacked;
2356
+ }
2357
+ if (changes.subChartGrids) {
2358
+ changes.forceAll = changes.subChartGrids;
2359
+ }
2360
+ super.ngOnChanges(changes);
2361
+ }
2362
+ formatTooltip(p) {
2363
+ const params = Array.isArray(p) ? p : [p];
2364
+ const label = params[0]?.axisValueLabel ?? '';
2365
+ let html = label;
2366
+ for (const series of params) {
2367
+ const isCandle = series.componentSubType === 'candlestick';
2368
+ const isPie = series.componentSubType === 'pie';
2369
+ const useName = series.name != series.axisValue;
2370
+ const name = isPie
2371
+ ? series.data.name
2372
+ : useName
2373
+ ? // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
2374
+ series.name || series.seriesName
2375
+ : series.seriesName;
2376
+ const valIndex = (series.encode.value ?? series.encode.y)[0];
2377
+ const value = isCandle
2378
+ ? ''
2379
+ : isPie
2380
+ ? series.percent + '%'
2381
+ : Array.isArray(series.value)
2382
+ ? series.value[valIndex]
2383
+ : series.value;
2384
+ html += '<div style="display: flex; align-items: center;">';
2385
+ html += this.getSeriesMarkerSvg(name);
2386
+ html += `<span style="margin-inline: 4px 8px">${name}</span>`;
2387
+ html += `<span style="margin-inline-start: auto">${value}</span>`;
2388
+ html += '</div>';
2389
+ }
2390
+ return html;
2391
+ }
2392
+ /**
2393
+ * Get the series marker svg by series name.
2394
+ */
2395
+ getSeriesMarkerSvg(seriesName) {
2396
+ const seriesValue = this.actualOptions.series;
2397
+ let sym;
2398
+ if (seriesValue) {
2399
+ sym = this.getSeriesMarker(seriesName);
2400
+ const symbol = this.shapePaths[sym];
2401
+ const color = this.getSeriesColorBySeriesName(seriesName);
2402
+ return `<svg width="12" height="12" xmlns="http://www.w3.org/2000/svg">
2403
+ <path d="${symbol}" fill="${color}" />
2404
+ </svg>`;
2405
+ }
2406
+ return '';
2407
+ }
2408
+ /**
2409
+ * Get the series marker by series name.
2410
+ */
2411
+ getSeriesMarker(seriesName) {
2412
+ const seriesValue = this.actualOptions.series;
2413
+ if (seriesValue) {
2414
+ const seriesMarker = seriesValue.find(ser => ser.name === seriesName);
2415
+ if (seriesMarker && 'symbol' in seriesMarker) {
2416
+ return seriesMarker.symbol;
2417
+ }
2418
+ }
2419
+ return 'circle';
2420
+ }
2421
+ afterChartInit(skipZoom) {
2422
+ super.afterChartInit(skipZoom);
2423
+ if (this.zoomMode()) {
2424
+ this.setZoomMode();
2425
+ }
2426
+ }
2427
+ setZoomMode() {
2428
+ this.dispatchEChartAction({
2429
+ type: 'takeGlobalCursor',
2430
+ key: 'dataZoomSelect',
2431
+ dataZoomSelectActive: this.zoomMode()
2432
+ });
2433
+ }
2434
+ getValidXAxis() {
2435
+ const validXAxis = new Set();
2436
+ this.series()?.forEach(series => {
2437
+ if (series.visible !== false && series.xAxisIndex !== undefined) {
2438
+ validXAxis.add(series.xAxisIndex);
2439
+ }
2440
+ });
2441
+ return validXAxis;
2442
+ }
2443
+ applyOptions() {
2444
+ this.actualOptions = {
2445
+ series: [],
2446
+ xAxis: this.xAxis(),
2447
+ grid: this.getGrid(),
2448
+ yAxis: this.yAxis(),
2449
+ toolbox: {
2450
+ showTitle: false,
2451
+ itemSize: 0,
2452
+ feature: {
2453
+ dataZoom: {
2454
+ filterMode: 'none',
2455
+ xAxisIndex: 'all',
2456
+ yAxisIndex: false,
2457
+ icon: {
2458
+ zoom: 'image://',
2459
+ back: 'image://'
2460
+ }
2461
+ }
2462
+ }
2463
+ },
2464
+ legend: [
2465
+ {
2466
+ data: []
2467
+ },
2468
+ {
2469
+ data: []
2470
+ }
2471
+ ],
2472
+ tooltip: {
2473
+ trigger: 'axis'
2474
+ }
2475
+ };
2476
+ const tooltipFormatter = this.tooltipFormatter();
2477
+ if (tooltipFormatter) {
2478
+ this.actualOptions.tooltip.formatter = tooltipFormatter;
2479
+ }
2480
+ else if (this.hasDifferentMarker()) {
2481
+ this.actualOptions.tooltip.formatter = this.formatTooltip.bind(this);
2482
+ }
2483
+ const yAxis = this.yAxis();
2484
+ const yAxisArray = Array.isArray(yAxis) ? yAxis : yAxis ? [yAxis] : [];
2485
+ const numRight = yAxisArray.reduce((acc, cur) => acc + (cur.position === 'right' ? 1 : 0), 0);
2486
+ const numLeft = yAxisArray.length - numRight;
2487
+ const legendLeftOptions = this.getThemeCustomValue(['legendLeft'], {});
2488
+ const legendRightOptions = this.getThemeCustomValue(['legendRight'], {});
2489
+ let leftUnitText;
2490
+ let rightUnitText;
2491
+ const legends = this.actualOptions.legend;
2492
+ if (numLeft && numRight) {
2493
+ echarts.util.merge(legends[0], legendLeftOptions, true);
2494
+ echarts.util.merge(legends[1], legendRightOptions, true);
2495
+ }
2496
+ else if (Array.isArray(this.yAxis()) && numLeft) {
2497
+ echarts.util.merge(legends[0], { left: legendLeftOptions.left }, true);
2498
+ }
2499
+ else if (numRight) {
2500
+ echarts.util.merge(legends[1], { right: legendRightOptions.right }, true);
2501
+ }
2502
+ const subChartGrids = this.subChartGrids();
2503
+ if (subChartGrids) {
2504
+ if (subChartGrids.length !== this.customLegend.length) {
2505
+ const diff = subChartGrids.length - this.customLegend.length;
2506
+ if (diff < 0) {
2507
+ this.customLegend.length = subChartGrids.length;
2508
+ }
2509
+ else {
2510
+ for (let i = 0; i < diff; i++) {
2511
+ // Add default custom legends for all grids
2512
+ const cl = {
2513
+ customLegends: [
2514
+ { list: [], unit: '' },
2515
+ { list: [], unit: '' }
2516
+ ],
2517
+ legendAxis: 'both'
2518
+ };
2519
+ this.customLegend.push(cl);
2520
+ }
2521
+ }
2522
+ }
2523
+ const margin = 16;
2524
+ // calculate custom legend positions from top according to subcharts.
2525
+ for (let i = 0; i < subChartGrids.length; i++) {
2526
+ if (i === 0) {
2527
+ this.customLegend[i].top = 0;
2528
+ }
2529
+ else {
2530
+ const prevGrid = subChartGrids[i - 1];
2531
+ const subChartTop = prevGrid.top ?? 0;
2532
+ const subChartHeight = prevGrid.height ?? 0;
2533
+ this.customLegend[i].top = subChartTop + subChartHeight + margin;
2534
+ }
2535
+ }
2536
+ }
2537
+ const seriesValue = this.series();
2538
+ if (seriesValue) {
2539
+ const optionSeries = this.actualOptions.series;
2540
+ seriesValue.forEach(series => {
2541
+ const s = Object.assign({
2542
+ stack: this.stacked()
2543
+ }, series);
2544
+ if (s.type === 'line' && s.area) {
2545
+ delete s.area;
2546
+ s.areaStyle = {};
2547
+ }
2548
+ else {
2549
+ s.areaStyle ??= null;
2550
+ }
2551
+ delete s.visible;
2552
+ if ('symbol' in series && !this.shapePaths[series.symbol]) {
2553
+ s.symbol = 'circle';
2554
+ }
2555
+ optionSeries.push(s);
2556
+ if (this.showLegend() && series.name) {
2557
+ let legendIndex = 0;
2558
+ const axis = yAxisArray[series.yAxisIndex ?? 0];
2559
+ if (axis && axis.position === 'right') {
2560
+ legendIndex = 1;
2561
+ }
2562
+ let customLegendProp;
2563
+ if (this.showCustomLegend()) {
2564
+ // get left and right axis units from axis array
2565
+ if (axis && (axis.show === undefined || axis.show)) {
2566
+ if ((!leftUnitText || leftUnitText !== axis.name) && axis.position === 'left') {
2567
+ if (axis.name != null) {
2568
+ // axis.name is the same property name which eChart uses to display axis title,
2569
+ // hence in case of custom legends units were shown at two places i.e. at axis
2570
+ // title as well as custom legend unit section. Thus changing the property name
2571
+ // to customLegendUnit only in case custom legends are used.
2572
+ axis.customLegendUnit = axis.name;
2573
+ }
2574
+ if (axis.customLegendUnit != null) {
2575
+ leftUnitText = axis.customLegendUnit;
2576
+ }
2577
+ }
2578
+ else if ((!rightUnitText || rightUnitText !== axis.name) &&
2579
+ axis.position === 'right') {
2580
+ if (axis.name != null) {
2581
+ // axis.name is the same property name which eChart uses to display axis title,
2582
+ // hence in case of custom legends units were shown at two places i.e. at axis
2583
+ // title as well as custom legend unit section. Thus changing the property name
2584
+ // to customLegendUnit only in case custom legends are used.
2585
+ axis.customLegendUnit = axis.name;
2586
+ }
2587
+ if (axis.customLegendUnit != null) {
2588
+ rightUnitText = axis.customLegendUnit;
2589
+ }
2590
+ }
2591
+ delete axis.name;
2592
+ }
2593
+ const unitText = axis.position === 'right' ? rightUnitText : leftUnitText;
2594
+ customLegendProp = {
2595
+ displayName: s.displayName,
2596
+ tooltip: s.customLegendToolTip,
2597
+ unit: unitText
2598
+ };
2599
+ }
2600
+ // As we have only 1 xAxis per sub chart, xAxisIndex equals grid index.
2601
+ const seriesSymbol = 'symbol' in s ? s.symbol : 'circle';
2602
+ this.addLegendItem(series.name, series.visible, legendIndex, series.xAxisIndex, customLegendProp, seriesSymbol);
2603
+ }
2604
+ });
2605
+ }
2606
+ this.applyTitles();
2607
+ if (this.externalZoomSlider()) {
2608
+ this.extZoomSliderOptions.legend = this.actualOptions.legend;
2609
+ }
2610
+ }
2611
+ hasDifferentMarker() {
2612
+ const seriesValue = this.series();
2613
+ return !!seriesValue?.some(series => 'symbol' in series && series.symbol !== 'circle');
2614
+ }
2615
+ getGrid() {
2616
+ const subChartGrids = this.subChartGrids();
2617
+ if (subChartGrids) {
2618
+ subChartGrids.forEach(g => (g.containLabel = false));
2619
+ return subChartGrids;
2620
+ }
2621
+ return {};
2622
+ }
2623
+ refreshSeries(isLive = true, dzToSet) {
2624
+ const seriesValue = this.series();
2625
+ if (!seriesValue) {
2626
+ return;
2627
+ }
2628
+ const optionSeries = this.actualOptions.series;
2629
+ seriesValue.forEach((series, i) => {
2630
+ optionSeries[i].data = series.data;
2631
+ });
2632
+ super.refreshSeries(isLive, dzToSet);
2633
+ }
2634
+ hasData() {
2635
+ return this.series()?.some(s => s.visible !== false && s.data && s.data.length > 0) ?? false;
2636
+ }
2637
+ handleSelectionChanged(event) {
2638
+ if (event?.selected) {
2639
+ this.series()?.forEach(series => (series.visible = event.selected[series.name] !== false));
2640
+ }
2641
+ super.handleSelectionChanged(event);
2642
+ }
2643
+ /**
2644
+ * Update single chart data entry.
2645
+ */
2646
+ addData(index, data) {
2647
+ this.addDataInternal([{ index, data }]);
2648
+ }
2649
+ /**
2650
+ * Append charts data entries to the end of the series.
2651
+ */
2652
+ addDataMulti(series) {
2653
+ this.addDataInternal(series);
2654
+ }
2655
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartCartesianComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2656
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiChartCartesianComponent, isStandalone: true, selector: "si-chart-cartesian", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, subChartGrids: { classPropertyName: "subChartGrids", publicName: "subChartGrids", isSignal: true, isRequired: false, transformFunction: null }, yAxis: { classPropertyName: "yAxis", publicName: "yAxis", isSignal: true, isRequired: false, transformFunction: null }, xAxis: { classPropertyName: "xAxis", publicName: "xAxis", isSignal: true, isRequired: false, transformFunction: null }, tooltipFormatter: { classPropertyName: "tooltipFormatter", publicName: "tooltipFormatter", isSignal: true, isRequired: false, transformFunction: null }, stacked: { classPropertyName: "stacked", publicName: "stacked", isSignal: true, isRequired: false, transformFunction: null }, zoomMode: { classPropertyName: "zoomMode", publicName: "zoomMode", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: SiCustomLegendComponent, selector: "si-custom-legend", inputs: ["customLegend", "title", "subTitle", "titleColor", "subTitleColor", "textColor"], outputs: ["legendIconClickEvent", "legendClickEvent", "legendHoverStartEvent", "legendHoverEndEvent"] }, { kind: "component", type: SiChartLoadingSpinnerComponent, selector: "si-chart-loading-spinner" }] });
2657
+ }
2658
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartCartesianComponent, decorators: [{
2659
+ type: Component,
2660
+ args: [{ selector: 'si-chart-cartesian', imports: [SiCustomLegendComponent, SiChartLoadingSpinnerComponent], template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"] }]
2661
+ }] });
2662
+
2663
+ /**
2664
+ * Copyright (c) Siemens 2016 - 2025
2665
+ * SPDX-License-Identifier: MIT
2666
+ */
2667
+
2668
+ /**
2669
+ * Copyright (c) Siemens 2016 - 2025
2670
+ * SPDX-License-Identifier: MIT
2671
+ */
2672
+ class SiChartCircleComponent extends SiChartComponent {
2673
+ series = input();
2674
+ applyOptions() {
2675
+ this.actualOptions = {
2676
+ series: [],
2677
+ legend: [
2678
+ {
2679
+ data: []
2680
+ }
2681
+ ],
2682
+ tooltip: {
2683
+ trigger: 'item',
2684
+ confine: true
2685
+ }
2686
+ };
2687
+ const optionSeries = this.actualOptions.series;
2688
+ const offset = !this.showCustomLegend() && this.subTitle()
2689
+ ? this.getThemeCustomValue(['subTitle', 'legend', 'top'], 0)
2690
+ : 0;
2691
+ const top = 32 + offset;
2692
+ this.series()?.forEach(series => {
2693
+ const s = Object.assign({ type: 'pie', top }, series);
2694
+ optionSeries.push(s);
2695
+ if (this.showLegend()) {
2696
+ series.data.forEach(data => {
2697
+ if (data.name) {
2698
+ this.addLegendItem(data.name);
2699
+ }
2700
+ });
2701
+ }
2702
+ });
2703
+ this.applyTitles();
2704
+ }
2705
+ applyDataZoom() { }
2706
+ /**
2707
+ * Update single value of the circle chart.
2708
+ */
2709
+ changeSingleValue(index, valueIndex, value) {
2710
+ const optionSeries = this.actualOptions.series;
2711
+ const series = optionSeries[index].data;
2712
+ series[valueIndex].value = value;
2713
+ this.updateEChart();
2714
+ }
2715
+ /**
2716
+ * Update multiple values of the circle chart.
2717
+ */
2718
+ changeMultiValues(updateValues) {
2719
+ const optionSeries = this.actualOptions.series;
2720
+ updateValues.forEach(update => {
2721
+ const currentSeries = optionSeries[update.seriesIndex].data;
2722
+ if (!currentSeries) {
2723
+ return;
2724
+ }
2725
+ currentSeries[update.valueIndex].value = update.value;
2726
+ });
2727
+ this.updateEChart();
2728
+ }
2729
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartCircleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2730
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiChartCircleComponent, isStandalone: true, selector: "si-chart-circle", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: SiCustomLegendComponent, selector: "si-custom-legend", inputs: ["customLegend", "title", "subTitle", "titleColor", "subTitleColor", "textColor"], outputs: ["legendIconClickEvent", "legendClickEvent", "legendHoverStartEvent", "legendHoverEndEvent"] }, { kind: "component", type: SiChartLoadingSpinnerComponent, selector: "si-chart-loading-spinner" }] });
2731
+ }
2732
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartCircleComponent, decorators: [{
2733
+ type: Component,
2734
+ args: [{ selector: 'si-chart-circle', imports: [SiCustomLegendComponent, SiChartLoadingSpinnerComponent], template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"] }]
2735
+ }] });
2736
+
2737
+ /**
2738
+ * Copyright (c) Siemens 2016 - 2025
2739
+ * SPDX-License-Identifier: MIT
2740
+ */
2741
+
2742
+ /**
2743
+ * Copyright (c) Siemens 2016 - 2025
2744
+ * SPDX-License-Identifier: MIT
2745
+ */
2746
+ class SiChartGaugeComponent extends SiChartComponent {
2747
+ /** @defaultValue 0 */
2748
+ minValue = input(0);
2749
+ /** @defaultValue 100 */
2750
+ maxValue = input(100);
2751
+ /** @defaultValue 0 */
2752
+ value = input(0);
2753
+ splitSteps = input();
2754
+ /** @defaultValue true */
2755
+ responsiveSplitSteps = input(true);
2756
+ /** @defaultValue '%' */
2757
+ unit = input('%');
2758
+ /** @defaultValue false */
2759
+ unitsOnSplit = input(false);
2760
+ /**
2761
+ * Custom formatter for axis labels.
2762
+ * Takes precedence when specified, i.e. number of decimals, unit etc needs
2763
+ * to be set by the user using this formatter.
2764
+ */
2765
+ labelFormatter = input();
2766
+ /**
2767
+ * Custom formatter for value.
2768
+ * Takes precedence when specified, i.e. number of decimals needs
2769
+ * to be set by the user using this formatter.
2770
+ */
2771
+ valueFormatter = input();
2772
+ /**
2773
+ * Sets the number of decimals.
2774
+ * @deprecated Use `minNumberOfDecimals` and `maxNumberOfDecimals` instead.
2775
+ * @defaultValue undefined */
2776
+ numberOfDecimals = input();
2777
+ /**
2778
+ * Min number of decimals.
2779
+ * @defaultValue 0
2780
+ */
2781
+ minNumberOfDecimals = input(0);
2782
+ /**
2783
+ * Max number of decimals.
2784
+ * @defaultValue 0
2785
+ */
2786
+ maxNumberOfDecimals = input(0);
2787
+ /**
2788
+ * Number of decimals on the axis.
2789
+ * @defaultValue 0
2790
+ */
2791
+ axisNumberOfDecimals = input(0);
2792
+ /** @defaultValue false */
2793
+ hideAxisLabels = input(false, { transform: booleanAttribute });
2794
+ /**
2795
+ * Segments on the arc from 0 (implicit) to 1 (explicit)
2796
+ * E.g. 0.2 means from 0 to 0.2 of the possible range (maxValue - minValue)
2797
+ *
2798
+ * @defaultValue [0.2, 0.8, 1]
2799
+ */
2800
+ segments = input([0.2, 0.8, 1]);
2801
+ /**
2802
+ * Colors for the defined segments.
2803
+ * If there are less colors then segments, the colors will be repeated. Defaults to the standard color palette
2804
+ */
2805
+ colors = input();
2806
+ locale = inject(LOCALE_ID).toString();
2807
+ actualMinNumberOfDecimals = computed(() => this.numberOfDecimals() ?? this.minNumberOfDecimals());
2808
+ actualMaxNumberOfDecimals = computed(() => this.numberOfDecimals() ?? this.maxNumberOfDecimals());
2809
+ numberFormat = computed(() => {
2810
+ const minDecimals = this.actualMinNumberOfDecimals();
2811
+ return new Intl.NumberFormat(this.locale, {
2812
+ minimumFractionDigits: minDecimals,
2813
+ maximumFractionDigits: Math.max(minDecimals, this.actualMaxNumberOfDecimals())
2814
+ });
2815
+ });
2816
+ axisNumberFormat = computed(() => {
2817
+ const decimals = this.axisNumberOfDecimals();
2818
+ return new Intl.NumberFormat(this.locale, {
2819
+ minimumFractionDigits: decimals,
2820
+ maximumFractionDigits: decimals
2821
+ });
2822
+ });
2823
+ afterChartInit() {
2824
+ super.afterChartInit();
2825
+ this.applyOptions();
2826
+ this.updateColors();
2827
+ this.refreshSeries();
2828
+ }
2829
+ updateColors() {
2830
+ // gauge doesn't respect color palette, it needs a bit convincing
2831
+ const effectiveOpts = this.getOptionNoClone();
2832
+ const colors = this.colors() ?? effectiveOpts.color;
2833
+ const hasIndicator = !!this.segments().length;
2834
+ let newColors;
2835
+ if (hasIndicator) {
2836
+ newColors = this.segments().map((threshold, index) => {
2837
+ const color = colors[index % colors.length];
2838
+ return [threshold, color];
2839
+ });
2840
+ }
2841
+ else {
2842
+ const colorsValue = this.colors();
2843
+ const dataColor = colorsValue?.length
2844
+ ? colorsValue[0]
2845
+ : this.getThemeCustomValue(['gauge', 'defaultColor'], colors[0]);
2846
+ newColors = [[1, dataColor]];
2847
+ }
2848
+ if (hasIndicator) {
2849
+ this.setAxisLineColor(newColors, this.actualOptions.series[0].axisLine);
2850
+ }
2851
+ this.actualOptions.series[0].axisLine.show = hasIndicator;
2852
+ this.setAxisLineColor(newColors, this.actualOptions.series[2].axisLine);
2853
+ this.refreshSeries();
2854
+ }
2855
+ setAxisLineColor(colors, axisLine) {
2856
+ axisLine.lineStyle = axisLine.lineStyle ?? {};
2857
+ axisLine.lineStyle.color = colors;
2858
+ }
2859
+ getResponsiveConfig() {
2860
+ const marginY = 12;
2861
+ const maxHeight = this.curHeight - marginY;
2862
+ const dim = Math.min(this.curWidth / 2, maxHeight);
2863
+ const top = dim < maxHeight ? this.curHeight / 2 + dim / 2 : maxHeight;
2864
+ if (dim < 150) {
2865
+ const splits = dim < 100 ? 1 : 4;
2866
+ const axisLabelDist = dim < 100 ? -6 : 0;
2867
+ return {
2868
+ outerRadius: dim - 4,
2869
+ center: ['50%', top],
2870
+ progressWidth: 8,
2871
+ indicatorWidth: 1,
2872
+ gap: 2,
2873
+ splits,
2874
+ axisLabelDist,
2875
+ axisFontSize: 12,
2876
+ valueFontSize: 18,
2877
+ unitFontSize: 12
2878
+ };
2879
+ }
2880
+ if (dim < 200) {
2881
+ return {
2882
+ outerRadius: dim - 7,
2883
+ center: ['50%', top],
2884
+ progressWidth: 14,
2885
+ indicatorWidth: 3,
2886
+ gap: 3,
2887
+ splits: 6,
2888
+ axisLabelDist: 12,
2889
+ axisFontSize: 16,
2890
+ valueFontSize: 30,
2891
+ unitFontSize: 14
2892
+ };
2893
+ }
2894
+ return {
2895
+ outerRadius: dim - 12,
2896
+ center: ['50%', top],
2897
+ progressWidth: 24,
2898
+ indicatorWidth: 4,
2899
+ gap: 5,
2900
+ splits: 0,
2901
+ axisLabelDist: 20,
2902
+ axisFontSize: 20,
2903
+ valueFontSize: 48,
2904
+ unitFontSize: 16
2905
+ };
2906
+ }
2907
+ calcValue(value) {
2908
+ // workaround for bug in echarts
2909
+ if (value === this.minValue()) {
2910
+ return value + 0.0001;
2911
+ }
2912
+ return value;
2913
+ }
2914
+ axisLabelFormatter = (value) => {
2915
+ const formatted = this.axisNumberFormat().format(Number(value));
2916
+ return this.unitsOnSplit() ? `${formatted} ${this.unit()}` : formatted;
2917
+ };
2918
+ applyOptions() {
2919
+ const resp = this.getResponsiveConfig();
2920
+ const hasIndicator = !!this.segments().length;
2921
+ const splitNumber = this.responsiveSplitSteps() && resp.splits ? resp.splits : this.splitSteps();
2922
+ const grey = this.getThemeCustomValue(['gauge', 'grey'], '#F0F2F5');
2923
+ const axisColor = this.getThemeCustomValue(['gauge', 'unit'], '#656A6F');
2924
+ const indicator = {
2925
+ type: 'gauge',
2926
+ radius: resp.outerRadius - resp.progressWidth - resp.gap,
2927
+ startAngle: 180,
2928
+ endAngle: 0,
2929
+ min: this.minValue(),
2930
+ max: this.maxValue(),
2931
+ center: resp.center,
2932
+ axisLine: {
2933
+ show: hasIndicator,
2934
+ lineStyle: { width: resp.indicatorWidth }
2935
+ },
2936
+ axisTick: {
2937
+ length: 0,
2938
+ splitNumber: 1,
2939
+ lineStyle: {
2940
+ width: 2,
2941
+ color: axisColor
2942
+ }
2943
+ },
2944
+ splitLine: {
2945
+ length: 0,
2946
+ lineStyle: {
2947
+ width: 1,
2948
+ color: axisColor
2949
+ }
2950
+ },
2951
+ axisLabel: { show: false }
2952
+ };
2953
+ const labelDistance = resp.axisLabelDist + (hasIndicator ? resp.indicatorWidth + resp.gap : 0);
2954
+ const shade = {
2955
+ type: 'gauge',
2956
+ radius: resp.outerRadius,
2957
+ startAngle: 180,
2958
+ endAngle: 0,
2959
+ min: this.minValue(),
2960
+ max: this.maxValue(),
2961
+ splitNumber,
2962
+ axisTick: { show: false },
2963
+ splitLine: { show: false },
2964
+ title: { show: false },
2965
+ center: resp.center,
2966
+ axisLine: {
2967
+ lineStyle: {
2968
+ width: resp.progressWidth,
2969
+ opacity: 0.6,
2970
+ color: [[1, grey]]
2971
+ }
2972
+ },
2973
+ axisLabel: {
2974
+ show: !this.hideAxisLabels(),
2975
+ distance: labelDistance,
2976
+ color: axisColor,
2977
+ fontSize: resp.axisFontSize,
2978
+ formatter: this.labelFormatter() ?? this.axisLabelFormatter
2979
+ }
2980
+ };
2981
+ const data = {
2982
+ type: 'gauge',
2983
+ silent: false,
2984
+ radius: resp.outerRadius,
2985
+ startAngle: 180,
2986
+ endAngle: 0,
2987
+ min: this.minValue(),
2988
+ max: this.maxValue(),
2989
+ splitNumber,
2990
+ progress: {
2991
+ show: true,
2992
+ itemStyle: { color: 'auto' },
2993
+ width: resp.progressWidth
2994
+ },
2995
+ emphasis: {
2996
+ // This code is added to avoid flickering when the progress is hovered and
2997
+ // when mouse effects are enabled with `silent: false` flag. The issue occurs
2998
+ // because of the progress.itemStyle.color is set to `auto` which tries to
2999
+ // calculate the color dynamically and it conflicts with the mouse hover action
3000
+ // which tries to apply the hover style
3001
+ itemStyle: { color: 'auto' }
3002
+ },
3003
+ pointer: {
3004
+ show: true,
3005
+ length: '0%',
3006
+ itemStyle: {
3007
+ color: 'auto',
3008
+ opacity: 0.001
3009
+ }
3010
+ },
3011
+ center: resp.center,
3012
+ axisLine: {
3013
+ show: false,
3014
+ lineStyle: { opacity: 0.6 }
3015
+ },
3016
+ axisTick: { show: false },
3017
+ splitLine: { show: false },
3018
+ axisLabel: { show: false },
3019
+ title: { show: false },
3020
+ detail: {
3021
+ offsetCenter: [0, -0.5 * resp.valueFontSize],
3022
+ valueAnimation: true,
3023
+ formatter: this.valueFormatterInternal(),
3024
+ rich: {
3025
+ value: {
3026
+ fontSize: resp.valueFontSize,
3027
+ lineHeight: resp.valueFontSize,
3028
+ fontWeight: 'bolder'
3029
+ },
3030
+ unit: {
3031
+ fontSize: resp.unitFontSize,
3032
+ lineHeight: resp.unitFontSize,
3033
+ padding: [0, 0, (resp.unitFontSize - resp.valueFontSize) / 2, 0]
3034
+ }
3035
+ }
3036
+ },
3037
+ data: [{ value: this.calcValue(this.value()) }]
3038
+ };
3039
+ const series = [indicator, shade, data];
3040
+ this.showLegend.set(false);
3041
+ this.actualOptions.series = series;
3042
+ this.applyTitles();
3043
+ }
3044
+ valueFormatterInternal() {
3045
+ const unit = this.unit();
3046
+ const valueFormatter = this.valueFormatter();
3047
+ const labelFormatter = this.labelFormatter();
3048
+ const formattedUnit = unit ? (unit.length > 5 ? `\n{unit|${unit}}` : ` {unit|${unit}}`) : '';
3049
+ return (value) => {
3050
+ if (valueFormatter) {
3051
+ return `{value|${valueFormatter(value)}}${formattedUnit}`;
3052
+ }
3053
+ // DEPRECATED: Use the new input `valueFormatter` to format the value.
3054
+ // labelFormatter should be removed from here in future versions.
3055
+ if (labelFormatter) {
3056
+ return labelFormatter(value);
3057
+ }
3058
+ return `{value|${this.numberFormat().format(value)}}${formattedUnit}`;
3059
+ };
3060
+ }
3061
+ ngOnChanges(changes) {
3062
+ if (this.chart && (changes.palette || changes.colors || changes.segments)) {
3063
+ this.updateColors();
3064
+ }
3065
+ changes.forceAll = new SimpleChange(false, true, false);
3066
+ super.ngOnChanges(changes);
3067
+ }
3068
+ applyDataZoom() { }
3069
+ afterChartResize() {
3070
+ this.applyOptions();
3071
+ this.refreshSeries();
3072
+ }
3073
+ /**
3074
+ * Update gauge chart value.
3075
+ */
3076
+ setValue(value) {
3077
+ const optionSeries = this.actualOptions.series;
3078
+ optionSeries[2].data[0].value = this.calcValue(value);
3079
+ this.refreshSeries();
3080
+ }
3081
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartGaugeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3082
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiChartGaugeComponent, isStandalone: true, selector: "si-chart-gauge", inputs: { minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, splitSteps: { classPropertyName: "splitSteps", publicName: "splitSteps", isSignal: true, isRequired: false, transformFunction: null }, responsiveSplitSteps: { classPropertyName: "responsiveSplitSteps", publicName: "responsiveSplitSteps", isSignal: true, isRequired: false, transformFunction: null }, unit: { classPropertyName: "unit", publicName: "unit", isSignal: true, isRequired: false, transformFunction: null }, unitsOnSplit: { classPropertyName: "unitsOnSplit", publicName: "unitsOnSplit", isSignal: true, isRequired: false, transformFunction: null }, labelFormatter: { classPropertyName: "labelFormatter", publicName: "labelFormatter", isSignal: true, isRequired: false, transformFunction: null }, valueFormatter: { classPropertyName: "valueFormatter", publicName: "valueFormatter", isSignal: true, isRequired: false, transformFunction: null }, numberOfDecimals: { classPropertyName: "numberOfDecimals", publicName: "numberOfDecimals", isSignal: true, isRequired: false, transformFunction: null }, minNumberOfDecimals: { classPropertyName: "minNumberOfDecimals", publicName: "minNumberOfDecimals", isSignal: true, isRequired: false, transformFunction: null }, maxNumberOfDecimals: { classPropertyName: "maxNumberOfDecimals", publicName: "maxNumberOfDecimals", isSignal: true, isRequired: false, transformFunction: null }, axisNumberOfDecimals: { classPropertyName: "axisNumberOfDecimals", publicName: "axisNumberOfDecimals", isSignal: true, isRequired: false, transformFunction: null }, hideAxisLabels: { classPropertyName: "hideAxisLabels", publicName: "hideAxisLabels", isSignal: true, isRequired: false, transformFunction: null }, segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: SiCustomLegendComponent, selector: "si-custom-legend", inputs: ["customLegend", "title", "subTitle", "titleColor", "subTitleColor", "textColor"], outputs: ["legendIconClickEvent", "legendClickEvent", "legendHoverStartEvent", "legendHoverEndEvent"] }, { kind: "component", type: SiChartLoadingSpinnerComponent, selector: "si-chart-loading-spinner" }] });
3083
+ }
3084
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartGaugeComponent, decorators: [{
3085
+ type: Component,
3086
+ args: [{ selector: 'si-chart-gauge', imports: [SiCustomLegendComponent, SiChartLoadingSpinnerComponent], template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"] }]
3087
+ }] });
3088
+
3089
+ /**
3090
+ * Copyright (c) Siemens 2016 - 2025
3091
+ * SPDX-License-Identifier: MIT
3092
+ */
3093
+
3094
+ /**
3095
+ * Copyright (c) Siemens 2016 - 2025
3096
+ * SPDX-License-Identifier: MIT
3097
+ */
3098
+ class SiChartProgressComponent extends SiChartComponent {
3099
+ series = input();
3100
+ /**
3101
+ * How big the data can get in degrees.
3102
+ *
3103
+ * @defaultValue 220
3104
+ */
3105
+ dataAngle = input(220);
3106
+ // item width in % radius
3107
+ itemWidth;
3108
+ // item gap in % radius
3109
+ itemGap;
3110
+ // base radius of an item
3111
+ baseRadius = 98;
3112
+ sizeFactor;
3113
+ // placement chart in % on canvas
3114
+ center;
3115
+ // color of disabled part of item
3116
+ grey;
3117
+ // where the data starts. not very intuitive:
3118
+ // 0° is at 3 o'clock, goes counterclockwise, but series drawing goes clockwise
3119
+ startAngle;
3120
+ afterChartInit() {
3121
+ this.chart.on('legendselectchanged', (params) => {
3122
+ this.updateRadius(params.selected);
3123
+ this.updateEChart();
3124
+ });
3125
+ }
3126
+ themeChanged() {
3127
+ this.applyOptions();
3128
+ }
3129
+ handleSelectionChanged(event) {
3130
+ super.handleSelectionChanged(event);
3131
+ this.updateRadius(event.selected);
3132
+ this.updateEChart();
3133
+ }
3134
+ applyOptions() {
3135
+ this.actualOptions = {
3136
+ series: [],
3137
+ legend: [
3138
+ {
3139
+ data: []
3140
+ }
3141
+ ]
3142
+ };
3143
+ const dataAngle = this.dataAngle();
3144
+ this.startAngle = dataAngle === 360 ? 90 : 270 - (360 - dataAngle) / 2;
3145
+ this.itemWidth = this.getThemeCustomValue(['progress', 'itemWidth'], 6);
3146
+ this.itemGap = this.getThemeCustomValue(['progress', 'itemGap'], 6);
3147
+ this.grey = this.getThemeCustomValue(['progress', 'grey'], '#E6E6E6');
3148
+ // a factor to change the size of base radius and center related to
3149
+ // dataAngle proportionately
3150
+ this.sizeFactor = 1 - Math.sin((((this.dataAngle() - 180) / 2) * Math.PI) / 180);
3151
+ this.center = 50 + 25 * this.sizeFactor;
3152
+ const seriesValue = this.series();
3153
+ if (seriesValue) {
3154
+ seriesValue.forEach(series => {
3155
+ this.addSeries(series.name, series.percent);
3156
+ if (this.showLegend()) {
3157
+ this.addLegendItem(series.name);
3158
+ }
3159
+ });
3160
+ }
3161
+ this.applyTitles();
3162
+ }
3163
+ labelFormatter(p) {
3164
+ return p.seriesName + '\n' + Math.round((100 / this.dataAngle()) * p.value) + ' %';
3165
+ }
3166
+ addSeries(name, percent) {
3167
+ const optionSeries = this.actualOptions.series;
3168
+ const index = optionSeries.length;
3169
+ const offset = !this.showCustomLegend() && this.subTitle()
3170
+ ? this.getThemeCustomValue(['subTitle', 'legend', 'top'], 0)
3171
+ : 0;
3172
+ const top = !this.sizeFactor ? 32 + offset : Math.floor(offset / 2);
3173
+ const bottom = !this.sizeFactor ? undefined : -offset;
3174
+ const item = {
3175
+ top,
3176
+ bottom,
3177
+ center: ['50%', this.center + '%'],
3178
+ name,
3179
+ type: 'pie',
3180
+ colorBy: 'series',
3181
+ radius: this.calculateRadius(index),
3182
+ avoidLabelOverlap: false,
3183
+ tooltip: { show: false },
3184
+ startAngle: this.startAngle,
3185
+ label: {
3186
+ show: false,
3187
+ formatter: p => this.labelFormatter(p),
3188
+ position: 'center'
3189
+ },
3190
+ labelLine: {
3191
+ show: false
3192
+ },
3193
+ emphasis: {
3194
+ label: {
3195
+ show: true,
3196
+ lineHeight: 30,
3197
+ fontSize: '30',
3198
+ fontWeight: 'bold'
3199
+ }
3200
+ },
3201
+ itemStyle: {
3202
+ borderWidth: 0
3203
+ },
3204
+ data: [
3205
+ {
3206
+ value: 0,
3207
+ name: 'v' + index,
3208
+ label: {
3209
+ lineHeight: 30,
3210
+ fontSize: 30,
3211
+ color: 'inherit'
3212
+ }
3213
+ },
3214
+ {
3215
+ value: 0,
3216
+ name: 'a' + index,
3217
+ itemStyle: { color: this.grey },
3218
+ emphasis: {
3219
+ scale: false,
3220
+ itemStyle: { color: this.grey }
3221
+ },
3222
+ cursor: 'default',
3223
+ label: { show: false }
3224
+ },
3225
+ {
3226
+ value: 0,
3227
+ name: 'b' + index,
3228
+ itemStyle: { color: 'rgba(0,0,0,0)' },
3229
+ cursor: 'default',
3230
+ label: { show: false }
3231
+ }
3232
+ ]
3233
+ };
3234
+ this.updateData(item, percent);
3235
+ optionSeries.push(item);
3236
+ }
3237
+ updateData(series, percent) {
3238
+ const angle = (this.dataAngle() * percent) / 100;
3239
+ series.data[0].value = angle;
3240
+ series.data[1].value = this.dataAngle() - angle;
3241
+ series.data[2].value = 360 - this.dataAngle();
3242
+ series.realValue = percent;
3243
+ }
3244
+ calculateRadius(index) {
3245
+ const outerRadius = this.baseRadius - index * (this.itemWidth + this.itemGap);
3246
+ const innerRadius = outerRadius - this.itemWidth;
3247
+ return [innerRadius + '%', outerRadius + '%'];
3248
+ }
3249
+ updateRadius(selected) {
3250
+ let visibleIndex = 0;
3251
+ const optionSeries = this.actualOptions.series;
3252
+ optionSeries.forEach(series => {
3253
+ if (selected[series.name] === false) {
3254
+ return;
3255
+ }
3256
+ series.radius = this.calculateRadius(visibleIndex);
3257
+ visibleIndex++;
3258
+ });
3259
+ }
3260
+ applyDataZoom() { }
3261
+ /**
3262
+ * Update single value of the progress chart.
3263
+ */
3264
+ changeSingleValue(index, percent) {
3265
+ const optionSeries = this.actualOptions.series;
3266
+ this.updateData(optionSeries[index], percent);
3267
+ this.updateEChart();
3268
+ }
3269
+ /**
3270
+ * Update multiple values of the progress chart.
3271
+ */
3272
+ changeMultiValues(updateValues) {
3273
+ const optionSeries = this.actualOptions.series;
3274
+ updateValues.forEach(update => {
3275
+ const currentSeries = optionSeries[update.seriesIndex];
3276
+ if (!currentSeries) {
3277
+ return;
3278
+ }
3279
+ this.updateData(currentSeries, update.percent);
3280
+ });
3281
+ this.updateEChart();
3282
+ }
3283
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartProgressComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3284
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiChartProgressComponent, isStandalone: true, selector: "si-chart-progress", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, dataAngle: { classPropertyName: "dataAngle", publicName: "dataAngle", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: SiCustomLegendComponent, selector: "si-custom-legend", inputs: ["customLegend", "title", "subTitle", "titleColor", "subTitleColor", "textColor"], outputs: ["legendIconClickEvent", "legendClickEvent", "legendHoverStartEvent", "legendHoverEndEvent"] }, { kind: "component", type: SiChartLoadingSpinnerComponent, selector: "si-chart-loading-spinner" }] });
3285
+ }
3286
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartProgressComponent, decorators: [{
3287
+ type: Component,
3288
+ args: [{ selector: 'si-chart-progress', imports: [SiCustomLegendComponent, SiChartLoadingSpinnerComponent], template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"] }]
3289
+ }] });
3290
+
3291
+ /**
3292
+ * Copyright (c) Siemens 2016 - 2025
3293
+ * SPDX-License-Identifier: MIT
3294
+ */
3295
+
3296
+ /**
3297
+ * Copyright (c) Siemens 2016 - 2025
3298
+ * SPDX-License-Identifier: MIT
3299
+ */
3300
+ class SiChartProgressBarComponent extends SiChartComponent {
3301
+ series = input();
3302
+ /** Used to display the label in inline or above the progress-bar. */
3303
+ labelPosition = input();
3304
+ maxValue = 100;
3305
+ xAxisConfig = { type: 'value', max: this.maxValue };
3306
+ yAxis = {
3307
+ type: 'category',
3308
+ data: [],
3309
+ axisLabel: {
3310
+ show: true,
3311
+ fontSize: 14
3312
+ }
3313
+ };
3314
+ formatter = new Intl.NumberFormat(undefined, { maximumFractionDigits: 1 });
3315
+ labelPositionOption;
3316
+ labelPositionOptionForValue;
3317
+ labelFormatter(p) {
3318
+ return this.formatter.format(this.maxValue - p.value) + ' %';
3319
+ }
3320
+ themeChanged() {
3321
+ this.applyOptions();
3322
+ }
3323
+ applyOptions() {
3324
+ this.showLegend.set(false);
3325
+ const grey = this.getThemeCustomValue(['progress', 'grey'], '#E6E6E6');
3326
+ const labelColor = this.getThemeCustomValue(['progressBar', 'labelColor'], '#000');
3327
+ const itemWidth = this.getThemeCustomValue(['progressBar', 'itemWidth'], 20);
3328
+ if (this.labelPosition() === 'top') {
3329
+ this.yAxis.axisLabel = false;
3330
+ this.labelPositionOption = {
3331
+ position: [0, -16],
3332
+ formatter: '{b}',
3333
+ fontSize: 14,
3334
+ color: labelColor,
3335
+ show: true
3336
+ };
3337
+ this.labelPositionOptionForValue = {
3338
+ position: ['100%', '-80%'],
3339
+ align: 'right',
3340
+ show: true,
3341
+ formatter: p => this.labelFormatter(p),
3342
+ color: labelColor,
3343
+ fontWeight: 700
3344
+ };
3345
+ }
3346
+ else {
3347
+ this.yAxis.axisLabel.show = true;
3348
+ this.labelPositionOption = {
3349
+ show: false
3350
+ };
3351
+ this.labelPositionOptionForValue = {
3352
+ position: 'right',
3353
+ show: true,
3354
+ formatter: p => this.labelFormatter(p),
3355
+ color: labelColor,
3356
+ fontWeight: 700
3357
+ };
3358
+ }
3359
+ this.actualOptions = {
3360
+ series: [],
3361
+ xAxis: this.xAxisConfig,
3362
+ yAxis: this.yAxis,
3363
+ grid: {},
3364
+ tooltip: {}
3365
+ };
3366
+ const categoryAxisOpts = {
3367
+ axisLine: { show: false },
3368
+ axisTick: { show: false },
3369
+ splitLine: { show: false },
3370
+ axisLabel: { show: this.yAxis.axisLabel },
3371
+ inverse: true
3372
+ };
3373
+ const valueAxisOpts = {
3374
+ axisLabel: { show: false },
3375
+ axisLine: { show: false },
3376
+ axisTick: { show: false },
3377
+ splitLine: { show: false }
3378
+ };
3379
+ echarts.util.merge(this.actualOptions.yAxis, categoryAxisOpts, true);
3380
+ echarts.util.merge(this.actualOptions.xAxis, valueAxisOpts, true);
3381
+ this.actualOptions.grid = this.getThemeCustomValue(['progressBar', 'grid'], {});
3382
+ const series = this.series();
3383
+ if (series) {
3384
+ const optionSeries = this.actualOptions.series;
3385
+ this.actualOptions.yAxis.data = series.map(item => item.name);
3386
+ const dataItem = {
3387
+ type: 'bar',
3388
+ stack: 'chart',
3389
+ z: 3,
3390
+ barWidth: itemWidth,
3391
+ label: this.labelPositionOption,
3392
+ data: series.map(item => item.percent)
3393
+ };
3394
+ const fillerItem = {
3395
+ type: 'bar',
3396
+ stack: 'chart',
3397
+ silent: true,
3398
+ label: this.labelPositionOptionForValue,
3399
+ itemStyle: {
3400
+ color: grey
3401
+ },
3402
+ data: series.map(item => this.maxValue - item.percent)
3403
+ };
3404
+ optionSeries.push(dataItem);
3405
+ optionSeries.push(fillerItem);
3406
+ }
3407
+ this.applyTitles();
3408
+ }
3409
+ applyDataZoom() { }
3410
+ /**
3411
+ * Updates single value of a single progress bar.
3412
+ */
3413
+ changeSingleValue(valueIndex, value) {
3414
+ const optionSeries = this.actualOptions.series;
3415
+ optionSeries[0].data[valueIndex] = value;
3416
+ optionSeries[1].data[valueIndex] = this.maxValue - value;
3417
+ this.updateEChart();
3418
+ }
3419
+ /**
3420
+ * Updates multiple values of a single progress bar.
3421
+ */
3422
+ changeMultiValues(updateValues) {
3423
+ const optionSeries = this.actualOptions.series;
3424
+ updateValues.forEach(update => {
3425
+ const currentDataItem = optionSeries[0].data[update.valueIndex];
3426
+ if (!currentDataItem) {
3427
+ return;
3428
+ }
3429
+ optionSeries[0].data[update.valueIndex] = update.value;
3430
+ optionSeries[1].data[update.valueIndex] = this.maxValue - update.value;
3431
+ });
3432
+ this.updateEChart();
3433
+ }
3434
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartProgressBarComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3435
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiChartProgressBarComponent, isStandalone: true, selector: "si-chart-progress-bar", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: SiCustomLegendComponent, selector: "si-custom-legend", inputs: ["customLegend", "title", "subTitle", "titleColor", "subTitleColor", "textColor"], outputs: ["legendIconClickEvent", "legendClickEvent", "legendHoverStartEvent", "legendHoverEndEvent"] }, { kind: "component", type: SiChartLoadingSpinnerComponent, selector: "si-chart-loading-spinner" }] });
3436
+ }
3437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartProgressBarComponent, decorators: [{
3438
+ type: Component,
3439
+ args: [{ selector: 'si-chart-progress-bar', imports: [SiCustomLegendComponent, SiChartLoadingSpinnerComponent], template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"] }]
3440
+ }] });
3441
+
3442
+ /**
3443
+ * Copyright (c) Siemens 2016 - 2025
3444
+ * SPDX-License-Identifier: MIT
3445
+ */
3446
+
3447
+ /**
3448
+ * Copyright (c) Siemens 2016 - 2025
3449
+ * SPDX-License-Identifier: MIT
3450
+ */
3451
+
3452
+ /**
3453
+ * Copyright (c) Siemens 2016 - 2025
3454
+ * SPDX-License-Identifier: MIT
3455
+ */
3456
+ class SiChartSankeyComponent extends SiChartComponent {
3457
+ series = input();
3458
+ /** @defaultValue false */
3459
+ toolTip = input(false);
3460
+ applyOptions() {
3461
+ const series = this.series();
3462
+ this.actualOptions = {
3463
+ series: series ? Object.assign({ type: 'sankey' }, series) : [],
3464
+ tooltip: { show: this.toolTip() }
3465
+ };
3466
+ this.applyTitles();
3467
+ }
3468
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartSankeyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3469
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiChartSankeyComponent, isStandalone: true, selector: "si-chart-sankey", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, toolTip: { classPropertyName: "toolTip", publicName: "toolTip", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: SiCustomLegendComponent, selector: "si-custom-legend", inputs: ["customLegend", "title", "subTitle", "titleColor", "subTitleColor", "textColor"], outputs: ["legendIconClickEvent", "legendClickEvent", "legendHoverStartEvent", "legendHoverEndEvent"] }, { kind: "component", type: SiChartLoadingSpinnerComponent, selector: "si-chart-loading-spinner" }] });
3470
+ }
3471
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartSankeyComponent, decorators: [{
3472
+ type: Component,
3473
+ args: [{ selector: 'si-chart-sankey', imports: [SiCustomLegendComponent, SiChartLoadingSpinnerComponent], template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"] }]
3474
+ }] });
3475
+
3476
+ /**
3477
+ * Copyright (c) Siemens 2016 - 2025
3478
+ * SPDX-License-Identifier: MIT
3479
+ */
3480
+
3481
+ /**
3482
+ * Copyright (c) Siemens 2016 - 2025
3483
+ * SPDX-License-Identifier: MIT
3484
+ */
3485
+ class SiChartSunburstComponent extends SiChartComponent {
3486
+ series = input();
3487
+ /** @defaultValue false */
3488
+ toolTip = input(false);
3489
+ applyOptions() {
3490
+ const series = this.series();
3491
+ this.actualOptions = {
3492
+ series: series ? Object.assign({ type: 'sunburst' }, series) : [],
3493
+ tooltip: { show: this.toolTip() }
3494
+ };
3495
+ this.applyTitles();
3496
+ }
3497
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartSunburstComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3498
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiChartSunburstComponent, isStandalone: true, selector: "si-chart-sunburst", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, toolTip: { classPropertyName: "toolTip", publicName: "toolTip", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: SiCustomLegendComponent, selector: "si-custom-legend", inputs: ["customLegend", "title", "subTitle", "titleColor", "subTitleColor", "textColor"], outputs: ["legendIconClickEvent", "legendClickEvent", "legendHoverStartEvent", "legendHoverEndEvent"] }, { kind: "component", type: SiChartLoadingSpinnerComponent, selector: "si-chart-loading-spinner" }] });
3499
+ }
3500
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartSunburstComponent, decorators: [{
3501
+ type: Component,
3502
+ args: [{ selector: 'si-chart-sunburst', imports: [SiCustomLegendComponent, SiChartLoadingSpinnerComponent], template: "@if (showCustomLegend() && (title() || subTitle())) {\n <div\n class=\"si-title-2 chart-title chart-title-width\"\n [style.background-color]=\"backgroundColor()\"\n >\n <div class=\"chart-title-text\" [style.color]=\"titleColor()\">{{ title() }}</div>\n @if (subTitle()) {\n <div class=\"si-body-2\" [style.color]=\"subTitleColor()\">{{ subTitle() }}</div>\n }\n </div>\n}\n\n<div\n #chartContainerWrapper\n class=\"chart-container-wrapper\"\n [class.chart-scroll]=\"containerHeight()\"\n [attr.tabindex]=\"containerHeight() ? '0' : null\"\n>\n <div class=\"chart-container\" [style.height.px]=\"containerHeight()\">\n @if (showCustomLegend()) {\n @for (cl of customLegend; track $index) {\n <si-custom-legend\n #siCustomLegend\n class=\"custom-legend\"\n [style.top.px]=\"cl.top\"\n [title]=\"title()\"\n [subTitle]=\"subTitle()\"\n [customLegend]=\"cl\"\n [style.background-color]=\"backgroundColor()\"\n [titleColor]=\"titleColor()\"\n [subTitleColor]=\"subTitleColor()\"\n [textColor]=\"textColor()\"\n (legendIconClickEvent)=\"handleLegendClick($event)\"\n (legendClickEvent)=\"handleLegendClick($event)\"\n (legendHoverStartEvent)=\"handleLegendHover($event, true)\"\n (legendHoverEndEvent)=\"handleLegendHover($event, false)\"\n />\n }\n }\n <div #chart class=\"echart-container\" [style.height.px]=\"containerHeight()\"></div>\n </div>\n</div>\n@if (externalZoomSlider()) {\n <div\n #externalZoomSlider\n class=\"external-zoom-container\"\n [class.has-time-range-bar]=\"showTimeRangeBar()\"\n [style.--time-bar-height.px]=\"timeBarHeight()\"\n ></div>\n}\n\n@if (showTimeRangeBar() && zoomSlider()) {\n <div\n class=\"time-range-bar\"\n [style.bottom.px]=\"timeBarBottom()\"\n [style.padding-left.px]=\"timeBarLeft()\"\n [style.padding-right.px]=\"timeBarRight()\"\n >\n <ng-content select=\"[slot=timeRangeBar]\" />\n </div>\n}\n\n@if (inProgress()) {\n <div class=\"progress-container\">\n <si-chart-loading-spinner />\n </div>\n}\n", styles: [":host{block-size:100%;position:relative;display:flex!important;flex-direction:column;inline-size:100%}.chart-container-wrapper{display:flex;flex:1 0 0;inline-size:inherit;overflow:hidden}.chart-scroll{overflow-y:auto}.chart-container{position:relative;display:flex;flex:1 0 0;overflow:hidden}.echart-container{flex:1 0 0;inline-size:100%;min-block-size:var(--si-chart-min-height, 200px);overflow:hidden}.custom-legend{position:absolute;z-index:2;inline-size:100%}.chart-title{padding-block:12px 8px;padding-inline-start:24px}.external-zoom-container{display:flex;flex:1 0 0;inline-size:inherit;max-block-size:112px}.external-zoom-container.has-time-range-bar{max-block-size:calc(112px + var(--time-bar-height))}.tooltip-inner{max-inline-size:375px;min-inline-size:375px;color:#162938;font-size:18px;background-color:#162938}.time-range-bar{position:absolute;inset-inline:0;z-index:2}.progress-container{position:absolute;inset:0;pointer-events:none;z-index:100;display:flex;justify-content:center;align-items:center}\n"] }]
3503
+ }] });
3504
+
3505
+ /**
3506
+ * Copyright (c) Siemens 2016 - 2025
3507
+ * SPDX-License-Identifier: MIT
3508
+ */
3509
+
3510
+ /**
3511
+ * Copyright (c) Siemens 2016 - 2025
3512
+ * SPDX-License-Identifier: MIT
3513
+ */
3514
+
3515
+ /**
3516
+ * Copyright (c) Siemens 2016 - 2025
3517
+ * SPDX-License-Identifier: MIT
3518
+ */
3519
+
3520
+ /**
3521
+ * Copyright (c) Siemens 2016 - 2025
3522
+ * SPDX-License-Identifier: MIT
3523
+ */
3524
+ class SiChartsNgModule {
3525
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartsNgModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3526
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: SiChartsNgModule, imports: [CommonModule,
3527
+ SiChartCartesianComponent,
3528
+ SiChartCircleComponent,
3529
+ SiChartComponent,
3530
+ SiChartGaugeComponent,
3531
+ SiChartLoadingSpinnerComponent,
3532
+ SiChartProgressBarComponent,
3533
+ SiChartProgressComponent,
3534
+ SiChartSankeyComponent,
3535
+ SiChartSunburstComponent,
3536
+ SiCustomLegendComponent], exports: [SiChartCartesianComponent,
3537
+ SiChartCircleComponent,
3538
+ SiChartComponent,
3539
+ SiChartGaugeComponent,
3540
+ SiChartProgressBarComponent,
3541
+ SiChartProgressComponent,
3542
+ SiChartSankeyComponent,
3543
+ SiChartSunburstComponent,
3544
+ SiCustomLegendComponent] });
3545
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartsNgModule, imports: [CommonModule] });
3546
+ }
3547
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiChartsNgModule, decorators: [{
3548
+ type: NgModule,
3549
+ args: [{
3550
+ imports: [
3551
+ CommonModule,
3552
+ SiChartCartesianComponent,
3553
+ SiChartCircleComponent,
3554
+ SiChartComponent,
3555
+ SiChartGaugeComponent,
3556
+ SiChartLoadingSpinnerComponent,
3557
+ SiChartProgressBarComponent,
3558
+ SiChartProgressComponent,
3559
+ SiChartSankeyComponent,
3560
+ SiChartSunburstComponent,
3561
+ SiCustomLegendComponent
3562
+ ],
3563
+ exports: [
3564
+ SiChartCartesianComponent,
3565
+ SiChartCircleComponent,
3566
+ SiChartComponent,
3567
+ SiChartGaugeComponent,
3568
+ SiChartProgressBarComponent,
3569
+ SiChartProgressComponent,
3570
+ SiChartSankeyComponent,
3571
+ SiChartSunburstComponent,
3572
+ SiCustomLegendComponent
3573
+ ]
3574
+ }]
3575
+ }] });
3576
+
3577
+ /**
3578
+ * Copyright (c) Siemens 2016 - 2025
3579
+ * SPDX-License-Identifier: MIT
3580
+ */
3581
+ // Public API Surface
3582
+
3583
+ /**
3584
+ * Generated bundle index. Do not edit.
3585
+ */
3586
+
3587
+ export { SiChartCartesianComponent, SiChartCircleComponent, SiChartComponent, SiChartGaugeComponent, SiChartProgressBarComponent, SiChartProgressComponent, SiChartSankeyComponent, SiChartSunburstComponent, SiChartsNgModule, SiCustomLegendComponent, SiChartsNgModule as SimplChartsNgModule, themeElement, themeSupport };
3588
+ //# sourceMappingURL=spike-rabbit-charts-ng.mjs.map