cats4u-charts 0.0.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.
Files changed (54) hide show
  1. package/.editorconfig +17 -0
  2. package/.vscode/extensions.json +4 -0
  3. package/.vscode/launch.json +20 -0
  4. package/.vscode/tasks.json +42 -0
  5. package/README.md +59 -0
  6. package/angular.json +118 -0
  7. package/dist/charts-lib/README.md +63 -0
  8. package/dist/charts-lib/fesm2022/charts-lib.mjs +3418 -0
  9. package/dist/charts-lib/fesm2022/charts-lib.mjs.map +1 -0
  10. package/dist/charts-lib/index.d.ts +110 -0
  11. package/package.json +58 -0
  12. package/projects/charts-lib/README.md +63 -0
  13. package/projects/charts-lib/ng-package.json +8 -0
  14. package/projects/charts-lib/package.json +12 -0
  15. package/projects/charts-lib/src/lib/charts-lib.html +1 -0
  16. package/projects/charts-lib/src/lib/charts-lib.spec.ts +23 -0
  17. package/projects/charts-lib/src/lib/charts-lib.ts +121 -0
  18. package/projects/charts-lib/src/lib/component/area-chart/area-chart.html +1 -0
  19. package/projects/charts-lib/src/lib/component/area-chart/area-chart.scss +0 -0
  20. package/projects/charts-lib/src/lib/component/area-chart/area-chart.spec.ts +23 -0
  21. package/projects/charts-lib/src/lib/component/area-chart/area-chart.ts +266 -0
  22. package/projects/charts-lib/src/lib/component/bar-chart/bar-chart.html +1 -0
  23. package/projects/charts-lib/src/lib/component/bar-chart/bar-chart.scss +0 -0
  24. package/projects/charts-lib/src/lib/component/bar-chart/bar-chart.spec.ts +23 -0
  25. package/projects/charts-lib/src/lib/component/bar-chart/bar-chart.ts +301 -0
  26. package/projects/charts-lib/src/lib/component/line-chart/line-chart.html +1 -0
  27. package/projects/charts-lib/src/lib/component/line-chart/line-chart.scss +0 -0
  28. package/projects/charts-lib/src/lib/component/line-chart/line-chart.spec.ts +23 -0
  29. package/projects/charts-lib/src/lib/component/line-chart/line-chart.ts +266 -0
  30. package/projects/charts-lib/src/lib/modal/charts-lib.modal.ts +79 -0
  31. package/projects/charts-lib/src/lib/services/chart.service.ts +296 -0
  32. package/projects/charts-lib/src/lib/themes/chalk.ts +357 -0
  33. package/projects/charts-lib/src/lib/themes/dark.ts +380 -0
  34. package/projects/charts-lib/src/lib/themes/default.ts +377 -0
  35. package/projects/charts-lib/src/lib/themes/essos.ts +357 -0
  36. package/projects/charts-lib/src/lib/themes/roma.ts +399 -0
  37. package/projects/charts-lib/src/lib/themes/vintage.ts +378 -0
  38. package/projects/charts-lib/src/public-api.ts +2 -0
  39. package/projects/charts-lib/tsconfig.lib.json +14 -0
  40. package/projects/charts-lib/tsconfig.lib.prod.json +11 -0
  41. package/projects/charts-lib/tsconfig.spec.json +15 -0
  42. package/projects/demo-app/public/favicon.ico +0 -0
  43. package/projects/demo-app/src/app/app.config.ts +16 -0
  44. package/projects/demo-app/src/app/app.html +43 -0
  45. package/projects/demo-app/src/app/app.routes.ts +3 -0
  46. package/projects/demo-app/src/app/app.scss +47 -0
  47. package/projects/demo-app/src/app/app.spec.ts +25 -0
  48. package/projects/demo-app/src/app/app.ts +98 -0
  49. package/projects/demo-app/src/index.html +13 -0
  50. package/projects/demo-app/src/main.ts +6 -0
  51. package/projects/demo-app/src/styles.scss +4 -0
  52. package/projects/demo-app/tsconfig.app.json +15 -0
  53. package/projects/demo-app/tsconfig.spec.json +15 -0
  54. package/tsconfig.json +43 -0
@@ -0,0 +1,3418 @@
1
+ import * as i0 from '@angular/core';
2
+ import { signal, computed, Injectable, inject, effect, ViewChild, Input, ChangeDetectionStrategy, Component, EventEmitter, ViewContainerRef, Output } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import * as echarts from 'echarts';
5
+ import { Subject } from 'rxjs';
6
+
7
+ class ClickEvent {
8
+ seriesName = '';
9
+ value = undefined;
10
+ name = '';
11
+ dataIndex = -1;
12
+ seriesIndex = -1;
13
+ }
14
+ class ChartsLibType {
15
+ chartType = 'bar';
16
+ columns = [];
17
+ data = [];
18
+ themeName = 'default';
19
+ colorsScheme;
20
+ chartOptionsConfig;
21
+ }
22
+ class OptionsConfig {
23
+ title = {
24
+ show: true,
25
+ text: '',
26
+ left: 'center',
27
+ textStyle: { fontSize: 16 },
28
+ };
29
+ legend = { show: true };
30
+ tooltip = { trigger: 'axis', axisPointer: { type: 'shadow' } };
31
+ xAxis = {
32
+ type: 'category',
33
+ data: [], // Populated dynamically
34
+ axisLabel: { rotate: 45, fontSize: 10 },
35
+ axisTick: { show: false },
36
+ };
37
+ yAxis = {
38
+ type: 'value',
39
+ axisLabel: { fontSize: 12 },
40
+ };
41
+ dataZoom = [
42
+ {
43
+ type: 'slider',
44
+ start: 0,
45
+ end: 100,
46
+ height: 25,
47
+ bottom: 20,
48
+ textStyle: { fontSize: 12 },
49
+ },
50
+ {
51
+ type: 'inside', // Mouse wheel/pinch zoom
52
+ start: 0,
53
+ end: 10,
54
+ },
55
+ ];
56
+ series = [];
57
+ grid = {
58
+ left: '5%',
59
+ right: '5%',
60
+ containLabel: true,
61
+ };
62
+ }
63
+ class ContextMenuListItem {
64
+ label = '';
65
+ options = [];
66
+ action;
67
+ disabled = false;
68
+ }
69
+
70
+ class ChartService {
71
+ themeSignal = signal('default', ...(ngDevMode ? [{ debugName: "themeSignal" }] : []));
72
+ theme = this.themeSignal.asReadonly();
73
+ newsubject = new Subject();
74
+ dataSignal = signal([], ...(ngDevMode ? [{ debugName: "dataSignal" }] : []));
75
+ data = this.dataSignal.asReadonly();
76
+ columnsSignal = signal([], ...(ngDevMode ? [{ debugName: "columnsSignal" }] : []));
77
+ columns = this.columnsSignal.asReadonly();
78
+ chartOptionsConfigSignal = signal({}, ...(ngDevMode ? [{ debugName: "chartOptionsConfigSignal" }] : []));
79
+ chartOptionsConfig = this.chartOptionsConfigSignal.asReadonly();
80
+ eventSignal = signal(new ClickEvent(), ...(ngDevMode ? [{ debugName: "eventSignal" }] : []));
81
+ clickEvent = this.eventSignal.asReadonly();
82
+ contextMenuEventSignal = signal(new ClickEvent(), ...(ngDevMode ? [{ debugName: "contextMenuEventSignal" }] : []));
83
+ contextMenuEvent = this.contextMenuEventSignal.asReadonly();
84
+ contextMenuListSignal = signal([], ...(ngDevMode ? [{ debugName: "contextMenuListSignal" }] : []));
85
+ contextMenuList = this.contextMenuListSignal.asReadonly();
86
+ drillByConfigSignal = signal(new ClickEvent(), ...(ngDevMode ? [{ debugName: "drillByConfigSignal" }] : []));
87
+ drillByConfig = this.drillByConfigSignal.asReadonly();
88
+ loadingSignal = signal(false, ...(ngDevMode ? [{ debugName: "loadingSignal" }] : []));
89
+ loading = this.loadingSignal.asReadonly();
90
+ contextMenu = null;
91
+ isDarkTheme = computed(() => this.theme() === 'dark', ...(ngDevMode ? [{ debugName: "isDarkTheme" }] : []));
92
+ constructor() { }
93
+ setTheme(themeName) {
94
+ this.themeSignal.set(themeName);
95
+ }
96
+ setData(data) {
97
+ this.dataSignal.set(data);
98
+ }
99
+ setColumns(columns) {
100
+ this.columnsSignal.set(columns);
101
+ }
102
+ setChartOptionsConfig(config) {
103
+ this.chartOptionsConfigSignal.set(config);
104
+ }
105
+ setContextMenuList(contextMenu) {
106
+ this.contextMenuListSignal.set(contextMenu);
107
+ }
108
+ setLoading(isLoading) {
109
+ this.loadingSignal.set(isLoading);
110
+ }
111
+ getCurrentTheme() {
112
+ return this.themeSignal();
113
+ }
114
+ getCurrentData() {
115
+ return this.dataSignal();
116
+ }
117
+ getCurrentColumns() {
118
+ return this.columnsSignal();
119
+ }
120
+ handleClick(event) {
121
+ this.eventSignal.set({
122
+ seriesName: event?.seriesName,
123
+ value: event?.value,
124
+ name: event?.name,
125
+ dataIndex: event?.dataIndex,
126
+ seriesIndex: event?.seriesIndex,
127
+ });
128
+ }
129
+ getClickEvent() {
130
+ return this.eventSignal();
131
+ }
132
+ showContextMenu(x, y, params, chartContainer) {
133
+ // Remove existing menu
134
+ this.hideContextMenu();
135
+ // Create menu element
136
+ this.contextMenu = document.createElement('div');
137
+ this.contextMenu.style.position = 'absolute';
138
+ this.contextMenu.style.left = `${x}px`;
139
+ this.contextMenu.style.top = `${y}px`;
140
+ this.contextMenu.style.background = 'white';
141
+ this.contextMenu.style.border = '1px solid #ccc';
142
+ this.contextMenu.style.borderRadius = '6px';
143
+ this.contextMenu.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
144
+ this.contextMenu.style.zIndex = '10000000';
145
+ this.contextMenu.style.padding = '5px 0';
146
+ this.contextMenu.style.minWidth = '120px';
147
+ // Define menu options (customize as needed)
148
+ const options = [
149
+ {
150
+ label: 'Drill By',
151
+ options: this.columns().map((column) => ({
152
+ label: column,
153
+ action: () => {
154
+ this.drillByHandler(column);
155
+ },
156
+ })),
157
+ action: () => { },
158
+ },
159
+ {
160
+ label: 'Drill Down',
161
+ action: () => this.drillDownHandler(params),
162
+ disabled: !params,
163
+ },
164
+ ...this.contextMenuList(),
165
+ ];
166
+ let activeSubMenu = null;
167
+ // Add options to menu
168
+ options.forEach((option, index) => {
169
+ const item = document.createElement('div');
170
+ item.innerHTML = option.options
171
+ ? `<div style="display: flex; justify-content: space-between;align-items:center;"><label>${option.label}</label><label style="font-weight:600; margin-left: 1rem;">></label></div>`
172
+ : `<label>${option.label}</label>`;
173
+ item.style.padding = '8px 12px';
174
+ item.style.cursor = 'pointer';
175
+ if (option.disabled) {
176
+ item.style.opacity = '0.5';
177
+ item.style.cursor = 'not-allowed';
178
+ }
179
+ if (index < options.length - 1) {
180
+ item.style.borderBottom = '1px solid #e1e1e1';
181
+ }
182
+ item.style.fontSize = '14px';
183
+ item.style.position = 'relative';
184
+ item.onmouseover = (event) => {
185
+ if (!option.disabled) {
186
+ item.style.background = '#cee2ff';
187
+ if (activeSubMenu) {
188
+ activeSubMenu.remove();
189
+ activeSubMenu = null;
190
+ }
191
+ if (option.options) {
192
+ activeSubMenu = document.createElement('div');
193
+ activeSubMenu.style.position = 'absolute';
194
+ activeSubMenu.style.left = `${item.offsetWidth + 4}px`; // Position to the right of the item
195
+ activeSubMenu.style.top = '0px'; // Align with the top of the item
196
+ activeSubMenu.style.background = 'white';
197
+ activeSubMenu.style.border = '1px solid #ccc';
198
+ activeSubMenu.style.borderRadius = '6px';
199
+ activeSubMenu.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
200
+ activeSubMenu.style.zIndex = '10000001'; // Higher than main menu
201
+ activeSubMenu.style.padding = '5px 0';
202
+ activeSubMenu.style.minWidth = '120px';
203
+ // Add submenu items
204
+ option.options.forEach((subOption, idx) => {
205
+ const subItem = document.createElement('div');
206
+ subItem.textContent = subOption.label;
207
+ subItem.style.padding = '8px 12px';
208
+ subItem.style.cursor = 'pointer';
209
+ if (option.options && idx < option.options.length - 1) {
210
+ subItem.style.borderBottom = '1px solid #e1e1e1';
211
+ }
212
+ subItem.style.fontSize = '14px';
213
+ subItem.onmouseover = () => {
214
+ subItem.style.background = '#cee2ff';
215
+ };
216
+ subItem.onmouseout = () => (subItem.style.background = 'white');
217
+ subItem.onclick = () => {
218
+ if (subOption.action) {
219
+ subOption.action(params
220
+ ? {
221
+ seriesName: params?.seriesName,
222
+ value: params?.value,
223
+ name: params?.name,
224
+ dataIndex: params?.dataIndex,
225
+ seriesIndex: params?.seriesIndex,
226
+ }
227
+ : undefined);
228
+ }
229
+ this.hideContextMenu();
230
+ this.resetContextEvent();
231
+ };
232
+ activeSubMenu.appendChild(subItem);
233
+ });
234
+ if (this.contextMenu) {
235
+ this.contextMenu.appendChild(activeSubMenu);
236
+ }
237
+ }
238
+ }
239
+ };
240
+ item.onmouseout = (event) => {
241
+ if (!option.disabled) {
242
+ item.style.background = 'white';
243
+ }
244
+ };
245
+ item.onclick = () => {
246
+ if (!option.options && !option.disabled) {
247
+ if (option.action) {
248
+ option.action();
249
+ }
250
+ this.hideContextMenu();
251
+ this.resetContextEvent();
252
+ }
253
+ };
254
+ if (this.contextMenu) {
255
+ this.contextMenu.appendChild(item);
256
+ }
257
+ });
258
+ // Append to chart container
259
+ chartContainer.nativeElement.appendChild(this.contextMenu);
260
+ }
261
+ openContextMenu(params, chartContainer, mouseEvent) {
262
+ if (params) {
263
+ this.contextMenuEventSignal.set({
264
+ seriesName: params?.seriesName,
265
+ value: params?.value,
266
+ name: params?.name,
267
+ dataIndex: params?.dataIndex,
268
+ seriesIndex: params?.seriesIndex,
269
+ });
270
+ }
271
+ else {
272
+ this.resetContextEvent();
273
+ }
274
+ const event = mouseEvent || params?.event?.event;
275
+ event?.preventDefault();
276
+ if (!event)
277
+ return;
278
+ const rect = chartContainer.nativeElement.getBoundingClientRect();
279
+ const x = event.clientX - rect.left;
280
+ const y = event.clientY - rect.top;
281
+ // Create or update the menu
282
+ this.showContextMenu(x, y, params, chartContainer);
283
+ }
284
+ hideContextMenu() {
285
+ if (this.contextMenu) {
286
+ this.contextMenu.remove();
287
+ this.contextMenu = null;
288
+ }
289
+ }
290
+ resetContextEvent() {
291
+ this.contextMenuEventSignal.set(new ClickEvent());
292
+ }
293
+ drillDownHandler(params) {
294
+ if (params) {
295
+ this.eventSignal.set({
296
+ seriesName: params?.seriesName,
297
+ value: params?.value,
298
+ name: params?.name,
299
+ dataIndex: params?.dataIndex,
300
+ seriesIndex: params?.seriesIndex,
301
+ });
302
+ }
303
+ }
304
+ drillByHandler(columnName = '') {
305
+ const params = {
306
+ seriesName: columnName,
307
+ value: undefined,
308
+ name: '',
309
+ dataIndex: -1,
310
+ seriesIndex: -1,
311
+ };
312
+ this.drillByConfigSignal.set(params);
313
+ }
314
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ChartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
315
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ChartService, providedIn: 'root' });
316
+ }
317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ChartService, decorators: [{
318
+ type: Injectable,
319
+ args: [{
320
+ providedIn: 'root',
321
+ }]
322
+ }], ctorParameters: () => [] });
323
+
324
+ const defaultTheme = {
325
+ color: [
326
+ '#5470c6',
327
+ '#91cc75',
328
+ '#fac858',
329
+ '#ee6666',
330
+ '#73c0de',
331
+ '#3ba272',
332
+ '#fc8452',
333
+ '#9a60b4',
334
+ '#ea7ccc',
335
+ ],
336
+ backgroundColor: 'rgba(0, 0, 0, 0)',
337
+ textStyle: {},
338
+ title: {
339
+ textStyle: {
340
+ color: '#464646',
341
+ },
342
+ subtextStyle: {
343
+ color: '#6E7079',
344
+ },
345
+ },
346
+ line: {
347
+ itemStyle: {
348
+ borderWidth: 1,
349
+ },
350
+ lineStyle: {
351
+ width: 2,
352
+ },
353
+ symbolSize: 4,
354
+ symbol: 'emptyCircle',
355
+ smooth: false,
356
+ },
357
+ radar: {
358
+ itemStyle: {
359
+ borderWidth: 1,
360
+ },
361
+ lineStyle: {
362
+ width: 2,
363
+ },
364
+ symbolSize: 4,
365
+ symbol: 'emptyCircle',
366
+ smooth: false,
367
+ },
368
+ bar: {
369
+ itemStyle: {
370
+ barBorderWidth: 0,
371
+ barBorderColor: '#ccc',
372
+ },
373
+ },
374
+ pie: {
375
+ itemStyle: {
376
+ borderWidth: 0,
377
+ borderColor: '#ccc',
378
+ },
379
+ },
380
+ scatter: {
381
+ itemStyle: {
382
+ borderWidth: 0,
383
+ borderColor: '#ccc',
384
+ },
385
+ },
386
+ boxplot: {
387
+ itemStyle: {
388
+ borderWidth: 0,
389
+ borderColor: '#ccc',
390
+ },
391
+ },
392
+ parallel: {
393
+ itemStyle: {
394
+ borderWidth: 0,
395
+ borderColor: '#ccc',
396
+ },
397
+ },
398
+ sankey: {
399
+ itemStyle: {
400
+ borderWidth: 0,
401
+ borderColor: '#ccc',
402
+ },
403
+ },
404
+ funnel: {
405
+ itemStyle: {
406
+ borderWidth: 0,
407
+ borderColor: '#ccc',
408
+ },
409
+ },
410
+ gauge: {
411
+ itemStyle: {
412
+ borderWidth: 0,
413
+ borderColor: '#ccc',
414
+ },
415
+ },
416
+ candlestick: {
417
+ itemStyle: {
418
+ color: '#eb5454',
419
+ color0: '#47b262',
420
+ borderColor: '#eb5454',
421
+ borderColor0: '#47b262',
422
+ borderWidth: 1,
423
+ },
424
+ },
425
+ graph: {
426
+ itemStyle: {
427
+ borderWidth: 0,
428
+ borderColor: '#ccc',
429
+ },
430
+ lineStyle: {
431
+ width: 1,
432
+ color: '#aaa',
433
+ },
434
+ symbolSize: 4,
435
+ symbol: 'emptyCircle',
436
+ smooth: false,
437
+ color: [
438
+ '#5470c6',
439
+ '#91cc75',
440
+ '#fac858',
441
+ '#ee6666',
442
+ '#73c0de',
443
+ '#3ba272',
444
+ '#fc8452',
445
+ '#9a60b4',
446
+ '#ea7ccc',
447
+ ],
448
+ label: {
449
+ color: '#eee',
450
+ },
451
+ },
452
+ map: {
453
+ itemStyle: {
454
+ areaColor: '#eee',
455
+ borderColor: '#444',
456
+ borderWidth: 0.5,
457
+ },
458
+ label: {
459
+ color: '#000',
460
+ },
461
+ emphasis: {
462
+ itemStyle: {
463
+ areaColor: 'rgba(255,215,0,0.8)',
464
+ borderColor: '#444',
465
+ borderWidth: 1,
466
+ },
467
+ label: {
468
+ color: 'rgb(100,0,0)',
469
+ },
470
+ },
471
+ },
472
+ geo: {
473
+ itemStyle: {
474
+ areaColor: '#eee',
475
+ borderColor: '#444',
476
+ borderWidth: 0.5,
477
+ },
478
+ label: {
479
+ color: '#000',
480
+ },
481
+ emphasis: {
482
+ itemStyle: {
483
+ areaColor: 'rgba(255,215,0,0.8)',
484
+ borderColor: '#444',
485
+ borderWidth: 1,
486
+ },
487
+ label: {
488
+ color: 'rgb(100,0,0)',
489
+ },
490
+ },
491
+ },
492
+ categoryAxis: {
493
+ axisLine: {
494
+ show: true,
495
+ lineStyle: {
496
+ color: '#6E7079',
497
+ },
498
+ },
499
+ axisTick: {
500
+ show: true,
501
+ lineStyle: {
502
+ color: '#6E7079',
503
+ },
504
+ },
505
+ axisLabel: {
506
+ show: true,
507
+ color: '#6E7079',
508
+ },
509
+ splitLine: {
510
+ show: false,
511
+ lineStyle: {
512
+ color: ['#E0E6F1'],
513
+ },
514
+ },
515
+ splitArea: {
516
+ show: false,
517
+ areaStyle: {
518
+ color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)'],
519
+ },
520
+ },
521
+ },
522
+ valueAxis: {
523
+ axisLine: {
524
+ show: false,
525
+ lineStyle: {
526
+ color: '#6E7079',
527
+ },
528
+ },
529
+ axisTick: {
530
+ show: false,
531
+ lineStyle: {
532
+ color: '#6E7079',
533
+ },
534
+ },
535
+ axisLabel: {
536
+ show: true,
537
+ color: '#6E7079',
538
+ },
539
+ splitLine: {
540
+ show: true,
541
+ lineStyle: {
542
+ color: ['#E0E6F1'],
543
+ },
544
+ },
545
+ splitArea: {
546
+ show: false,
547
+ areaStyle: {
548
+ color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)'],
549
+ },
550
+ },
551
+ },
552
+ logAxis: {
553
+ axisLine: {
554
+ show: false,
555
+ lineStyle: {
556
+ color: '#6E7079',
557
+ },
558
+ },
559
+ axisTick: {
560
+ show: false,
561
+ lineStyle: {
562
+ color: '#6E7079',
563
+ },
564
+ },
565
+ axisLabel: {
566
+ show: true,
567
+ color: '#6E7079',
568
+ },
569
+ splitLine: {
570
+ show: true,
571
+ lineStyle: {
572
+ color: ['#E0E6F1'],
573
+ },
574
+ },
575
+ splitArea: {
576
+ show: false,
577
+ areaStyle: {
578
+ color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)'],
579
+ },
580
+ },
581
+ },
582
+ timeAxis: {
583
+ axisLine: {
584
+ show: true,
585
+ lineStyle: {
586
+ color: '#6E7079',
587
+ },
588
+ },
589
+ axisTick: {
590
+ show: true,
591
+ lineStyle: {
592
+ color: '#6E7079',
593
+ },
594
+ },
595
+ axisLabel: {
596
+ show: true,
597
+ color: '#6E7079',
598
+ },
599
+ splitLine: {
600
+ show: false,
601
+ lineStyle: {
602
+ color: ['#E0E6F1'],
603
+ },
604
+ },
605
+ splitArea: {
606
+ show: false,
607
+ areaStyle: {
608
+ color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)'],
609
+ },
610
+ },
611
+ },
612
+ toolbox: {
613
+ iconStyle: {
614
+ borderColor: '#999',
615
+ },
616
+ emphasis: {
617
+ iconStyle: {
618
+ borderColor: '#666',
619
+ },
620
+ },
621
+ },
622
+ legend: {
623
+ textStyle: {
624
+ color: '#333',
625
+ },
626
+ left: 'center',
627
+ right: 'auto',
628
+ top: 0,
629
+ bottom: 10,
630
+ },
631
+ tooltip: {
632
+ axisPointer: {
633
+ lineStyle: {
634
+ color: '#ccc',
635
+ width: 1,
636
+ },
637
+ crossStyle: {
638
+ color: '#ccc',
639
+ width: 1,
640
+ },
641
+ },
642
+ },
643
+ timeline: {
644
+ lineStyle: {
645
+ color: '#DAE1F5',
646
+ width: 2,
647
+ },
648
+ itemStyle: {
649
+ color: '#A4B1D7',
650
+ borderWidth: 1,
651
+ },
652
+ controlStyle: {
653
+ color: '#A4B1D7',
654
+ borderColor: '#A4B1D7',
655
+ borderWidth: 1,
656
+ },
657
+ checkpointStyle: {
658
+ color: '#316bf3',
659
+ borderColor: '#fff',
660
+ },
661
+ label: {
662
+ color: '#A4B1D7',
663
+ },
664
+ emphasis: {
665
+ itemStyle: {
666
+ color: '#FFF',
667
+ },
668
+ controlStyle: {
669
+ color: '#A4B1D7',
670
+ borderColor: '#A4B1D7',
671
+ borderWidth: 1,
672
+ },
673
+ label: {
674
+ color: '#A4B1D7',
675
+ },
676
+ },
677
+ },
678
+ visualMap: {
679
+ color: ['#bf444c', '#d88273', '#f6efa6'],
680
+ },
681
+ markPoint: {
682
+ label: {
683
+ color: '#eee',
684
+ },
685
+ emphasis: {
686
+ label: {
687
+ color: '#eee',
688
+ },
689
+ },
690
+ },
691
+ grid: {
692
+ left: '10%',
693
+ right: '10%',
694
+ top: 60,
695
+ bottom: 70,
696
+ },
697
+ };
698
+ echarts.registerTheme('vintage', defaultTheme.default ?? defaultTheme);
699
+
700
+ const vintageTheme = {
701
+ color: [
702
+ '#d87c7c',
703
+ '#919e8b',
704
+ '#d7ab82',
705
+ '#6e7074',
706
+ '#61a0a8',
707
+ '#efa18d',
708
+ '#787464',
709
+ '#cc7e63',
710
+ '#724e58',
711
+ '#4b565b',
712
+ ],
713
+ backgroundColor: 'rgba(254,248,239,1)',
714
+ textStyle: {},
715
+ title: {
716
+ textStyle: {
717
+ color: '#333333',
718
+ },
719
+ subtextStyle: {
720
+ color: '#aaa',
721
+ },
722
+ },
723
+ line: {
724
+ itemStyle: {
725
+ borderWidth: 1,
726
+ },
727
+ lineStyle: {
728
+ width: 2,
729
+ },
730
+ symbolSize: 4,
731
+ symbol: 'emptyCircle',
732
+ smooth: false,
733
+ },
734
+ radar: {
735
+ itemStyle: {
736
+ borderWidth: 1,
737
+ },
738
+ lineStyle: {
739
+ width: 2,
740
+ },
741
+ symbolSize: 4,
742
+ symbol: 'emptyCircle',
743
+ smooth: false,
744
+ },
745
+ bar: {
746
+ itemStyle: {
747
+ barBorderWidth: 0,
748
+ barBorderColor: '#ccc',
749
+ },
750
+ },
751
+ pie: {
752
+ itemStyle: {
753
+ borderWidth: 0,
754
+ borderColor: '#ccc',
755
+ },
756
+ },
757
+ scatter: {
758
+ itemStyle: {
759
+ borderWidth: 0,
760
+ borderColor: '#ccc',
761
+ },
762
+ },
763
+ boxplot: {
764
+ itemStyle: {
765
+ borderWidth: 0,
766
+ borderColor: '#ccc',
767
+ },
768
+ },
769
+ parallel: {
770
+ itemStyle: {
771
+ borderWidth: 0,
772
+ borderColor: '#ccc',
773
+ },
774
+ },
775
+ sankey: {
776
+ itemStyle: {
777
+ borderWidth: 0,
778
+ borderColor: '#ccc',
779
+ },
780
+ },
781
+ funnel: {
782
+ itemStyle: {
783
+ borderWidth: 0,
784
+ borderColor: '#ccc',
785
+ },
786
+ },
787
+ gauge: {
788
+ itemStyle: {
789
+ borderWidth: 0,
790
+ borderColor: '#ccc',
791
+ },
792
+ },
793
+ candlestick: {
794
+ itemStyle: {
795
+ color: '#c23531',
796
+ color0: '#314656',
797
+ borderColor: '#c23531',
798
+ borderColor0: '#314656',
799
+ borderWidth: 1,
800
+ },
801
+ },
802
+ graph: {
803
+ itemStyle: {
804
+ borderWidth: 0,
805
+ borderColor: '#ccc',
806
+ },
807
+ lineStyle: {
808
+ width: 1,
809
+ color: '#aaa',
810
+ },
811
+ symbolSize: 4,
812
+ symbol: 'emptyCircle',
813
+ smooth: false,
814
+ color: [
815
+ '#d87c7c',
816
+ '#919e8b',
817
+ '#d7ab82',
818
+ '#6e7074',
819
+ '#61a0a8',
820
+ '#efa18d',
821
+ '#787464',
822
+ '#cc7e63',
823
+ '#724e58',
824
+ '#4b565b',
825
+ ],
826
+ label: {
827
+ color: '#eee',
828
+ },
829
+ },
830
+ map: {
831
+ itemStyle: {
832
+ areaColor: '#eeeeee',
833
+ borderColor: '#444444',
834
+ borderWidth: 0.5,
835
+ },
836
+ label: {
837
+ color: '#000000',
838
+ },
839
+ emphasis: {
840
+ itemStyle: {
841
+ areaColor: 'rgba(255,215,0,0.8)',
842
+ borderColor: '#444444',
843
+ borderWidth: 1,
844
+ },
845
+ label: {
846
+ color: 'rgb(100,0,0)',
847
+ },
848
+ },
849
+ },
850
+ geo: {
851
+ itemStyle: {
852
+ areaColor: '#eeeeee',
853
+ borderColor: '#444444',
854
+ borderWidth: 0.5,
855
+ },
856
+ label: {
857
+ color: '#000000',
858
+ },
859
+ emphasis: {
860
+ itemStyle: {
861
+ areaColor: 'rgba(255,215,0,0.8)',
862
+ borderColor: '#444444',
863
+ borderWidth: 1,
864
+ },
865
+ label: {
866
+ color: 'rgb(100,0,0)',
867
+ },
868
+ },
869
+ },
870
+ categoryAxis: {
871
+ axisLine: {
872
+ show: true,
873
+ lineStyle: {
874
+ color: '#333',
875
+ },
876
+ },
877
+ axisTick: {
878
+ show: true,
879
+ lineStyle: {
880
+ color: '#333',
881
+ },
882
+ },
883
+ axisLabel: {
884
+ show: true,
885
+ color: '#333',
886
+ },
887
+ splitLine: {
888
+ show: false,
889
+ lineStyle: {
890
+ color: ['#ccc'],
891
+ },
892
+ },
893
+ splitArea: {
894
+ show: false,
895
+ areaStyle: {
896
+ color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
897
+ },
898
+ },
899
+ },
900
+ valueAxis: {
901
+ axisLine: {
902
+ show: true,
903
+ lineStyle: {
904
+ color: '#333',
905
+ },
906
+ },
907
+ axisTick: {
908
+ show: true,
909
+ lineStyle: {
910
+ color: '#333',
911
+ },
912
+ },
913
+ axisLabel: {
914
+ show: true,
915
+ color: '#333',
916
+ },
917
+ splitLine: {
918
+ show: true,
919
+ lineStyle: {
920
+ color: ['#ccc'],
921
+ },
922
+ },
923
+ splitArea: {
924
+ show: false,
925
+ areaStyle: {
926
+ color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
927
+ },
928
+ },
929
+ },
930
+ logAxis: {
931
+ axisLine: {
932
+ show: true,
933
+ lineStyle: {
934
+ color: '#333',
935
+ },
936
+ },
937
+ axisTick: {
938
+ show: true,
939
+ lineStyle: {
940
+ color: '#333',
941
+ },
942
+ },
943
+ axisLabel: {
944
+ show: true,
945
+ color: '#333',
946
+ },
947
+ splitLine: {
948
+ show: true,
949
+ lineStyle: {
950
+ color: ['#ccc'],
951
+ },
952
+ },
953
+ splitArea: {
954
+ show: false,
955
+ areaStyle: {
956
+ color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
957
+ },
958
+ },
959
+ },
960
+ timeAxis: {
961
+ axisLine: {
962
+ show: true,
963
+ lineStyle: {
964
+ color: '#333',
965
+ },
966
+ },
967
+ axisTick: {
968
+ show: true,
969
+ lineStyle: {
970
+ color: '#333',
971
+ },
972
+ },
973
+ axisLabel: {
974
+ show: true,
975
+ color: '#333',
976
+ },
977
+ splitLine: {
978
+ show: true,
979
+ lineStyle: {
980
+ color: ['#ccc'],
981
+ },
982
+ },
983
+ splitArea: {
984
+ show: false,
985
+ areaStyle: {
986
+ color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
987
+ },
988
+ },
989
+ },
990
+ toolbox: {
991
+ iconStyle: {
992
+ borderColor: '#999999',
993
+ },
994
+ emphasis: {
995
+ iconStyle: {
996
+ borderColor: '#666666',
997
+ },
998
+ },
999
+ },
1000
+ legend: {
1001
+ textStyle: {
1002
+ color: '#333333',
1003
+ },
1004
+ left: 'center',
1005
+ right: 'auto',
1006
+ top: 0,
1007
+ bottom: 10,
1008
+ },
1009
+ tooltip: {
1010
+ axisPointer: {
1011
+ lineStyle: {
1012
+ color: '#cccccc',
1013
+ width: 1,
1014
+ },
1015
+ crossStyle: {
1016
+ color: '#cccccc',
1017
+ width: 1,
1018
+ },
1019
+ },
1020
+ },
1021
+ timeline: {
1022
+ lineStyle: {
1023
+ color: '#293c55',
1024
+ width: 1,
1025
+ },
1026
+ itemStyle: {
1027
+ color: '#293c55',
1028
+ borderWidth: 1,
1029
+ },
1030
+ controlStyle: {
1031
+ color: '#293c55',
1032
+ borderColor: '#293c55',
1033
+ borderWidth: 0.5,
1034
+ },
1035
+ checkpointStyle: {
1036
+ color: '#e43c59',
1037
+ borderColor: 'rgba(194,53,49,0.5)',
1038
+ },
1039
+ label: {
1040
+ color: '#293c55',
1041
+ },
1042
+ emphasis: {
1043
+ itemStyle: {
1044
+ color: '#a9334c',
1045
+ },
1046
+ controlStyle: {
1047
+ color: '#293c55',
1048
+ borderColor: '#293c55',
1049
+ borderWidth: 0.5,
1050
+ },
1051
+ label: {
1052
+ color: '#293c55',
1053
+ },
1054
+ },
1055
+ },
1056
+ visualMap: {
1057
+ color: ['#bf444c', '#d88273', '#f6efa6'],
1058
+ },
1059
+ markPoint: {
1060
+ label: {
1061
+ color: '#eee',
1062
+ },
1063
+ emphasis: {
1064
+ label: {
1065
+ color: '#eee',
1066
+ },
1067
+ },
1068
+ },
1069
+ grid: {
1070
+ left: '10%',
1071
+ right: '10%',
1072
+ top: 60,
1073
+ bottom: 70,
1074
+ },
1075
+ };
1076
+ echarts.registerTheme('vintage', vintageTheme.default ?? vintageTheme);
1077
+
1078
+ const darkTheme = {
1079
+ color: [
1080
+ '#dd6b66',
1081
+ '#759aa0',
1082
+ '#e69d87',
1083
+ '#8dc1a9',
1084
+ '#ea7e53',
1085
+ '#eedd78',
1086
+ '#73a373',
1087
+ '#73b9bc',
1088
+ '#7289ab',
1089
+ '#91ca8c',
1090
+ '#f49f42',
1091
+ ],
1092
+ backgroundColor: 'rgba(51,51,51,1)',
1093
+ textStyle: {},
1094
+ title: {
1095
+ textStyle: {
1096
+ color: '#eeeeee',
1097
+ },
1098
+ subtextStyle: {
1099
+ color: '#aaa',
1100
+ },
1101
+ },
1102
+ line: {
1103
+ itemStyle: {
1104
+ borderWidth: 1,
1105
+ },
1106
+ lineStyle: {
1107
+ width: 2,
1108
+ },
1109
+ symbolSize: 4,
1110
+ symbol: 'circle',
1111
+ smooth: false,
1112
+ },
1113
+ radar: {
1114
+ itemStyle: {
1115
+ borderWidth: 1,
1116
+ },
1117
+ lineStyle: {
1118
+ width: 2,
1119
+ },
1120
+ symbolSize: 4,
1121
+ symbol: 'circle',
1122
+ smooth: false,
1123
+ },
1124
+ bar: {
1125
+ itemStyle: {
1126
+ barBorderWidth: 0,
1127
+ barBorderColor: '#ccc',
1128
+ },
1129
+ },
1130
+ pie: {
1131
+ itemStyle: {
1132
+ borderWidth: 0,
1133
+ borderColor: '#ccc',
1134
+ },
1135
+ },
1136
+ scatter: {
1137
+ itemStyle: {
1138
+ borderWidth: 0,
1139
+ borderColor: '#ccc',
1140
+ },
1141
+ },
1142
+ boxplot: {
1143
+ itemStyle: {
1144
+ borderWidth: 0,
1145
+ borderColor: '#ccc',
1146
+ },
1147
+ },
1148
+ parallel: {
1149
+ itemStyle: {
1150
+ borderWidth: 0,
1151
+ borderColor: '#ccc',
1152
+ },
1153
+ },
1154
+ sankey: {
1155
+ itemStyle: {
1156
+ borderWidth: 0,
1157
+ borderColor: '#ccc',
1158
+ },
1159
+ },
1160
+ funnel: {
1161
+ itemStyle: {
1162
+ borderWidth: 0,
1163
+ borderColor: '#ccc',
1164
+ },
1165
+ },
1166
+ gauge: {
1167
+ itemStyle: {
1168
+ borderWidth: 0,
1169
+ borderColor: '#ccc',
1170
+ },
1171
+ },
1172
+ candlestick: {
1173
+ itemStyle: {
1174
+ color: '#fd1050',
1175
+ color0: '#0cf49b',
1176
+ borderColor: '#fd1050',
1177
+ borderColor0: '#0cf49b',
1178
+ borderWidth: 1,
1179
+ },
1180
+ },
1181
+ graph: {
1182
+ itemStyle: {
1183
+ borderWidth: 0,
1184
+ borderColor: '#ccc',
1185
+ },
1186
+ lineStyle: {
1187
+ width: 1,
1188
+ color: '#aaa',
1189
+ },
1190
+ symbolSize: 4,
1191
+ symbol: 'circle',
1192
+ smooth: false,
1193
+ color: [
1194
+ '#dd6b66',
1195
+ '#759aa0',
1196
+ '#e69d87',
1197
+ '#8dc1a9',
1198
+ '#ea7e53',
1199
+ '#eedd78',
1200
+ '#73a373',
1201
+ '#73b9bc',
1202
+ '#7289ab',
1203
+ '#91ca8c',
1204
+ '#f49f42',
1205
+ ],
1206
+ label: {
1207
+ color: '#eee',
1208
+ },
1209
+ },
1210
+ map: {
1211
+ itemStyle: {
1212
+ areaColor: '#eee',
1213
+ borderColor: '#444',
1214
+ borderWidth: 0.5,
1215
+ },
1216
+ label: {
1217
+ color: '#000',
1218
+ },
1219
+ emphasis: {
1220
+ itemStyle: {
1221
+ areaColor: 'rgba(255,215,0,0.8)',
1222
+ borderColor: '#444',
1223
+ borderWidth: 1,
1224
+ },
1225
+ label: {
1226
+ color: 'rgb(100,0,0)',
1227
+ },
1228
+ },
1229
+ },
1230
+ geo: {
1231
+ itemStyle: {
1232
+ areaColor: '#eee',
1233
+ borderColor: '#444',
1234
+ borderWidth: 0.5,
1235
+ },
1236
+ label: {
1237
+ color: '#000',
1238
+ },
1239
+ emphasis: {
1240
+ itemStyle: {
1241
+ areaColor: 'rgba(255,215,0,0.8)',
1242
+ borderColor: '#444',
1243
+ borderWidth: 1,
1244
+ },
1245
+ label: {
1246
+ color: 'rgb(100,0,0)',
1247
+ },
1248
+ },
1249
+ },
1250
+ categoryAxis: {
1251
+ axisLine: {
1252
+ show: true,
1253
+ lineStyle: {
1254
+ color: '#eeeeee',
1255
+ },
1256
+ },
1257
+ axisTick: {
1258
+ show: true,
1259
+ lineStyle: {
1260
+ color: '#eeeeee',
1261
+ },
1262
+ },
1263
+ axisLabel: {
1264
+ show: true,
1265
+ color: '#eeeeee',
1266
+ },
1267
+ splitLine: {
1268
+ show: true,
1269
+ lineStyle: {
1270
+ color: ['#aaaaaa'],
1271
+ },
1272
+ },
1273
+ splitArea: {
1274
+ show: false,
1275
+ areaStyle: {
1276
+ color: ['#eeeeee'],
1277
+ },
1278
+ },
1279
+ },
1280
+ valueAxis: {
1281
+ axisLine: {
1282
+ show: true,
1283
+ lineStyle: {
1284
+ color: '#eeeeee',
1285
+ },
1286
+ },
1287
+ axisTick: {
1288
+ show: true,
1289
+ lineStyle: {
1290
+ color: '#eeeeee',
1291
+ },
1292
+ },
1293
+ axisLabel: {
1294
+ show: true,
1295
+ color: '#eeeeee',
1296
+ },
1297
+ splitLine: {
1298
+ show: true,
1299
+ lineStyle: {
1300
+ color: ['#aaaaaa'],
1301
+ },
1302
+ },
1303
+ splitArea: {
1304
+ show: false,
1305
+ areaStyle: {
1306
+ color: ['#eeeeee'],
1307
+ },
1308
+ },
1309
+ },
1310
+ logAxis: {
1311
+ axisLine: {
1312
+ show: true,
1313
+ lineStyle: {
1314
+ color: '#eeeeee',
1315
+ },
1316
+ },
1317
+ axisTick: {
1318
+ show: true,
1319
+ lineStyle: {
1320
+ color: '#eeeeee',
1321
+ },
1322
+ },
1323
+ axisLabel: {
1324
+ show: true,
1325
+ color: '#eeeeee',
1326
+ },
1327
+ splitLine: {
1328
+ show: true,
1329
+ lineStyle: {
1330
+ color: ['#aaaaaa'],
1331
+ },
1332
+ },
1333
+ splitArea: {
1334
+ show: false,
1335
+ areaStyle: {
1336
+ color: ['#eeeeee'],
1337
+ },
1338
+ },
1339
+ },
1340
+ timeAxis: {
1341
+ axisLine: {
1342
+ show: true,
1343
+ lineStyle: {
1344
+ color: '#eeeeee',
1345
+ },
1346
+ },
1347
+ axisTick: {
1348
+ show: true,
1349
+ lineStyle: {
1350
+ color: '#eeeeee',
1351
+ },
1352
+ },
1353
+ axisLabel: {
1354
+ show: true,
1355
+ color: '#eeeeee',
1356
+ },
1357
+ splitLine: {
1358
+ show: true,
1359
+ lineStyle: {
1360
+ color: ['#aaaaaa'],
1361
+ },
1362
+ },
1363
+ splitArea: {
1364
+ show: false,
1365
+ areaStyle: {
1366
+ color: ['#eeeeee'],
1367
+ },
1368
+ },
1369
+ },
1370
+ toolbox: {
1371
+ iconStyle: {
1372
+ borderColor: '#999',
1373
+ },
1374
+ emphasis: {
1375
+ iconStyle: {
1376
+ borderColor: '#666',
1377
+ },
1378
+ },
1379
+ },
1380
+ legend: {
1381
+ textStyle: {
1382
+ color: '#eeeeee',
1383
+ },
1384
+ left: 'center',
1385
+ right: 'auto',
1386
+ top: 'auto',
1387
+ bottom: 15,
1388
+ },
1389
+ tooltip: {
1390
+ axisPointer: {
1391
+ lineStyle: {
1392
+ color: '#eeeeee',
1393
+ width: '1',
1394
+ },
1395
+ crossStyle: {
1396
+ color: '#eeeeee',
1397
+ width: '1',
1398
+ },
1399
+ },
1400
+ },
1401
+ timeline: {
1402
+ lineStyle: {
1403
+ color: '#eeeeee',
1404
+ width: 1,
1405
+ },
1406
+ itemStyle: {
1407
+ color: '#dd6b66',
1408
+ borderWidth: 1,
1409
+ },
1410
+ controlStyle: {
1411
+ color: '#eeeeee',
1412
+ borderColor: '#eeeeee',
1413
+ borderWidth: 0.5,
1414
+ },
1415
+ checkpointStyle: {
1416
+ color: '#e43c59',
1417
+ borderColor: 'rgba(194,53,49, 0.5)',
1418
+ },
1419
+ label: {
1420
+ color: '#eeeeee',
1421
+ },
1422
+ emphasis: {
1423
+ itemStyle: {
1424
+ color: '#a9334c',
1425
+ },
1426
+ controlStyle: {
1427
+ color: '#eeeeee',
1428
+ borderColor: '#eeeeee',
1429
+ borderWidth: 0.5,
1430
+ },
1431
+ label: {
1432
+ color: '#eeeeee',
1433
+ },
1434
+ },
1435
+ },
1436
+ visualMap: {
1437
+ color: ['#bf444c', '#d88273', '#f6efa6'],
1438
+ },
1439
+ markPoint: {
1440
+ label: {
1441
+ color: '#eee',
1442
+ },
1443
+ emphasis: {
1444
+ label: {
1445
+ color: '#eee',
1446
+ },
1447
+ },
1448
+ },
1449
+ grid: {
1450
+ left: '15%',
1451
+ right: '10%',
1452
+ top: 65,
1453
+ bottom: 80,
1454
+ },
1455
+ };
1456
+ echarts.registerTheme('dark', darkTheme.default ?? darkTheme);
1457
+
1458
+ const essosTheme = {
1459
+ color: ['#893448', '#d95850', '#eb8146', '#ffb248', '#f2d643', '#ebdba4'],
1460
+ backgroundColor: 'rgba(242,234,191,0.15)',
1461
+ textStyle: {},
1462
+ title: {
1463
+ textStyle: {
1464
+ color: '#893448',
1465
+ },
1466
+ subtextStyle: {
1467
+ color: '#d95850',
1468
+ },
1469
+ },
1470
+ line: {
1471
+ itemStyle: {
1472
+ borderWidth: '2',
1473
+ },
1474
+ lineStyle: {
1475
+ width: '2',
1476
+ },
1477
+ symbolSize: '6',
1478
+ symbol: 'emptyCircle',
1479
+ smooth: true,
1480
+ },
1481
+ radar: {
1482
+ itemStyle: {
1483
+ borderWidth: '2',
1484
+ },
1485
+ lineStyle: {
1486
+ width: '2',
1487
+ },
1488
+ symbolSize: '6',
1489
+ symbol: 'emptyCircle',
1490
+ smooth: true,
1491
+ },
1492
+ bar: {
1493
+ itemStyle: {
1494
+ barBorderWidth: 0,
1495
+ barBorderColor: '#ccc',
1496
+ },
1497
+ },
1498
+ pie: {
1499
+ itemStyle: {
1500
+ borderWidth: 0,
1501
+ borderColor: '#ccc',
1502
+ },
1503
+ },
1504
+ scatter: {
1505
+ itemStyle: {
1506
+ borderWidth: 0,
1507
+ borderColor: '#ccc',
1508
+ },
1509
+ },
1510
+ boxplot: {
1511
+ itemStyle: {
1512
+ borderWidth: 0,
1513
+ borderColor: '#ccc',
1514
+ },
1515
+ },
1516
+ parallel: {
1517
+ itemStyle: {
1518
+ borderWidth: 0,
1519
+ borderColor: '#ccc',
1520
+ },
1521
+ },
1522
+ sankey: {
1523
+ itemStyle: {
1524
+ borderWidth: 0,
1525
+ borderColor: '#ccc',
1526
+ },
1527
+ },
1528
+ funnel: {
1529
+ itemStyle: {
1530
+ borderWidth: 0,
1531
+ borderColor: '#ccc',
1532
+ },
1533
+ },
1534
+ gauge: {
1535
+ itemStyle: {
1536
+ borderWidth: 0,
1537
+ borderColor: '#ccc',
1538
+ },
1539
+ },
1540
+ candlestick: {
1541
+ itemStyle: {
1542
+ color: '#eb8146',
1543
+ color0: 'transparent',
1544
+ borderColor: '#d95850',
1545
+ borderColor0: '#58c470',
1546
+ borderWidth: '2',
1547
+ },
1548
+ },
1549
+ graph: {
1550
+ itemStyle: {
1551
+ borderWidth: 0,
1552
+ borderColor: '#ccc',
1553
+ },
1554
+ lineStyle: {
1555
+ width: 1,
1556
+ color: '#aaa',
1557
+ },
1558
+ symbolSize: '6',
1559
+ symbol: 'emptyCircle',
1560
+ smooth: true,
1561
+ color: ['#893448', '#d95850', '#eb8146', '#ffb248', '#f2d643', '#ebdba4'],
1562
+ label: {
1563
+ color: '#ffffff',
1564
+ },
1565
+ },
1566
+ map: {
1567
+ itemStyle: {
1568
+ areaColor: '#f3f3f3',
1569
+ borderColor: '#999999',
1570
+ borderWidth: 0.5,
1571
+ },
1572
+ label: {
1573
+ color: '#893448',
1574
+ },
1575
+ emphasis: {
1576
+ itemStyle: {
1577
+ areaColor: '#ffb248',
1578
+ borderColor: '#eb8146',
1579
+ borderWidth: 1,
1580
+ },
1581
+ label: {
1582
+ color: '#893448',
1583
+ },
1584
+ },
1585
+ },
1586
+ geo: {
1587
+ itemStyle: {
1588
+ areaColor: '#f3f3f3',
1589
+ borderColor: '#999999',
1590
+ borderWidth: 0.5,
1591
+ },
1592
+ label: {
1593
+ color: '#893448',
1594
+ },
1595
+ emphasis: {
1596
+ itemStyle: {
1597
+ areaColor: '#ffb248',
1598
+ borderColor: '#eb8146',
1599
+ borderWidth: 1,
1600
+ },
1601
+ label: {
1602
+ color: '#893448',
1603
+ },
1604
+ },
1605
+ },
1606
+ categoryAxis: {
1607
+ axisLine: {
1608
+ show: true,
1609
+ lineStyle: {
1610
+ color: '#aaaaaa',
1611
+ },
1612
+ },
1613
+ axisTick: {
1614
+ show: false,
1615
+ lineStyle: {
1616
+ color: '#333',
1617
+ },
1618
+ },
1619
+ axisLabel: {
1620
+ show: true,
1621
+ color: '#999999',
1622
+ },
1623
+ splitLine: {
1624
+ show: true,
1625
+ lineStyle: {
1626
+ color: ['#e6e6e6'],
1627
+ },
1628
+ },
1629
+ splitArea: {
1630
+ show: false,
1631
+ areaStyle: {
1632
+ color: ['rgba(250,250,250,0.05)', 'rgba(200,200,200,0.02)'],
1633
+ },
1634
+ },
1635
+ },
1636
+ valueAxis: {
1637
+ axisLine: {
1638
+ show: true,
1639
+ lineStyle: {
1640
+ color: '#aaaaaa',
1641
+ },
1642
+ },
1643
+ axisTick: {
1644
+ show: false,
1645
+ lineStyle: {
1646
+ color: '#333',
1647
+ },
1648
+ },
1649
+ axisLabel: {
1650
+ show: true,
1651
+ color: '#999999',
1652
+ },
1653
+ splitLine: {
1654
+ show: true,
1655
+ lineStyle: {
1656
+ color: ['#e6e6e6'],
1657
+ },
1658
+ },
1659
+ splitArea: {
1660
+ show: false,
1661
+ areaStyle: {
1662
+ color: ['rgba(250,250,250,0.05)', 'rgba(200,200,200,0.02)'],
1663
+ },
1664
+ },
1665
+ },
1666
+ logAxis: {
1667
+ axisLine: {
1668
+ show: true,
1669
+ lineStyle: {
1670
+ color: '#aaaaaa',
1671
+ },
1672
+ },
1673
+ axisTick: {
1674
+ show: false,
1675
+ lineStyle: {
1676
+ color: '#333',
1677
+ },
1678
+ },
1679
+ axisLabel: {
1680
+ show: true,
1681
+ color: '#999999',
1682
+ },
1683
+ splitLine: {
1684
+ show: true,
1685
+ lineStyle: {
1686
+ color: ['#e6e6e6'],
1687
+ },
1688
+ },
1689
+ splitArea: {
1690
+ show: false,
1691
+ areaStyle: {
1692
+ color: ['rgba(250,250,250,0.05)', 'rgba(200,200,200,0.02)'],
1693
+ },
1694
+ },
1695
+ },
1696
+ timeAxis: {
1697
+ axisLine: {
1698
+ show: true,
1699
+ lineStyle: {
1700
+ color: '#aaaaaa',
1701
+ },
1702
+ },
1703
+ axisTick: {
1704
+ show: false,
1705
+ lineStyle: {
1706
+ color: '#333',
1707
+ },
1708
+ },
1709
+ axisLabel: {
1710
+ show: true,
1711
+ color: '#999999',
1712
+ },
1713
+ splitLine: {
1714
+ show: true,
1715
+ lineStyle: {
1716
+ color: ['#e6e6e6'],
1717
+ },
1718
+ },
1719
+ splitArea: {
1720
+ show: false,
1721
+ areaStyle: {
1722
+ color: ['rgba(250,250,250,0.05)', 'rgba(200,200,200,0.02)'],
1723
+ },
1724
+ },
1725
+ },
1726
+ toolbox: {
1727
+ iconStyle: {
1728
+ borderColor: '#999',
1729
+ },
1730
+ emphasis: {
1731
+ iconStyle: {
1732
+ borderColor: '#666',
1733
+ },
1734
+ },
1735
+ },
1736
+ legend: {
1737
+ textStyle: {
1738
+ color: '#999999',
1739
+ },
1740
+ left: 'center',
1741
+ right: 'auto',
1742
+ top: 'auto',
1743
+ bottom: 15,
1744
+ },
1745
+ tooltip: {
1746
+ axisPointer: {
1747
+ lineStyle: {
1748
+ color: '#ccc',
1749
+ width: 1,
1750
+ },
1751
+ crossStyle: {
1752
+ color: '#ccc',
1753
+ width: 1,
1754
+ },
1755
+ },
1756
+ },
1757
+ timeline: {
1758
+ lineStyle: {
1759
+ color: '#893448',
1760
+ width: 1,
1761
+ },
1762
+ itemStyle: {
1763
+ color: '#893448',
1764
+ borderWidth: 1,
1765
+ },
1766
+ controlStyle: {
1767
+ color: '#893448',
1768
+ borderColor: '#893448',
1769
+ borderWidth: 0.5,
1770
+ },
1771
+ checkpointStyle: {
1772
+ color: '#eb8146',
1773
+ borderColor: 'rgba(255,178,72,0.41)',
1774
+ },
1775
+ label: {
1776
+ color: '#893448',
1777
+ },
1778
+ emphasis: {
1779
+ itemStyle: {
1780
+ color: '#ffb248',
1781
+ },
1782
+ controlStyle: {
1783
+ color: '#893448',
1784
+ borderColor: '#893448',
1785
+ borderWidth: 0.5,
1786
+ },
1787
+ label: {
1788
+ color: '#893448',
1789
+ },
1790
+ },
1791
+ },
1792
+ visualMap: {
1793
+ color: ['#893448', '#d95850', '#eb8146', '#ffb248', '#f2d643', 'rgb(247,238,173)'],
1794
+ },
1795
+ markPoint: {
1796
+ label: {
1797
+ color: '#ffffff',
1798
+ },
1799
+ emphasis: {
1800
+ label: {
1801
+ color: '#ffffff',
1802
+ },
1803
+ },
1804
+ },
1805
+ grid: {
1806
+ left: '15%',
1807
+ right: '10%',
1808
+ top: 65,
1809
+ bottom: 80,
1810
+ },
1811
+ };
1812
+ echarts.registerTheme('essos', essosTheme.default ?? essosTheme);
1813
+
1814
+ const chalkTheme = {
1815
+ color: ['#fc97af', '#87f7cf', '#f7f494', '#72ccff', '#f7c5a0', '#d4a4eb', '#d2f5a6', '#76f2f2'],
1816
+ backgroundColor: 'rgba(41,52,65,1)',
1817
+ textStyle: {},
1818
+ title: {
1819
+ textStyle: {
1820
+ color: '#ffffff',
1821
+ },
1822
+ subtextStyle: {
1823
+ color: '#dddddd',
1824
+ },
1825
+ },
1826
+ line: {
1827
+ itemStyle: {
1828
+ borderWidth: '4',
1829
+ },
1830
+ lineStyle: {
1831
+ width: '3',
1832
+ },
1833
+ symbolSize: '0',
1834
+ symbol: 'circle',
1835
+ smooth: true,
1836
+ },
1837
+ radar: {
1838
+ itemStyle: {
1839
+ borderWidth: '4',
1840
+ },
1841
+ lineStyle: {
1842
+ width: '3',
1843
+ },
1844
+ symbolSize: '0',
1845
+ symbol: 'circle',
1846
+ smooth: true,
1847
+ },
1848
+ bar: {
1849
+ itemStyle: {
1850
+ barBorderWidth: 0,
1851
+ barBorderColor: '#ccc',
1852
+ },
1853
+ },
1854
+ pie: {
1855
+ itemStyle: {
1856
+ borderWidth: 0,
1857
+ borderColor: '#ccc',
1858
+ },
1859
+ },
1860
+ scatter: {
1861
+ itemStyle: {
1862
+ borderWidth: 0,
1863
+ borderColor: '#ccc',
1864
+ },
1865
+ },
1866
+ boxplot: {
1867
+ itemStyle: {
1868
+ borderWidth: 0,
1869
+ borderColor: '#ccc',
1870
+ },
1871
+ },
1872
+ parallel: {
1873
+ itemStyle: {
1874
+ borderWidth: 0,
1875
+ borderColor: '#ccc',
1876
+ },
1877
+ },
1878
+ sankey: {
1879
+ itemStyle: {
1880
+ borderWidth: 0,
1881
+ borderColor: '#ccc',
1882
+ },
1883
+ },
1884
+ funnel: {
1885
+ itemStyle: {
1886
+ borderWidth: 0,
1887
+ borderColor: '#ccc',
1888
+ },
1889
+ },
1890
+ gauge: {
1891
+ itemStyle: {
1892
+ borderWidth: 0,
1893
+ borderColor: '#ccc',
1894
+ },
1895
+ },
1896
+ candlestick: {
1897
+ itemStyle: {
1898
+ color: '#fc97af',
1899
+ color0: 'transparent',
1900
+ borderColor: '#fc97af',
1901
+ borderColor0: '#87f7cf',
1902
+ borderWidth: '2',
1903
+ },
1904
+ },
1905
+ graph: {
1906
+ itemStyle: {
1907
+ borderWidth: 0,
1908
+ borderColor: '#ccc',
1909
+ },
1910
+ lineStyle: {
1911
+ width: '1',
1912
+ color: '#ffffff',
1913
+ },
1914
+ symbolSize: '0',
1915
+ symbol: 'circle',
1916
+ smooth: true,
1917
+ color: ['#fc97af', '#87f7cf', '#f7f494', '#72ccff', '#f7c5a0', '#d4a4eb', '#d2f5a6', '#76f2f2'],
1918
+ label: {
1919
+ color: '#293441',
1920
+ },
1921
+ },
1922
+ map: {
1923
+ itemStyle: {
1924
+ areaColor: '#f3f3f3',
1925
+ borderColor: '#999999',
1926
+ borderWidth: 0.5,
1927
+ },
1928
+ label: {
1929
+ color: '#893448',
1930
+ },
1931
+ emphasis: {
1932
+ itemStyle: {
1933
+ areaColor: 'rgba(255,178,72,1)',
1934
+ borderColor: '#eb8146',
1935
+ borderWidth: 1,
1936
+ },
1937
+ label: {
1938
+ color: 'rgb(137,52,72)',
1939
+ },
1940
+ },
1941
+ },
1942
+ geo: {
1943
+ itemStyle: {
1944
+ areaColor: '#f3f3f3',
1945
+ borderColor: '#999999',
1946
+ borderWidth: 0.5,
1947
+ },
1948
+ label: {
1949
+ color: '#893448',
1950
+ },
1951
+ emphasis: {
1952
+ itemStyle: {
1953
+ areaColor: 'rgba(255,178,72,1)',
1954
+ borderColor: '#eb8146',
1955
+ borderWidth: 1,
1956
+ },
1957
+ label: {
1958
+ color: 'rgb(137,52,72)',
1959
+ },
1960
+ },
1961
+ },
1962
+ categoryAxis: {
1963
+ axisLine: {
1964
+ show: true,
1965
+ lineStyle: {
1966
+ color: '#666666',
1967
+ },
1968
+ },
1969
+ axisTick: {
1970
+ show: false,
1971
+ lineStyle: {
1972
+ color: '#333',
1973
+ },
1974
+ },
1975
+ axisLabel: {
1976
+ show: true,
1977
+ color: '#aaaaaa',
1978
+ },
1979
+ splitLine: {
1980
+ show: false,
1981
+ lineStyle: {
1982
+ color: ['#e6e6e6'],
1983
+ },
1984
+ },
1985
+ splitArea: {
1986
+ show: false,
1987
+ areaStyle: {
1988
+ color: ['rgba(250,250,250,0.05)', 'rgba(200,200,200,0.02)'],
1989
+ },
1990
+ },
1991
+ },
1992
+ valueAxis: {
1993
+ axisLine: {
1994
+ show: true,
1995
+ lineStyle: {
1996
+ color: '#666666',
1997
+ },
1998
+ },
1999
+ axisTick: {
2000
+ show: false,
2001
+ lineStyle: {
2002
+ color: '#333',
2003
+ },
2004
+ },
2005
+ axisLabel: {
2006
+ show: true,
2007
+ color: '#aaaaaa',
2008
+ },
2009
+ splitLine: {
2010
+ show: false,
2011
+ lineStyle: {
2012
+ color: ['#e6e6e6'],
2013
+ },
2014
+ },
2015
+ splitArea: {
2016
+ show: false,
2017
+ areaStyle: {
2018
+ color: ['rgba(250,250,250,0.05)', 'rgba(200,200,200,0.02)'],
2019
+ },
2020
+ },
2021
+ },
2022
+ logAxis: {
2023
+ axisLine: {
2024
+ show: true,
2025
+ lineStyle: {
2026
+ color: '#666666',
2027
+ },
2028
+ },
2029
+ axisTick: {
2030
+ show: false,
2031
+ lineStyle: {
2032
+ color: '#333',
2033
+ },
2034
+ },
2035
+ axisLabel: {
2036
+ show: true,
2037
+ color: '#aaaaaa',
2038
+ },
2039
+ splitLine: {
2040
+ show: false,
2041
+ lineStyle: {
2042
+ color: ['#e6e6e6'],
2043
+ },
2044
+ },
2045
+ splitArea: {
2046
+ show: false,
2047
+ areaStyle: {
2048
+ color: ['rgba(250,250,250,0.05)', 'rgba(200,200,200,0.02)'],
2049
+ },
2050
+ },
2051
+ },
2052
+ timeAxis: {
2053
+ axisLine: {
2054
+ show: true,
2055
+ lineStyle: {
2056
+ color: '#666666',
2057
+ },
2058
+ },
2059
+ axisTick: {
2060
+ show: false,
2061
+ lineStyle: {
2062
+ color: '#333',
2063
+ },
2064
+ },
2065
+ axisLabel: {
2066
+ show: true,
2067
+ color: '#aaaaaa',
2068
+ },
2069
+ splitLine: {
2070
+ show: false,
2071
+ lineStyle: {
2072
+ color: ['#e6e6e6'],
2073
+ },
2074
+ },
2075
+ splitArea: {
2076
+ show: false,
2077
+ areaStyle: {
2078
+ color: ['rgba(250,250,250,0.05)', 'rgba(200,200,200,0.02)'],
2079
+ },
2080
+ },
2081
+ },
2082
+ toolbox: {
2083
+ iconStyle: {
2084
+ borderColor: '#999999',
2085
+ },
2086
+ emphasis: {
2087
+ iconStyle: {
2088
+ borderColor: '#666666',
2089
+ },
2090
+ },
2091
+ },
2092
+ legend: {
2093
+ textStyle: {
2094
+ color: '#999999',
2095
+ },
2096
+ left: 'center',
2097
+ right: 'auto',
2098
+ top: 'auto',
2099
+ bottom: 15,
2100
+ },
2101
+ tooltip: {
2102
+ axisPointer: {
2103
+ lineStyle: {
2104
+ color: '#cccccc',
2105
+ width: 1,
2106
+ },
2107
+ crossStyle: {
2108
+ color: '#cccccc',
2109
+ width: 1,
2110
+ },
2111
+ },
2112
+ },
2113
+ timeline: {
2114
+ lineStyle: {
2115
+ color: '#87f7cf',
2116
+ width: 1,
2117
+ },
2118
+ itemStyle: {
2119
+ color: '#87f7cf',
2120
+ borderWidth: 1,
2121
+ },
2122
+ controlStyle: {
2123
+ color: '#87f7cf',
2124
+ borderColor: '#87f7cf',
2125
+ borderWidth: 0.5,
2126
+ },
2127
+ checkpointStyle: {
2128
+ color: '#fc97af',
2129
+ borderColor: 'rgba(252,151,175,0.3)',
2130
+ },
2131
+ label: {
2132
+ color: '#87f7cf',
2133
+ },
2134
+ emphasis: {
2135
+ itemStyle: {
2136
+ color: '#f7f494',
2137
+ },
2138
+ controlStyle: {
2139
+ color: '#87f7cf',
2140
+ borderColor: '#87f7cf',
2141
+ borderWidth: 0.5,
2142
+ },
2143
+ label: {
2144
+ color: '#87f7cf',
2145
+ },
2146
+ },
2147
+ },
2148
+ visualMap: {
2149
+ color: ['#fc97af', '#87f7cf'],
2150
+ },
2151
+ markPoint: {
2152
+ label: {
2153
+ color: '#293441',
2154
+ },
2155
+ emphasis: {
2156
+ label: {
2157
+ color: '#293441',
2158
+ },
2159
+ },
2160
+ },
2161
+ grid: {
2162
+ left: '15%',
2163
+ right: '10%',
2164
+ top: 65,
2165
+ bottom: 80,
2166
+ },
2167
+ };
2168
+ echarts.registerTheme('chalk', chalkTheme.default ?? chalkTheme);
2169
+
2170
+ const romaTheme = {
2171
+ color: [
2172
+ '#e01f54',
2173
+ '#001852',
2174
+ '#f5e8c8',
2175
+ '#b8d2c7',
2176
+ '#c6b38e',
2177
+ '#a4d8c2',
2178
+ '#f3d999',
2179
+ '#d3758f',
2180
+ '#dcc392',
2181
+ '#2e4783',
2182
+ '#82b6e9',
2183
+ '#ff6347',
2184
+ '#a092f1',
2185
+ '#0a915d',
2186
+ '#eaf889',
2187
+ '#6699FF',
2188
+ '#ff6666',
2189
+ '#3cb371',
2190
+ '#d5b158',
2191
+ '#38b6b6',
2192
+ ],
2193
+ backgroundColor: 'rgba(0,0,0,0)',
2194
+ textStyle: {},
2195
+ title: {
2196
+ textStyle: {
2197
+ color: '#333333',
2198
+ },
2199
+ subtextStyle: {
2200
+ color: '#aaa',
2201
+ },
2202
+ },
2203
+ line: {
2204
+ itemStyle: {
2205
+ borderWidth: 1,
2206
+ },
2207
+ lineStyle: {
2208
+ width: 2,
2209
+ },
2210
+ symbolSize: 4,
2211
+ symbol: 'emptyCircle',
2212
+ smooth: false,
2213
+ },
2214
+ radar: {
2215
+ itemStyle: {
2216
+ borderWidth: 1,
2217
+ },
2218
+ lineStyle: {
2219
+ width: 2,
2220
+ },
2221
+ symbolSize: 4,
2222
+ symbol: 'emptyCircle',
2223
+ smooth: false,
2224
+ },
2225
+ bar: {
2226
+ itemStyle: {
2227
+ barBorderWidth: 0,
2228
+ barBorderColor: '#ccc',
2229
+ },
2230
+ },
2231
+ pie: {
2232
+ itemStyle: {
2233
+ borderWidth: 0,
2234
+ borderColor: '#ccc',
2235
+ },
2236
+ },
2237
+ scatter: {
2238
+ itemStyle: {
2239
+ borderWidth: 0,
2240
+ borderColor: '#ccc',
2241
+ },
2242
+ },
2243
+ boxplot: {
2244
+ itemStyle: {
2245
+ borderWidth: 0,
2246
+ borderColor: '#ccc',
2247
+ },
2248
+ },
2249
+ parallel: {
2250
+ itemStyle: {
2251
+ borderWidth: 0,
2252
+ borderColor: '#ccc',
2253
+ },
2254
+ },
2255
+ sankey: {
2256
+ itemStyle: {
2257
+ borderWidth: 0,
2258
+ borderColor: '#ccc',
2259
+ },
2260
+ },
2261
+ funnel: {
2262
+ itemStyle: {
2263
+ borderWidth: 0,
2264
+ borderColor: '#ccc',
2265
+ },
2266
+ },
2267
+ gauge: {
2268
+ itemStyle: {
2269
+ borderWidth: 0,
2270
+ borderColor: '#ccc',
2271
+ },
2272
+ },
2273
+ candlestick: {
2274
+ itemStyle: {
2275
+ color: '#e01f54',
2276
+ color0: '#001852',
2277
+ borderColor: '#f5e8c8',
2278
+ borderColor0: '#b8d2c7',
2279
+ borderWidth: 1,
2280
+ },
2281
+ },
2282
+ graph: {
2283
+ itemStyle: {
2284
+ borderWidth: 0,
2285
+ borderColor: '#ccc',
2286
+ },
2287
+ lineStyle: {
2288
+ width: 1,
2289
+ color: '#aaa',
2290
+ },
2291
+ symbolSize: 4,
2292
+ symbol: 'emptyCircle',
2293
+ smooth: false,
2294
+ color: [
2295
+ '#e01f54',
2296
+ '#001852',
2297
+ '#f5e8c8',
2298
+ '#b8d2c7',
2299
+ '#c6b38e',
2300
+ '#a4d8c2',
2301
+ '#f3d999',
2302
+ '#d3758f',
2303
+ '#dcc392',
2304
+ '#2e4783',
2305
+ '#82b6e9',
2306
+ '#ff6347',
2307
+ '#a092f1',
2308
+ '#0a915d',
2309
+ '#eaf889',
2310
+ '#6699FF',
2311
+ '#ff6666',
2312
+ '#3cb371',
2313
+ '#d5b158',
2314
+ '#38b6b6',
2315
+ ],
2316
+ label: {
2317
+ color: '#eee',
2318
+ },
2319
+ },
2320
+ map: {
2321
+ itemStyle: {
2322
+ areaColor: '#eeeeee',
2323
+ borderColor: '#444444',
2324
+ borderWidth: 0.5,
2325
+ },
2326
+ label: {
2327
+ color: '#000000',
2328
+ },
2329
+ emphasis: {
2330
+ itemStyle: {
2331
+ areaColor: 'rgba(255,215,0,0.8)',
2332
+ borderColor: '#444',
2333
+ borderWidth: 1,
2334
+ },
2335
+ label: {
2336
+ color: 'rgb(100,0,0)',
2337
+ },
2338
+ },
2339
+ },
2340
+ geo: {
2341
+ itemStyle: {
2342
+ areaColor: '#eeeeee',
2343
+ borderColor: '#444444',
2344
+ borderWidth: 0.5,
2345
+ },
2346
+ label: {
2347
+ color: '#000000',
2348
+ },
2349
+ emphasis: {
2350
+ itemStyle: {
2351
+ areaColor: 'rgba(255,215,0,0.8)',
2352
+ borderColor: '#444',
2353
+ borderWidth: 1,
2354
+ },
2355
+ label: {
2356
+ color: 'rgb(100,0,0)',
2357
+ },
2358
+ },
2359
+ },
2360
+ categoryAxis: {
2361
+ axisLine: {
2362
+ show: true,
2363
+ lineStyle: {
2364
+ color: '#333',
2365
+ },
2366
+ },
2367
+ axisTick: {
2368
+ show: true,
2369
+ lineStyle: {
2370
+ color: '#333',
2371
+ },
2372
+ },
2373
+ axisLabel: {
2374
+ show: true,
2375
+ color: '#333',
2376
+ },
2377
+ splitLine: {
2378
+ show: false,
2379
+ lineStyle: {
2380
+ color: ['#ccc'],
2381
+ },
2382
+ },
2383
+ splitArea: {
2384
+ show: false,
2385
+ areaStyle: {
2386
+ color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
2387
+ },
2388
+ },
2389
+ },
2390
+ valueAxis: {
2391
+ axisLine: {
2392
+ show: true,
2393
+ lineStyle: {
2394
+ color: '#333',
2395
+ },
2396
+ },
2397
+ axisTick: {
2398
+ show: true,
2399
+ lineStyle: {
2400
+ color: '#333',
2401
+ },
2402
+ },
2403
+ axisLabel: {
2404
+ show: true,
2405
+ color: '#333',
2406
+ },
2407
+ splitLine: {
2408
+ show: true,
2409
+ lineStyle: {
2410
+ color: ['#ccc'],
2411
+ },
2412
+ },
2413
+ splitArea: {
2414
+ show: false,
2415
+ areaStyle: {
2416
+ color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
2417
+ },
2418
+ },
2419
+ },
2420
+ logAxis: {
2421
+ axisLine: {
2422
+ show: true,
2423
+ lineStyle: {
2424
+ color: '#333',
2425
+ },
2426
+ },
2427
+ axisTick: {
2428
+ show: true,
2429
+ lineStyle: {
2430
+ color: '#333',
2431
+ },
2432
+ },
2433
+ axisLabel: {
2434
+ show: true,
2435
+ color: '#333',
2436
+ },
2437
+ splitLine: {
2438
+ show: true,
2439
+ lineStyle: {
2440
+ color: ['#ccc'],
2441
+ },
2442
+ },
2443
+ splitArea: {
2444
+ show: false,
2445
+ areaStyle: {
2446
+ color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
2447
+ },
2448
+ },
2449
+ },
2450
+ timeAxis: {
2451
+ axisLine: {
2452
+ show: true,
2453
+ lineStyle: {
2454
+ color: '#333',
2455
+ },
2456
+ },
2457
+ axisTick: {
2458
+ show: true,
2459
+ lineStyle: {
2460
+ color: '#333',
2461
+ },
2462
+ },
2463
+ axisLabel: {
2464
+ show: true,
2465
+ color: '#333',
2466
+ },
2467
+ splitLine: {
2468
+ show: true,
2469
+ lineStyle: {
2470
+ color: ['#ccc'],
2471
+ },
2472
+ },
2473
+ splitArea: {
2474
+ show: false,
2475
+ areaStyle: {
2476
+ color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
2477
+ },
2478
+ },
2479
+ },
2480
+ toolbox: {
2481
+ iconStyle: {
2482
+ borderColor: '#999999',
2483
+ },
2484
+ emphasis: {
2485
+ iconStyle: {
2486
+ borderColor: '#666666',
2487
+ },
2488
+ },
2489
+ },
2490
+ legend: {
2491
+ textStyle: {
2492
+ color: '#333333',
2493
+ },
2494
+ left: 'center',
2495
+ right: 'auto',
2496
+ top: 'auto',
2497
+ bottom: 15,
2498
+ },
2499
+ tooltip: {
2500
+ axisPointer: {
2501
+ lineStyle: {
2502
+ color: '#cccccc',
2503
+ width: 1,
2504
+ },
2505
+ crossStyle: {
2506
+ color: '#cccccc',
2507
+ width: 1,
2508
+ },
2509
+ },
2510
+ },
2511
+ timeline: {
2512
+ lineStyle: {
2513
+ color: '#293c55',
2514
+ width: 1,
2515
+ },
2516
+ itemStyle: {
2517
+ color: '#293c55',
2518
+ borderWidth: 1,
2519
+ },
2520
+ controlStyle: {
2521
+ color: '#293c55',
2522
+ borderColor: '#293c55',
2523
+ borderWidth: 0.5,
2524
+ },
2525
+ checkpointStyle: {
2526
+ color: '#e43c59',
2527
+ borderColor: 'rgba(194,53,49,0.5)',
2528
+ },
2529
+ label: {
2530
+ color: '#293c55',
2531
+ },
2532
+ emphasis: {
2533
+ itemStyle: {
2534
+ color: '#a9334c',
2535
+ },
2536
+ controlStyle: {
2537
+ color: '#293c55',
2538
+ borderColor: '#293c55',
2539
+ borderWidth: 0.5,
2540
+ },
2541
+ label: {
2542
+ color: '#293c55',
2543
+ },
2544
+ },
2545
+ },
2546
+ visualMap: {
2547
+ color: ['#e01f54', '#e7dbc3'],
2548
+ },
2549
+ markPoint: {
2550
+ label: {
2551
+ color: '#eee',
2552
+ },
2553
+ emphasis: {
2554
+ label: {
2555
+ color: '#eee',
2556
+ },
2557
+ },
2558
+ },
2559
+ grid: {
2560
+ left: '15%',
2561
+ right: '10%',
2562
+ top: 65,
2563
+ bottom: 80,
2564
+ },
2565
+ };
2566
+ echarts.registerTheme('roma', romaTheme.default ?? romaTheme);
2567
+
2568
+ class BarChart {
2569
+ cdr;
2570
+ title = '';
2571
+ height = '600px';
2572
+ enableSampling = true; // Sample data if > threshold for perf
2573
+ sampleThreshold = 10000; // Sample if data > 10k (keep full for 50k if hardware allows)
2574
+ isLoading = true;
2575
+ defaultConfig = new OptionsConfig();
2576
+ optionsConfig = {};
2577
+ chartContainer;
2578
+ chartInstance = null;
2579
+ chartService = inject(ChartService);
2580
+ destroy$ = new Subject();
2581
+ currentData = [];
2582
+ currentColumns = [];
2583
+ boundHandleContextMenu;
2584
+ constructor(cdr) {
2585
+ this.cdr = cdr;
2586
+ this.boundHandleContextMenu = this.handleContextMenu.bind(this);
2587
+ // Effect for theme changes
2588
+ effect(() => {
2589
+ this.chartService.theme(); // Read signal
2590
+ if (this.chartInstance) {
2591
+ this.reinitializeChart();
2592
+ }
2593
+ });
2594
+ // Effect for data changes
2595
+ effect(() => {
2596
+ const data = this.chartService.data(); // Read signal
2597
+ const columns = this.chartService.columns();
2598
+ this.currentColumns = columns;
2599
+ this.currentData = data;
2600
+ this.processAndUpdateData();
2601
+ });
2602
+ // Effect for chartOptionsConfig changes
2603
+ effect(() => {
2604
+ this.chartService.chartOptionsConfig();
2605
+ this.optionsConfig = this.chartService.chartOptionsConfig();
2606
+ this.reinitializeChart();
2607
+ });
2608
+ }
2609
+ ngOnInit() {
2610
+ if (this.currentData.length > 0) {
2611
+ this.processAndUpdateData();
2612
+ }
2613
+ }
2614
+ ngAfterViewInit() {
2615
+ this.initializeChart();
2616
+ if (this.currentData.length > 0) {
2617
+ this.updateChartWithData();
2618
+ }
2619
+ this.isLoading = false;
2620
+ this.cdr.markForCheck();
2621
+ }
2622
+ ngOnDestroy() {
2623
+ this.destroy$.next();
2624
+ this.destroy$.complete();
2625
+ this.chartService.hideContextMenu();
2626
+ this.disposeChart();
2627
+ if (this.chartInstance) {
2628
+ this.chartInstance.dispose(); // Clean up to free memory
2629
+ }
2630
+ if (this.chartContainer) {
2631
+ this.chartContainer.nativeElement.removeEventListener('contextmenu', this.boundHandleContextMenu);
2632
+ }
2633
+ document.removeEventListener('click', () => {
2634
+ this.chartService.hideContextMenu();
2635
+ this.chartService.resetContextEvent();
2636
+ });
2637
+ }
2638
+ reinitializeChart() {
2639
+ this.initializeChart();
2640
+ if (this.currentData.length > 0) {
2641
+ this.updateChartWithData();
2642
+ }
2643
+ this.cdr.markForCheck();
2644
+ }
2645
+ initializeChart() {
2646
+ if (!this.chartContainer) {
2647
+ return;
2648
+ }
2649
+ const chartDom = this.chartContainer.nativeElement;
2650
+ chartDom.innerHTML = '';
2651
+ if (this.chartInstance) {
2652
+ this.chartInstance.dispose();
2653
+ this.chartInstance = null;
2654
+ }
2655
+ this.chartInstance = echarts.init(chartDom, this.chartService.theme()); // Init ECharts
2656
+ this.chartInstance.setOption({
2657
+ ...this.defaultConfig,
2658
+ ...this.optionsConfig,
2659
+ title: {
2660
+ ...this.defaultConfig.title,
2661
+ ...this.optionsConfig.title,
2662
+ textStyle: {
2663
+ ...this.defaultConfig.title?.textStyle,
2664
+ ...this.optionsConfig.title?.textStyle,
2665
+ },
2666
+ },
2667
+ tooltip: {
2668
+ ...this.defaultConfig.tooltip,
2669
+ ...this.optionsConfig.tooltip,
2670
+ },
2671
+ legend: { ...this.defaultConfig.legend, ...this.optionsConfig.legend },
2672
+ dataZoom: this.optionsConfig.dataZoom || this.defaultConfig.dataZoom,
2673
+ grid: {
2674
+ ...this.defaultConfig.grid,
2675
+ ...this.optionsConfig.grid,
2676
+ },
2677
+ xAxis: {
2678
+ ...this.defaultConfig.xAxis,
2679
+ ...this.optionsConfig.xAxis,
2680
+ data: [],
2681
+ },
2682
+ yAxis: {
2683
+ ...this.defaultConfig.yAxis,
2684
+ ...this.optionsConfig.yAxis,
2685
+ },
2686
+ series: [],
2687
+ });
2688
+ // Responsive: Resize on window change
2689
+ window.addEventListener('resize', () => this.chartInstance?.resize(), { passive: true });
2690
+ // Handle dataZoom events (optional: Log zoom changes)
2691
+ this.chartInstance.on('dataZoom', (params) => {
2692
+ // console.log('Zoomed to:', params.start, params.end);
2693
+ });
2694
+ this.chartInstance.on('rendered', () => {
2695
+ // console.log('Chart rendered successfully');
2696
+ });
2697
+ this.chartInstance.on('click', (params) => {
2698
+ this.chartService.hideContextMenu();
2699
+ this.chartService.resetContextEvent();
2700
+ this.chartService.handleClick(params);
2701
+ });
2702
+ this.chartInstance.on('contextmenu', (params) => {
2703
+ this.chartService.openContextMenu(params, this.chartContainer);
2704
+ });
2705
+ chartDom.addEventListener('contextmenu', this.boundHandleContextMenu);
2706
+ document.addEventListener('click', () => {
2707
+ this.chartService.hideContextMenu();
2708
+ this.chartService.resetContextEvent();
2709
+ }, {
2710
+ passive: true,
2711
+ });
2712
+ this.isLoading = false;
2713
+ this.cdr.markForCheck();
2714
+ }
2715
+ handleContextMenu(event) {
2716
+ event.preventDefault();
2717
+ setTimeout(() => {
2718
+ if (!this.chartService.contextMenuEvent().seriesName) {
2719
+ this.chartService.openContextMenu(null, this.chartContainer, event);
2720
+ }
2721
+ }, 0);
2722
+ }
2723
+ updateChartWithData() {
2724
+ this.processData(); // Process without updating yet
2725
+ if (this.chartInstance) {
2726
+ const updatedOptions = {
2727
+ xAxis: { data: this.getProcessedCategories() },
2728
+ series: this.getProcessedValues(),
2729
+ };
2730
+ this.chartInstance.setOption(updatedOptions, {
2731
+ notMerge: false,
2732
+ lazyUpdate: true,
2733
+ silent: false,
2734
+ replaceMerge: ['series'],
2735
+ });
2736
+ }
2737
+ }
2738
+ processedData = [];
2739
+ processedColumns = [];
2740
+ getProcessedCategories() {
2741
+ return this.processedData.map((d) => d[0]);
2742
+ }
2743
+ getProcessedValues() {
2744
+ const columnData = this.processedColumns.slice(1);
2745
+ return columnData.map((c, i) => {
2746
+ const seriesData = this.processedData.map((d) => d[i + 1]);
2747
+ return {
2748
+ name: c,
2749
+ type: 'bar',
2750
+ data: seriesData, // Populated dynamically
2751
+ barWidth: 'auto', // Auto-adjust for density
2752
+ large: true, // Enable large mode: Canvas rendering for 50k+ efficiency
2753
+ largeThreshold: 5000, // Start large mode at 5k points
2754
+ progressive: 300, // Render 300 bars per chunk (tune for your hardware)
2755
+ progressiveChunkMode: 'sequential', // Sequential rendering for smooth init
2756
+ progressiveThreshold: 5000, // Apply progressive above 5k
2757
+ animation: true, // Disable initial animation for faster load on large data (re-enable for updates)
2758
+ itemStyle: {
2759
+ // color: '#5470c6', // Bar color
2760
+ // shadowBlur: 0, // Reduce shadows for perf
2761
+ },
2762
+ // emphasis: {
2763
+ // // Hover highlight (lightweight)
2764
+ // focus: 'series',
2765
+ // itemStyle: { opacity: 0.8 },
2766
+ // },
2767
+ };
2768
+ });
2769
+ }
2770
+ processData() {
2771
+ let dataToProcess = this.currentData;
2772
+ if (this.enableSampling && this.currentData.length > this.sampleThreshold) {
2773
+ const step = Math.ceil(this.currentData.length / this.sampleThreshold);
2774
+ dataToProcess = this.currentData.filter((_, index) => index % step === 0);
2775
+ console.warn(`Sampled data from ${this.currentData.length} to ${dataToProcess.length} points.`);
2776
+ }
2777
+ this.processedData = dataToProcess; // Cache processed
2778
+ this.processedColumns = this.currentColumns;
2779
+ }
2780
+ processAndUpdateData() {
2781
+ this.processData();
2782
+ if (this.chartInstance) {
2783
+ this.updateChartWithData();
2784
+ }
2785
+ }
2786
+ handleResize() {
2787
+ if (this.chartInstance) {
2788
+ this.chartInstance.resize();
2789
+ }
2790
+ }
2791
+ disposeChart() {
2792
+ if (this.chartInstance) {
2793
+ this.chartInstance.dispose();
2794
+ this.chartInstance.off('click');
2795
+ this.chartInstance = null;
2796
+ // console.log('ECharts instance disposed');
2797
+ }
2798
+ window.removeEventListener('resize', this.handleResize.bind(this));
2799
+ }
2800
+ // Public method: Update data externally (e.g., from API)
2801
+ updateData(newData) {
2802
+ this.currentData = newData;
2803
+ this.processAndUpdateData();
2804
+ }
2805
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: BarChart, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2806
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: BarChart, isStandalone: true, selector: "lib-bar-chart", inputs: { title: "title", height: "height", enableSampling: "enableSampling", sampleThreshold: "sampleThreshold", isLoading: "isLoading" }, viewQueries: [{ propertyName: "chartContainer", first: true, predicate: ["barChartContainer"], descendants: true }], ngImport: i0, template: "<div #barChartContainer style=\"width: 100%; height: 100%\"></div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2807
+ }
2808
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: BarChart, decorators: [{
2809
+ type: Component,
2810
+ args: [{ selector: 'lib-bar-chart', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #barChartContainer style=\"width: 100%; height: 100%\"></div>\n" }]
2811
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { title: [{
2812
+ type: Input
2813
+ }], height: [{
2814
+ type: Input
2815
+ }], enableSampling: [{
2816
+ type: Input
2817
+ }], sampleThreshold: [{
2818
+ type: Input
2819
+ }], isLoading: [{
2820
+ type: Input
2821
+ }], chartContainer: [{
2822
+ type: ViewChild,
2823
+ args: ['barChartContainer', { static: false }]
2824
+ }] } });
2825
+
2826
+ class LineChart {
2827
+ cdr;
2828
+ title = '';
2829
+ height = '600px';
2830
+ enableSampling = true; // Sample data if > threshold for perf
2831
+ sampleThreshold = 10000; // Sample if data > 10k (keep full for 50k if hardware allows)
2832
+ isLoading = true;
2833
+ chartContainer;
2834
+ chartInstance = null;
2835
+ destroy$ = new Subject();
2836
+ chartService = inject(ChartService);
2837
+ currentData = [];
2838
+ currentColumns = [];
2839
+ // ECharts options optimized for 50k+ data
2840
+ chartOptions = {
2841
+ title: {
2842
+ text: this.title,
2843
+ left: 'center',
2844
+ textStyle: { fontSize: 16 },
2845
+ },
2846
+ tooltip: {
2847
+ // Hover info (efficient for large data)
2848
+ trigger: 'axis',
2849
+ axisPointer: { type: 'shadow' },
2850
+ // formatter: (params = [{ name: '', value: '' }]) => {
2851
+ // const param = params[0];
2852
+ // return `${param.name}<br/>Value: ${param.value}`;
2853
+ // },
2854
+ },
2855
+ legend: { show: false }, // Disable for single series; add if multi-series
2856
+ dataZoom: [
2857
+ // Critical for large data: Zoom/slider to navigate 50k data points
2858
+ {
2859
+ type: 'slider', // Bottom slider
2860
+ start: 0,
2861
+ end: 100, // Initial view: First 10% (e.g., 5k of 50k)
2862
+ height: 25,
2863
+ bottom: 20,
2864
+ textStyle: { fontSize: 12 },
2865
+ },
2866
+ {
2867
+ type: 'inside', // Mouse wheel/pinch zoom
2868
+ start: 0,
2869
+ end: 10,
2870
+ },
2871
+ ],
2872
+ grid: {
2873
+ left: '5%',
2874
+ right: '5%',
2875
+ bottom: '80px', // Space for dataZoom slider
2876
+ containLabel: true,
2877
+ },
2878
+ xAxis: {
2879
+ type: 'category',
2880
+ data: [], // Populated dynamically
2881
+ axisLabel: { rotate: 45, fontSize: 10 },
2882
+ axisTick: { show: false },
2883
+ },
2884
+ yAxis: {
2885
+ type: 'value',
2886
+ axisLabel: { fontSize: 12 },
2887
+ },
2888
+ series: [],
2889
+ };
2890
+ constructor(cdr) {
2891
+ this.cdr = cdr;
2892
+ // Effect for theme changes
2893
+ effect(() => {
2894
+ const theme = this.chartService.theme(); // Read signal
2895
+ if (this.chartInstance) {
2896
+ this.reinitializeChart();
2897
+ }
2898
+ });
2899
+ // Effect for data changes
2900
+ effect(() => {
2901
+ const data = this.chartService.data(); // Read signal
2902
+ const columns = this.chartService.columns();
2903
+ this.currentColumns = columns;
2904
+ this.currentData = data;
2905
+ this.processAndUpdateData();
2906
+ });
2907
+ }
2908
+ ngOnInit() {
2909
+ if (this.currentData.length > 0) {
2910
+ this.processAndUpdateData();
2911
+ }
2912
+ }
2913
+ ngAfterViewInit() {
2914
+ this.initializeChart();
2915
+ if (this.currentData.length > 0) {
2916
+ this.updateChartWithData();
2917
+ }
2918
+ this.isLoading = false;
2919
+ this.cdr.markForCheck();
2920
+ }
2921
+ ngOnDestroy() {
2922
+ this.destroy$.next();
2923
+ this.destroy$.complete();
2924
+ this.disposeChart();
2925
+ if (this.chartInstance) {
2926
+ this.chartInstance.dispose(); // Clean up to free memory
2927
+ }
2928
+ }
2929
+ reinitializeChart() {
2930
+ this.initializeChart();
2931
+ if (this.currentData.length > 0) {
2932
+ this.updateChartWithData();
2933
+ }
2934
+ this.cdr.markForCheck();
2935
+ }
2936
+ initializeChart() {
2937
+ if (!this.chartContainer) {
2938
+ console.error('Chart container not found!');
2939
+ return;
2940
+ }
2941
+ const chartDom = this.chartContainer.nativeElement;
2942
+ chartDom.innerHTML = '';
2943
+ if (this.chartInstance) {
2944
+ this.chartInstance.dispose();
2945
+ this.chartInstance = null;
2946
+ }
2947
+ this.chartInstance = echarts.init(chartDom, this.chartService.theme()); // Init ECharts
2948
+ this.chartInstance.setOption(this.chartOptions);
2949
+ // Responsive: Resize on window change
2950
+ window.addEventListener('resize', () => this.chartInstance?.resize(), { passive: true });
2951
+ // Handle dataZoom events (optional: Log zoom changes)
2952
+ this.chartInstance.on('dataZoom', (params) => {
2953
+ // console.log('Zoomed to:', params.start, params.end);
2954
+ });
2955
+ this.chartInstance.on('rendered', () => {
2956
+ // console.log('Chart rendered successfully');
2957
+ });
2958
+ this.isLoading = false;
2959
+ this.cdr.markForCheck();
2960
+ }
2961
+ updateChartWithData() {
2962
+ this.processData(); // Process without updating yet
2963
+ if (this.chartInstance) {
2964
+ const updatedOptions = {
2965
+ xAxis: { data: this.getProcessedCategories() },
2966
+ series: this.getProcessedValues(),
2967
+ };
2968
+ this.chartInstance.setOption(updatedOptions, {
2969
+ notMerge: false,
2970
+ lazyUpdate: true,
2971
+ silent: false,
2972
+ replaceMerge: ['series'],
2973
+ });
2974
+ }
2975
+ }
2976
+ processedData = [];
2977
+ processedColumns = [];
2978
+ getProcessedCategories() {
2979
+ return this.processedData.map((d) => d[0]);
2980
+ }
2981
+ getProcessedValues() {
2982
+ const columnData = this.processedColumns.slice(1);
2983
+ return columnData.map((c, i) => {
2984
+ const seriesData = this.processedData.map((d) => d[i + 1]);
2985
+ return {
2986
+ name: c,
2987
+ type: 'line',
2988
+ data: seriesData, // Populated dynamically
2989
+ large: true, // Enable large mode: Canvas rendering for 50k+ efficiency
2990
+ largeThreshold: 5000, // Start large mode at 5k points
2991
+ progressive: 300, // Render 300 points per chunk (tune for your hardware)
2992
+ progressiveChunkMode: 'sequential', // Sequential rendering for smooth init
2993
+ progressiveThreshold: 5000, // Apply progressive above 5k
2994
+ animation: true, // Disable initial animation for faster load on large data (re-enable for updates)
2995
+ itemStyle: {
2996
+ // color: '#5470c6', // line color
2997
+ // shadowBlur: 0, // Reduce shadows for perf
2998
+ },
2999
+ // emphasis: {
3000
+ // // Hover highlight (lightweight)
3001
+ // focus: 'series',
3002
+ // itemStyle: { opacity: 0.8 },
3003
+ // },
3004
+ };
3005
+ });
3006
+ }
3007
+ processData() {
3008
+ let dataToProcess = this.currentData;
3009
+ if (this.enableSampling && this.currentData.length > this.sampleThreshold) {
3010
+ const step = Math.ceil(this.currentData.length / this.sampleThreshold);
3011
+ dataToProcess = this.currentData.filter((_, index) => index % step === 0);
3012
+ console.warn(`Sampled data from ${this.currentData.length} to ${dataToProcess.length} points.`);
3013
+ }
3014
+ this.processedData = dataToProcess; // Cache processed
3015
+ this.processedColumns = this.currentColumns;
3016
+ }
3017
+ processAndUpdateData() {
3018
+ this.processData();
3019
+ if (this.chartInstance) {
3020
+ this.updateChartWithData();
3021
+ }
3022
+ }
3023
+ handleResize() {
3024
+ if (this.chartInstance) {
3025
+ this.chartInstance.resize();
3026
+ }
3027
+ }
3028
+ disposeChart() {
3029
+ if (this.chartInstance) {
3030
+ this.chartInstance.dispose();
3031
+ this.chartInstance = null;
3032
+ // console.log('ECharts instance disposed');
3033
+ }
3034
+ window.removeEventListener('resize', this.handleResize.bind(this));
3035
+ }
3036
+ // Public method: Update data externally (e.g., from API)
3037
+ updateData(newData) {
3038
+ this.currentData = newData;
3039
+ this.processAndUpdateData();
3040
+ }
3041
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: LineChart, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3042
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: LineChart, isStandalone: true, selector: "lib-line-chart", inputs: { title: "title", height: "height", enableSampling: "enableSampling", sampleThreshold: "sampleThreshold", isLoading: "isLoading" }, viewQueries: [{ propertyName: "chartContainer", first: true, predicate: ["lineChartContainer"], descendants: true }], ngImport: i0, template: "<div #lineChartContainer style=\"width: 100%; height: 100%\"></div>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3043
+ }
3044
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: LineChart, decorators: [{
3045
+ type: Component,
3046
+ args: [{ selector: 'lib-line-chart', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #lineChartContainer style=\"width: 100%; height: 100%\"></div>\n" }]
3047
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { title: [{
3048
+ type: Input
3049
+ }], height: [{
3050
+ type: Input
3051
+ }], enableSampling: [{
3052
+ type: Input
3053
+ }], sampleThreshold: [{
3054
+ type: Input
3055
+ }], isLoading: [{
3056
+ type: Input
3057
+ }], chartContainer: [{
3058
+ type: ViewChild,
3059
+ args: ['lineChartContainer', { static: false }]
3060
+ }] } });
3061
+
3062
+ class AreaChart {
3063
+ cdr;
3064
+ title = '';
3065
+ height = '600px';
3066
+ enableSampling = true; // Sample data if > threshold for perf
3067
+ sampleThreshold = 10000; // Sample if data > 10k (keep full for 50k if hardware allows)
3068
+ isLoading = true;
3069
+ chartContainer;
3070
+ chartInstance = null;
3071
+ chartService = inject(ChartService);
3072
+ destroy$ = new Subject();
3073
+ currentData = [];
3074
+ currentColumns = [];
3075
+ // ECharts options optimized for 50k+ data
3076
+ chartOptions = {
3077
+ title: {
3078
+ text: this.title,
3079
+ left: 'center',
3080
+ textStyle: { fontSize: 16 },
3081
+ },
3082
+ tooltip: {
3083
+ // Hover info (efficient for large data)
3084
+ trigger: 'axis',
3085
+ axisPointer: { type: 'shadow' },
3086
+ // formatter: (params = [{ name: '', value: '' }]) => {
3087
+ // const param = params[0];
3088
+ // return `${param.name}<br/>Value: ${param.value}`;
3089
+ // },
3090
+ },
3091
+ legend: { show: false }, // Disable for single series; add if multi-series
3092
+ dataZoom: [
3093
+ // Critical for large data: Zoom/slider to navigate 50k data points
3094
+ {
3095
+ type: 'slider', // Bottom slider
3096
+ start: 0,
3097
+ end: 100, // Initial view: First 10% (e.g., 5k of 50k)
3098
+ height: 25,
3099
+ bottom: 20,
3100
+ textStyle: { fontSize: 12 },
3101
+ },
3102
+ {
3103
+ type: 'inside', // Mouse wheel/pinch zoom
3104
+ start: 0,
3105
+ end: 10,
3106
+ },
3107
+ ],
3108
+ grid: {
3109
+ left: '5%',
3110
+ right: '5%',
3111
+ bottom: '80px', // Space for dataZoom slider
3112
+ containLabel: true,
3113
+ },
3114
+ xAxis: {
3115
+ type: 'category',
3116
+ data: [], // Populated dynamically
3117
+ axisLabel: { rotate: 45, fontSize: 10 },
3118
+ axisTick: { show: false },
3119
+ },
3120
+ yAxis: {
3121
+ type: 'value',
3122
+ axisLabel: { fontSize: 12 },
3123
+ },
3124
+ series: [],
3125
+ };
3126
+ constructor(cdr) {
3127
+ this.cdr = cdr;
3128
+ effect(() => {
3129
+ const theme = this.chartService.theme(); // Read signal
3130
+ if (this.chartInstance) {
3131
+ this.reinitializeChart();
3132
+ }
3133
+ });
3134
+ // Effect for data changes
3135
+ effect(() => {
3136
+ const data = this.chartService.data(); // Read signal
3137
+ const columns = this.chartService.columns();
3138
+ this.currentColumns = columns;
3139
+ this.currentData = data;
3140
+ this.processAndUpdateData();
3141
+ });
3142
+ }
3143
+ ngOnInit() {
3144
+ if (this.currentData.length > 0) {
3145
+ this.processAndUpdateData();
3146
+ }
3147
+ }
3148
+ ngAfterViewInit() {
3149
+ this.initializeChart();
3150
+ if (this.currentData.length > 0) {
3151
+ this.updateChartWithData();
3152
+ }
3153
+ this.isLoading = false;
3154
+ this.cdr.markForCheck();
3155
+ }
3156
+ ngOnDestroy() {
3157
+ this.destroy$.next();
3158
+ this.destroy$.complete();
3159
+ this.disposeChart();
3160
+ if (this.chartInstance) {
3161
+ this.chartInstance.dispose(); // Clean up to free memory
3162
+ }
3163
+ }
3164
+ reinitializeChart() {
3165
+ this.initializeChart();
3166
+ if (this.currentData.length > 0) {
3167
+ this.updateChartWithData();
3168
+ }
3169
+ this.cdr.markForCheck();
3170
+ }
3171
+ initializeChart() {
3172
+ if (!this.chartContainer) {
3173
+ console.error('Chart container not found!');
3174
+ return;
3175
+ }
3176
+ const chartDom = this.chartContainer.nativeElement;
3177
+ chartDom.innerHTML = '';
3178
+ if (this.chartInstance) {
3179
+ this.chartInstance.dispose();
3180
+ this.chartInstance = null;
3181
+ }
3182
+ this.chartInstance = echarts.init(chartDom, this.chartService.theme()); // Init ECharts
3183
+ this.chartInstance.setOption(this.chartOptions);
3184
+ // Responsive: Resize on window change
3185
+ window.addEventListener('resize', () => this.chartInstance?.resize(), { passive: true });
3186
+ // Handle dataZoom events (optional: Log zoom changes)
3187
+ this.chartInstance.on('dataZoom', (params) => {
3188
+ // console.log('Zoomed to:', params.start, params.end);
3189
+ });
3190
+ this.chartInstance.on('rendered', () => {
3191
+ // console.log('Chart rendered successfully');
3192
+ });
3193
+ this.isLoading = false;
3194
+ this.cdr.markForCheck();
3195
+ }
3196
+ updateChartWithData() {
3197
+ this.processData(); // Process without updating yet
3198
+ if (this.chartInstance) {
3199
+ const updatedOptions = {
3200
+ xAxis: { data: this.getProcessedCategories() },
3201
+ series: this.getProcessedValues(),
3202
+ };
3203
+ this.chartInstance.setOption(updatedOptions, {
3204
+ notMerge: false,
3205
+ lazyUpdate: true,
3206
+ silent: false,
3207
+ replaceMerge: ['series'],
3208
+ });
3209
+ }
3210
+ }
3211
+ processedData = [];
3212
+ processedColumns = [];
3213
+ getProcessedCategories() {
3214
+ return this.processedData.map((d) => d[0]);
3215
+ }
3216
+ getProcessedValues() {
3217
+ const columnData = this.processedColumns.slice(1);
3218
+ return columnData.map((c, i) => {
3219
+ const seriesData = this.processedData.map((d) => d[i + 1]);
3220
+ return {
3221
+ name: c,
3222
+ type: 'line',
3223
+ data: seriesData, // Populated dynamically
3224
+ large: true, // Enable large mode: Canvas rendering for 50k+ efficiency
3225
+ largeThreshold: 5000, // Start large mode at 5k points
3226
+ progressive: 300, // Render 300 points per chunk (tune for your hardware)
3227
+ progressiveChunkMode: 'sequential', // Sequential rendering for smooth init
3228
+ progressiveThreshold: 5000, // Apply progressive above 5k
3229
+ animation: true, // Disable initial animation for faster load on large data (re-enable for updates)
3230
+ itemStyle: {
3231
+ // color: '#5470c6', // line color
3232
+ // shadowBlur: 0, // Reduce shadows for perf
3233
+ },
3234
+ areaStyle: { opacity: 0.2 },
3235
+ // emphasis: {
3236
+ // // Hover highlight (lightweight)
3237
+ // focus: 'series',
3238
+ // itemStyle: { opacity: 0.8 },
3239
+ // },
3240
+ };
3241
+ });
3242
+ }
3243
+ processData() {
3244
+ let dataToProcess = this.currentData;
3245
+ if (this.enableSampling && this.currentData.length > this.sampleThreshold) {
3246
+ const step = Math.ceil(this.currentData.length / this.sampleThreshold);
3247
+ dataToProcess = this.currentData.filter((_, index) => index % step === 0);
3248
+ console.warn(`Sampled data from ${this.currentData.length} to ${dataToProcess.length} points.`);
3249
+ }
3250
+ this.processedData = dataToProcess; // Cache processed
3251
+ this.processedColumns = this.currentColumns;
3252
+ }
3253
+ processAndUpdateData() {
3254
+ this.processData();
3255
+ if (this.chartInstance) {
3256
+ this.updateChartWithData();
3257
+ }
3258
+ }
3259
+ handleResize() {
3260
+ if (this.chartInstance) {
3261
+ this.chartInstance.resize();
3262
+ }
3263
+ }
3264
+ disposeChart() {
3265
+ if (this.chartInstance) {
3266
+ this.chartInstance.dispose();
3267
+ this.chartInstance = null;
3268
+ // console.log('ECharts instance disposed');
3269
+ }
3270
+ window.removeEventListener('resize', this.handleResize.bind(this));
3271
+ }
3272
+ // Public method: Update data externally (e.g., from API)
3273
+ updateData(newData) {
3274
+ this.currentData = newData;
3275
+ this.processAndUpdateData();
3276
+ }
3277
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AreaChart, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3278
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: AreaChart, isStandalone: true, selector: "lib-area-chart", inputs: { title: "title", height: "height", enableSampling: "enableSampling", sampleThreshold: "sampleThreshold", isLoading: "isLoading" }, viewQueries: [{ propertyName: "chartContainer", first: true, predicate: ["areaChartContainer"], descendants: true }], ngImport: i0, template: "<div #areaChartContainer style=\"width: 100%; height: 100%\"></div>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3279
+ }
3280
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AreaChart, decorators: [{
3281
+ type: Component,
3282
+ args: [{ selector: 'lib-area-chart', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #areaChartContainer style=\"width: 100%; height: 100%\"></div>\n" }]
3283
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { title: [{
3284
+ type: Input
3285
+ }], height: [{
3286
+ type: Input
3287
+ }], enableSampling: [{
3288
+ type: Input
3289
+ }], sampleThreshold: [{
3290
+ type: Input
3291
+ }], isLoading: [{
3292
+ type: Input
3293
+ }], chartContainer: [{
3294
+ type: ViewChild,
3295
+ args: ['areaChartContainer', { static: false }]
3296
+ }] } });
3297
+
3298
+ class ChartsLib {
3299
+ chartService;
3300
+ differs;
3301
+ container;
3302
+ chartType;
3303
+ columns = [];
3304
+ data = [];
3305
+ themeName = 'default';
3306
+ chartOptionsConfig = {};
3307
+ contextMenuList = [];
3308
+ handleSingleClick = new EventEmitter();
3309
+ handleDrillBy = new EventEmitter();
3310
+ optionsConfigDiffer;
3311
+ componentRef = null;
3312
+ constructor(chartService, differs) {
3313
+ this.chartService = chartService;
3314
+ this.differs = differs;
3315
+ effect(() => {
3316
+ if (this.chartService.clickEvent().seriesName) {
3317
+ this.handleSingleClick.emit(this.chartService.clickEvent());
3318
+ }
3319
+ });
3320
+ effect(() => {
3321
+ if (this.chartService.drillByConfig().seriesName) {
3322
+ this.handleDrillBy.emit(this.chartService.drillByConfig());
3323
+ }
3324
+ });
3325
+ }
3326
+ ngOnInit() {
3327
+ this.optionsConfigDiffer = this.differs.find(this.chartOptionsConfig).create();
3328
+ }
3329
+ ngAfterViewInit() {
3330
+ this.loadComponent();
3331
+ }
3332
+ ngOnChanges(changes) {
3333
+ if (changes['chartType']) {
3334
+ this.loadComponent();
3335
+ }
3336
+ if (changes['themeName'] && this.componentRef) {
3337
+ this.chartService.setTheme(this.themeName);
3338
+ }
3339
+ if (changes['data']) {
3340
+ this.chartService.setData(this.data);
3341
+ }
3342
+ if (changes['columns']) {
3343
+ this.chartService.setColumns(this.columns);
3344
+ }
3345
+ if (changes['contextMenuList']) {
3346
+ this.chartService.setContextMenuList(this.contextMenuList);
3347
+ }
3348
+ }
3349
+ ngDoCheck() {
3350
+ if (this.chartOptionsConfig) {
3351
+ const changes = this.optionsConfigDiffer.diff(this.chartOptionsConfig);
3352
+ if (changes) {
3353
+ this.chartService.setChartOptionsConfig({ ...this.chartOptionsConfig });
3354
+ }
3355
+ }
3356
+ }
3357
+ loadComponent() {
3358
+ if (!this.container) {
3359
+ return;
3360
+ }
3361
+ if (this.componentRef) {
3362
+ this.componentRef.destroy();
3363
+ }
3364
+ const componentType = this.getComponentType();
3365
+ if (componentType) {
3366
+ this.componentRef = this.container.createComponent(componentType);
3367
+ }
3368
+ }
3369
+ getComponentType() {
3370
+ switch (this.chartType) {
3371
+ case 'bar':
3372
+ return BarChart;
3373
+ case 'line':
3374
+ return LineChart;
3375
+ case 'area':
3376
+ return AreaChart;
3377
+ default:
3378
+ return null;
3379
+ }
3380
+ }
3381
+ ngOnDestroy() {
3382
+ if (this.componentRef) {
3383
+ this.componentRef.destroy();
3384
+ }
3385
+ }
3386
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ChartsLib, deps: [{ token: ChartService }, { token: i0.KeyValueDiffers }], target: i0.ɵɵFactoryTarget.Component });
3387
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: ChartsLib, isStandalone: true, selector: "lib-charts-lib", inputs: { chartType: "chartType", columns: "columns", data: "data", themeName: "themeName", chartOptionsConfig: "chartOptionsConfig", contextMenuList: "contextMenuList" }, outputs: { handleSingleClick: "handleSingleClick", handleDrillBy: "handleDrillBy" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["chartContainer"], descendants: true, read: ViewContainerRef }], usesOnChanges: true, ngImport: i0, template: "<ng-template #chartContainer></ng-template>\n", styles: [""] });
3388
+ }
3389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ChartsLib, decorators: [{
3390
+ type: Component,
3391
+ args: [{ selector: 'lib-charts-lib', imports: [], template: "<ng-template #chartContainer></ng-template>\n" }]
3392
+ }], ctorParameters: () => [{ type: ChartService }, { type: i0.KeyValueDiffers }], propDecorators: { container: [{
3393
+ type: ViewChild,
3394
+ args: ['chartContainer', { read: ViewContainerRef }]
3395
+ }], chartType: [{
3396
+ type: Input
3397
+ }], columns: [{
3398
+ type: Input
3399
+ }], data: [{
3400
+ type: Input
3401
+ }], themeName: [{
3402
+ type: Input
3403
+ }], chartOptionsConfig: [{
3404
+ type: Input
3405
+ }], contextMenuList: [{
3406
+ type: Input
3407
+ }], handleSingleClick: [{
3408
+ type: Output
3409
+ }], handleDrillBy: [{
3410
+ type: Output
3411
+ }] } });
3412
+
3413
+ /**
3414
+ * Generated bundle index. Do not edit.
3415
+ */
3416
+
3417
+ export { ChartsLib, ChartsLibType, ClickEvent, ContextMenuListItem, OptionsConfig };
3418
+ //# sourceMappingURL=charts-lib.mjs.map