@kiwibit/chart 20.0.1 → 21.0.0
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.
|
@@ -38,6 +38,7 @@ const ZOOM_OUT = "M41.25 39.35 29.55 27.7q-1.5 1.25-3.525 1.975Q24 30.4 22.05 30
|
|
|
38
38
|
const SAVE_AS_SVG = "M11.3 40.05q-1.35 0-2.35-1t-1-2.35V11.3q0-1.4 1-2.375 1-.975 2.35-.975h25.4q1.4 0 2.375.975.975.975.975 2.375v25.4q0 1.35-.975 2.35t-2.375 1Zm0-1.75h25.4q.6 0 1.1-.5.5-.5.5-1.1V11.3q0-.6-.5-1.1-.5-.5-1.1-.5H11.3q-.6 0-1.1.5-.5.5-.5 1.1v25.4q0 .6.5 1.1.5.5 1.1.5Zm4.1-5.15h17.65l-5.5-7.3-5.2 6.45-3.3-3.85ZM9.7 38.3V9.7v28.6Z";
|
|
39
39
|
const RESTORE = "M24.2 25.65q-.65 0-1.125-.475T22.6 24q0-.7.475-1.2t1.175-.5q.65 0 1.175.525T25.95 24q0 .7-.55 1.175-.55.475-1.2.475Zm.1 14.55q-6.4 0-11.1-4.25Q8.5 31.7 8.1 25.4h1.8q.5 5.55 4.6 9.3 4.1 3.75 9.75 3.75 6.05 0 10.225-4.225T38.65 24.05q0-6.05-4.2-10.275Q30.25 9.55 24.3 9.55q-3.2 0-6.025 1.3t-4.875 3.6h4.95v1.75H10.4v-8h1.75v5.05q2.25-2.6 5.475-4.025Q20.85 7.8 24.3 7.8q3.3 0 6.225 1.25t5.125 3.475q2.2 2.225 3.475 5.175Q40.4 20.65 40.4 24q0 3.35-1.275 6.3-1.275 2.95-3.475 5.175-2.2 2.225-5.125 3.475T24.3 40.2Z";
|
|
40
40
|
const ADD_POINT = "M222.895-189.538q-22.456 0-37.906-15.451-15.451-15.45-15.451-37.906v-474.21q0-22.456 15.451-37.906 15.45-15.451 38.088-15.451h322.346v28.924H223.077q-10.769 0-17.692 6.923t-6.923 17.692v473.846q0 10.769 6.923 17.692t17.692 6.923h473.846q10.77 0 17.693-6.923 6.923-6.923 6.923-17.692v-322.346h28.923v322.346q0 22.638-15.451 38.088-15.45 15.451-37.906 15.451h-474.21Zm78.028-121.539h28.923v-243.077h-28.923v243.077Zm144.923 0h28.923v-337.846h-28.923v337.846Zm144.308 0h28.923v-148.308h-28.923v148.308Zm100-327.692v-71.385h-71.385v-28.923h71.385v-71.385h28.923v71.385h71.385v28.923h-71.385v71.385h-28.923ZM460-480Z";
|
|
41
|
+
const highlightColor = '#98BD13';
|
|
41
42
|
|
|
42
43
|
// Angular Imports
|
|
43
44
|
echarts.use([
|
|
@@ -52,6 +53,78 @@ echarts.use([
|
|
|
52
53
|
ToolboxComponent,
|
|
53
54
|
]);
|
|
54
55
|
class KiwiChartDirective {
|
|
56
|
+
el;
|
|
57
|
+
/**
|
|
58
|
+
* The Chart Object rendered by the canvas. For all the available options refer
|
|
59
|
+
* to Chart interface in the models folder.
|
|
60
|
+
*
|
|
61
|
+
* @type {(Chart | null)}
|
|
62
|
+
* @memberof KiwiChartDirective
|
|
63
|
+
*/
|
|
64
|
+
chart = null;
|
|
65
|
+
/**
|
|
66
|
+
* Width and Height of the chart area. The dimensions refer to the father component
|
|
67
|
+
* into which the kiwi-chart is inserted. For example in an empty page the width/height
|
|
68
|
+
* of the chart can take the whole available space in the page.
|
|
69
|
+
*
|
|
70
|
+
* @type {string}
|
|
71
|
+
* @memberof KiwiChartDirective
|
|
72
|
+
*/
|
|
73
|
+
width = '100%';
|
|
74
|
+
height = '480px';
|
|
75
|
+
chartInit = new EventEmitter();
|
|
76
|
+
/**
|
|
77
|
+
* Output event used to emit to the father component the coordinates
|
|
78
|
+
* of the point clicked in the chart area. This functionality to be used must
|
|
79
|
+
* have the property "clickToAddPoint" in the Chart object set to true.
|
|
80
|
+
*
|
|
81
|
+
* @type {EventEmitter<BasePoint>}
|
|
82
|
+
* @memberof KiwiChartDirective
|
|
83
|
+
*/
|
|
84
|
+
addPoint = new EventEmitter();
|
|
85
|
+
/**
|
|
86
|
+
* When the cursor hovers the chart area it emits to the father component the
|
|
87
|
+
* x and y coordinates relative to the chart reference system.
|
|
88
|
+
*
|
|
89
|
+
* @type {EventEmitter<BasePoint>}
|
|
90
|
+
* @memberof KiwiChartDirective
|
|
91
|
+
*/
|
|
92
|
+
chartHover = new EventEmitter();
|
|
93
|
+
/**
|
|
94
|
+
* This property simply activates or not the dark theme of the chart
|
|
95
|
+
* defined by the Echarts library. In addition the background color can be custom
|
|
96
|
+
* so that the chart can match the background of the application in which it's used.
|
|
97
|
+
*
|
|
98
|
+
* @type {boolean}
|
|
99
|
+
* @memberof KiwiChartDirective
|
|
100
|
+
*/
|
|
101
|
+
darkTheme = false;
|
|
102
|
+
darkThemeBackground = null;
|
|
103
|
+
/**
|
|
104
|
+
* The instance of the Chart.
|
|
105
|
+
*
|
|
106
|
+
* @type {ECharts}
|
|
107
|
+
* @memberof KiwiChartDirective
|
|
108
|
+
*/
|
|
109
|
+
echartsInstance = null;
|
|
110
|
+
/**
|
|
111
|
+
* Default number of decimals that can have
|
|
112
|
+
* the values on the x and y axes.
|
|
113
|
+
*
|
|
114
|
+
* @private
|
|
115
|
+
* @type {number}
|
|
116
|
+
* @memberof KiwiChartDirective
|
|
117
|
+
*/
|
|
118
|
+
MAX_DECIMALS = 3;
|
|
119
|
+
legendSelected = {};
|
|
120
|
+
isLegendClicked = false;
|
|
121
|
+
/**
|
|
122
|
+
* Used to perform actions (as point addition based on the cursor position) on the chart.
|
|
123
|
+
*
|
|
124
|
+
* @type {(zrender.ZRenderType | null)}
|
|
125
|
+
* @memberof KiwiChartComponent
|
|
126
|
+
*/
|
|
127
|
+
zr = null;
|
|
55
128
|
/**
|
|
56
129
|
* If you resize the page, the chart is automatically re-rendered wiht the right proportions.
|
|
57
130
|
*
|
|
@@ -64,77 +137,6 @@ class KiwiChartDirective {
|
|
|
64
137
|
}
|
|
65
138
|
constructor(el) {
|
|
66
139
|
this.el = el;
|
|
67
|
-
/**
|
|
68
|
-
* The Chart Object rendered by the canvas. For all the available options refer
|
|
69
|
-
* to Chart interface in the models folder.
|
|
70
|
-
*
|
|
71
|
-
* @type {(Chart | null)}
|
|
72
|
-
* @memberof KiwiChartDirective
|
|
73
|
-
*/
|
|
74
|
-
this.chart = null;
|
|
75
|
-
/**
|
|
76
|
-
* Width and Height of the chart area. The dimensions refer to the father component
|
|
77
|
-
* into which the kiwi-chart is inserted. For example in an empty page the width/height
|
|
78
|
-
* of the chart can take the whole available space in the page.
|
|
79
|
-
*
|
|
80
|
-
* @type {string}
|
|
81
|
-
* @memberof KiwiChartDirective
|
|
82
|
-
*/
|
|
83
|
-
this.width = '100%';
|
|
84
|
-
this.height = '480px';
|
|
85
|
-
this.chartInit = new EventEmitter();
|
|
86
|
-
/**
|
|
87
|
-
* Output event used to emit to the father component the coordinates
|
|
88
|
-
* of the point clicked in the chart area. This functionality to be used must
|
|
89
|
-
* have the property "clickToAddPoint" in the Chart object set to true.
|
|
90
|
-
*
|
|
91
|
-
* @type {EventEmitter<BasePoint>}
|
|
92
|
-
* @memberof KiwiChartDirective
|
|
93
|
-
*/
|
|
94
|
-
this.addPoint = new EventEmitter();
|
|
95
|
-
/**
|
|
96
|
-
* When the cursor hovers the chart area it emits to the father component the
|
|
97
|
-
* x and y coordinates relative to the chart reference system.
|
|
98
|
-
*
|
|
99
|
-
* @type {EventEmitter<BasePoint>}
|
|
100
|
-
* @memberof KiwiChartDirective
|
|
101
|
-
*/
|
|
102
|
-
this.chartHover = new EventEmitter();
|
|
103
|
-
/**
|
|
104
|
-
* This property simply activates or not the dark theme of the chart
|
|
105
|
-
* defined by the Echarts library. In addition the background color can be custom
|
|
106
|
-
* so that the chart can match the background of the application in which it's used.
|
|
107
|
-
*
|
|
108
|
-
* @type {boolean}
|
|
109
|
-
* @memberof KiwiChartDirective
|
|
110
|
-
*/
|
|
111
|
-
this.darkTheme = false;
|
|
112
|
-
this.darkThemeBackground = null;
|
|
113
|
-
/**
|
|
114
|
-
* The instance of the Chart.
|
|
115
|
-
*
|
|
116
|
-
* @type {ECharts}
|
|
117
|
-
* @memberof KiwiChartDirective
|
|
118
|
-
*/
|
|
119
|
-
this.echartsInstance = null;
|
|
120
|
-
/**
|
|
121
|
-
* Default number of decimals that can have
|
|
122
|
-
* the values on the x and y axes.
|
|
123
|
-
*
|
|
124
|
-
* @private
|
|
125
|
-
* @type {number}
|
|
126
|
-
* @memberof KiwiChartDirective
|
|
127
|
-
*/
|
|
128
|
-
this.MAX_DECIMALS = 3;
|
|
129
|
-
this.legendSelected = {};
|
|
130
|
-
this.isLegendClicked = false;
|
|
131
|
-
/**
|
|
132
|
-
* Used to perform actions (as point addition based on the cursor position) on the chart.
|
|
133
|
-
*
|
|
134
|
-
* @type {(zrender.ZRenderType | null)}
|
|
135
|
-
* @memberof KiwiChartComponent
|
|
136
|
-
*/
|
|
137
|
-
this.zr = null;
|
|
138
140
|
}
|
|
139
141
|
ngAfterViewInit() {
|
|
140
142
|
if (this.chart) {
|
|
@@ -161,6 +163,7 @@ class KiwiChartDirective {
|
|
|
161
163
|
this.echartsInstance.setOption({
|
|
162
164
|
title: {
|
|
163
165
|
text: chart.title,
|
|
166
|
+
left: 0
|
|
164
167
|
},
|
|
165
168
|
grid: {
|
|
166
169
|
id: 0,
|
|
@@ -188,7 +191,8 @@ class KiwiChartDirective {
|
|
|
188
191
|
emphasis: {
|
|
189
192
|
iconStyle: {
|
|
190
193
|
textPosition: 'top',
|
|
191
|
-
textPadding: 5
|
|
194
|
+
textPadding: 5,
|
|
195
|
+
borderColor: highlightColor
|
|
192
196
|
}
|
|
193
197
|
},
|
|
194
198
|
icon: {
|
|
@@ -224,8 +228,7 @@ class KiwiChartDirective {
|
|
|
224
228
|
const toolbox = option.toolbox;
|
|
225
229
|
if (toolbox) {
|
|
226
230
|
const status = toolbox[0].feature?.['myAddPoint']?.iconStatus;
|
|
227
|
-
const offColor = '
|
|
228
|
-
const highlightColor = 'rgb(62,152,197)';
|
|
231
|
+
const offColor = '#6578BA';
|
|
229
232
|
this.echartsInstance.setOption({
|
|
230
233
|
toolbox: {
|
|
231
234
|
feature: {
|
|
@@ -244,7 +247,8 @@ class KiwiChartDirective {
|
|
|
244
247
|
emphasis: {
|
|
245
248
|
iconStyle: {
|
|
246
249
|
textPosition: 'top',
|
|
247
|
-
textPadding: 5
|
|
250
|
+
textPadding: 5,
|
|
251
|
+
borderColor: highlightColor
|
|
248
252
|
}
|
|
249
253
|
}
|
|
250
254
|
}
|
|
@@ -279,6 +283,7 @@ class KiwiChartDirective {
|
|
|
279
283
|
show: chart.showLegend ?? false,
|
|
280
284
|
orient: 'vertical',
|
|
281
285
|
left: 'right',
|
|
286
|
+
top: 0,
|
|
282
287
|
padding: [60, 20],
|
|
283
288
|
type: 'scroll',
|
|
284
289
|
textStyle: {
|
|
@@ -416,8 +421,8 @@ class KiwiChartDirective {
|
|
|
416
421
|
let active = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;
|
|
417
422
|
if (active && this.chart?.clickToAddPoint) {
|
|
418
423
|
const pointInPixel = [params.offsetX, params.offsetY];
|
|
419
|
-
const pointInGrid = ec.convertFromPixel({
|
|
420
|
-
if (ec.containPixel({
|
|
424
|
+
const pointInGrid = ec.convertFromPixel({ gridIndex: 0 }, pointInPixel);
|
|
425
|
+
if (ec.containPixel({ gridIndex: 0 }, pointInPixel) && pointInGrid) {
|
|
421
426
|
let newPoint = {
|
|
422
427
|
x: +pointInGrid[0].toFixed(3),
|
|
423
428
|
y: +pointInGrid[1].toFixed(3)
|
|
@@ -431,12 +436,12 @@ class KiwiChartDirective {
|
|
|
431
436
|
*/
|
|
432
437
|
this.zr.on('mousemove', params => {
|
|
433
438
|
const pointInPixel = [params.offsetX, params.offsetY];
|
|
434
|
-
const pointInGrid = ec.convertFromPixel(
|
|
439
|
+
const pointInGrid = ec.convertFromPixel({ gridIndex: 0 }, pointInPixel);
|
|
435
440
|
/*
|
|
436
|
-
* Logic to emit to the father component the x and y
|
|
437
|
-
* cursor is hovering the chart area
|
|
441
|
+
* Logic to emit to the father component the x and y coordinates when the
|
|
442
|
+
* cursor is hovering the chart area.
|
|
438
443
|
*/
|
|
439
|
-
if (ec.containPixel(
|
|
444
|
+
if (ec.containPixel({ gridIndex: 0 }, pointInPixel) && pointInGrid) {
|
|
440
445
|
let newPoint = {
|
|
441
446
|
x: +pointInGrid[0].toFixed(3),
|
|
442
447
|
y: +pointInGrid[1].toFixed(3)
|
|
@@ -447,14 +452,14 @@ class KiwiChartDirective {
|
|
|
447
452
|
const option = ec.getOption();
|
|
448
453
|
const addPointIsActive = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;
|
|
449
454
|
if (addPointIsActive) {
|
|
450
|
-
this.zr?.setCursorStyle(ec.containPixel(
|
|
455
|
+
this.zr?.setCursorStyle(ec.containPixel({ gridIndex: 0 }, pointInPixel) ? 'copy' : 'default');
|
|
451
456
|
}
|
|
452
457
|
});
|
|
453
458
|
}
|
|
454
|
-
static
|
|
455
|
-
static
|
|
459
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.2", ngImport: i0, type: KiwiChartDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
460
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.2", type: KiwiChartDirective, isStandalone: true, selector: "div[kiwi-chart]", inputs: { chart: "chart", width: "width", height: "height", darkTheme: "darkTheme", darkThemeBackground: "darkThemeBackground" }, outputs: { chartInit: "chartInit", addPoint: "addPoint", chartHover: "chartHover" }, host: { listeners: { "window:resize": "onResize()" } }, usesOnChanges: true, ngImport: i0 });
|
|
456
461
|
}
|
|
457
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
462
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.2", ngImport: i0, type: KiwiChartDirective, decorators: [{
|
|
458
463
|
type: Directive,
|
|
459
464
|
args: [{
|
|
460
465
|
selector: 'div[kiwi-chart]',
|
|
@@ -479,60 +484,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImpo
|
|
|
479
484
|
type: Input
|
|
480
485
|
}], onResize: [{
|
|
481
486
|
type: HostListener,
|
|
482
|
-
args: ['window:resize'
|
|
487
|
+
args: ['window:resize']
|
|
483
488
|
}] } });
|
|
484
489
|
|
|
485
490
|
// Angular General
|
|
486
491
|
class KiwiChartComponent {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}
|
|
534
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: KiwiChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
535
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.13", type: KiwiChartComponent, isStandalone: true, selector: "kiwi-chart", inputs: { chart: "chart", width: "width", height: "height", darkTheme: "darkTheme", darkThemeBackground: "darkThemeBackground" }, outputs: { addPoint: "addPoint", chartHover: "chartHover" }, ngImport: i0, template: `
|
|
492
|
+
/**
|
|
493
|
+
* The Chart Object rendered by the canvas. For all the available options refer
|
|
494
|
+
* to Chart interface in the models folder.
|
|
495
|
+
*
|
|
496
|
+
* @type {(Chart | null)}
|
|
497
|
+
* @memberof KiwiChartComponent
|
|
498
|
+
*/
|
|
499
|
+
chart = null;
|
|
500
|
+
/**
|
|
501
|
+
* Width and Height of the chart area. The dimensions refer to the father component
|
|
502
|
+
* into which the kiwi-chart is inserted. For example in an empty page the width/height
|
|
503
|
+
* of the chart can take the whole available space in the page.
|
|
504
|
+
*
|
|
505
|
+
* @type {string}
|
|
506
|
+
* @memberof KiwiChartComponent
|
|
507
|
+
*/
|
|
508
|
+
width = '100%';
|
|
509
|
+
height = '480px';
|
|
510
|
+
/**
|
|
511
|
+
* This property simply activates or not the dark theme of the chart
|
|
512
|
+
* defined by the Echarts library. In addition the background color can be custom
|
|
513
|
+
* so that the chart can match the background of the application in which it's used.
|
|
514
|
+
*
|
|
515
|
+
* @type {boolean}
|
|
516
|
+
* @memberof KiwiChartComponent
|
|
517
|
+
*/
|
|
518
|
+
darkTheme = false;
|
|
519
|
+
darkThemeBackground = null;
|
|
520
|
+
/**
|
|
521
|
+
* Output event used to emit to the father component the coordinates
|
|
522
|
+
* of the point clicked in the chart area. This functionality to be used must
|
|
523
|
+
* have the property "clickToAddPoint" in the Chart object set to true.
|
|
524
|
+
*
|
|
525
|
+
* @type {EventEmitter<BasePoint>}
|
|
526
|
+
* @memberof KiwiChartComponent
|
|
527
|
+
*/
|
|
528
|
+
addPoint = new EventEmitter();
|
|
529
|
+
/**
|
|
530
|
+
* When the cursor hovers the chart area it emits to the father component the
|
|
531
|
+
* x and y coordinates relative to the chart reference system.
|
|
532
|
+
*
|
|
533
|
+
* @type {EventEmitter<BasePoint>}
|
|
534
|
+
* @memberof KiwiChartComponent
|
|
535
|
+
*/
|
|
536
|
+
chartHover = new EventEmitter();
|
|
537
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.2", ngImport: i0, type: KiwiChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
538
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.2", type: KiwiChartComponent, isStandalone: true, selector: "kiwi-chart", inputs: { chart: "chart", width: "width", height: "height", darkTheme: "darkTheme", darkThemeBackground: "darkThemeBackground" }, outputs: { addPoint: "addPoint", chartHover: "chartHover" }, ngImport: i0, template: `
|
|
536
539
|
<div
|
|
537
540
|
kiwi-chart
|
|
538
541
|
[chart]="chart"
|
|
@@ -543,9 +546,9 @@ class KiwiChartComponent {
|
|
|
543
546
|
(addPoint)="addPoint.emit($event)"
|
|
544
547
|
(chartHover)="chartHover.emit($event)"
|
|
545
548
|
></div>
|
|
546
|
-
`, isInline: true, styles: [""], dependencies: [{ kind: "directive", type: KiwiChartDirective, selector: "div[kiwi-chart]", inputs: ["chart", "width", "height", "darkTheme", "darkThemeBackground"], outputs: ["chartInit", "addPoint", "chartHover"] }] });
|
|
549
|
+
`, isInline: true, styles: [""], dependencies: [{ kind: "directive", type: KiwiChartDirective, selector: "div[kiwi-chart]", inputs: ["chart", "width", "height", "darkTheme", "darkThemeBackground"], outputs: ["chartInit", "addPoint", "chartHover"] }] });
|
|
547
550
|
}
|
|
548
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
551
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.2", ngImport: i0, type: KiwiChartComponent, decorators: [{
|
|
549
552
|
type: Component,
|
|
550
553
|
args: [{ selector: 'kiwi-chart', template: `
|
|
551
554
|
<div
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kiwibit-chart.mjs","sources":["../../../../projects/kiwibit/chart/src/lib/models/chart.models.ts","../../../../projects/kiwibit/chart/src/lib/constants/chart.constants.ts","../../../../projects/kiwibit/chart/src/lib/directives/kiwi-chart.directive.ts","../../../../projects/kiwibit/chart/src/lib/components/chart.component.ts","../../../../projects/kiwibit/chart/src/public-api.ts","../../../../projects/kiwibit/chart/src/kiwibit-chart.ts"],"sourcesContent":["/**\r\n * Interface to define the Chart model.\r\n *\r\n * @export\r\n * @interface Chart\r\n */\r\nexport interface Chart {\r\n title: string;\r\n showLegend?: boolean;\r\n xAxisType: AxisType;\r\n xAxisName: string;\r\n xAxisUom?: string;\r\n xMin?: number;\r\n xMax?: number;\r\n yAxisType: AxisType;\r\n yAxisName: string;\r\n yAxisUom?: string;\r\n yMin?: number;\r\n yMax?: number;\r\n /**\r\n * The maximum decimals that can have the values on the x and y axes.\r\n * If omitted the default is 3 decimals.\r\n *\r\n * @type {number}\r\n * @memberof Chart\r\n */\r\n maxAxesDecimals?: number;\r\n /**\r\n * If the chart should have rendering animations.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n hasAnimations?: boolean;\r\n /**\r\n * How long the animation should last.\r\n * Expressed in milliseconds. If omitted the Default is 500 ms.\r\n *\r\n * @type {number}\r\n * @memberof Chart\r\n */\r\n animationDuration?: number;\r\n /**\r\n * The list of Shapes that the chart must render.\r\n * Each Shape corrisponds to a single chart component.\r\n *\r\n * @type {Shape[]}\r\n * @memberof Chart\r\n */\r\n shapes: Shape[];\r\n /**\r\n * Adds interaction with the chart, so that when clicking\r\n * everywhere in the chart area a point gets added and it's coordinate are \r\n * emitted with an event to the parent component.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n clickToAddPoint?: boolean;\r\n /**\r\n * Custom name for the \"clickToAddPoint\" event related button. \r\n *\r\n * @type {string}\r\n * @memberof Chart\r\n */\r\n addPointCustomName?: string;\r\n /**\r\n * Adds the possibility to use the scroll \r\n * to zoom in/out the chart area.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n scrollToZoom?: boolean;\r\n /**\r\n * Tells the chart to render or not the grid lines.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n showGrid?: boolean;\r\n}\r\n\r\nexport type Shape = Trace;\r\n\r\nexport interface Trace {\r\n name?: string;\r\n /**\r\n * The variant of the Shape, must be of type Trace.\r\n *\r\n * @type {ShapeVariant}\r\n * @memberof Trace\r\n */\r\n variant: ShapeVariant;\r\n color?: string;\r\n /**\r\n * The type of the Trace drawn by the chart.\r\n * Can be a line or a scatter. \r\n *\r\n * @type {TraceType}\r\n * @memberof Trace\r\n */\r\n type: TraceType;\r\n width?: number;\r\n /**\r\n * The list of points that define the Trace.\r\n *\r\n * @type {Point[]}\r\n * @memberof Trace\r\n */\r\n points: Point[];\r\n /**\r\n * Whether to show a smooth curve or a segmented curve.\r\n *\r\n * @type {boolean}\r\n * @memberof Trace\r\n */\r\n smooth?: boolean;\r\n /**\r\n * The style of the Trace.\r\n * Can be solid, dashed or dotted.\r\n *\r\n * @type {TraceStyle}\r\n * @memberof Trace\r\n */\r\n style?: TraceStyle;\r\n /**\r\n * Option to make the Trace selected/deselected by default.\r\n * A deselected Trace is obscured from the chart and can be toggled from the legend. \r\n *\r\n * @type {boolean}\r\n * @memberof Trace\r\n */\r\n selectedByDefault?: boolean;\r\n opacity?: number;\r\n}\r\n\r\nexport interface Point extends BasePoint {\r\n name?: string;\r\n /**\r\n * Symbol used to represent the point in the chart.\r\n *\r\n * @type {PointSymbol}\r\n * @memberof Point\r\n */\r\n symbol?: PointSymbol;\r\n symbolSize?: number;\r\n color?: string;\r\n}\r\n\r\nexport interface BasePoint {\r\n x: number;\r\n y: number\r\n}\r\n\r\nexport enum TraceType {\r\n LINE = \"line\",\r\n SCATTER = \"scatter\"\r\n}\r\n\r\nexport enum PointSymbol {\r\n NONE = \"none\",\r\n CIRCLE = \"circle\",\r\n TRIANGLE = \"triangle\",\r\n PIN = \"pin\",\r\n DIAMOND = \"diamond\"\r\n}\r\n\r\nexport enum TraceStyle {\r\n SOLID = \"solid\",\r\n DASHED = \"dashed\",\r\n DOTTED = \"dotted\"\r\n}\r\n\r\nexport enum AxisType {\r\n VALUE = \"value\"\r\n}\r\n\r\nexport enum ShapeVariant {\r\n TRACE\r\n}\r\n\r\nexport type ChartTheme = 'default' | 'dark';","export const ZOOM_IN: string = \"M39.35 40.45 26.6 27.7q-1.55 1.35-3.6 2.025-2.05.675-4 .675-4.9 0-8.225-3.325Q7.45 23.75 7.45 18.9q0-4.9 3.325-8.225Q14.1 7.35 18.95 7.35q4.85 0 8.225 3.325t3.375 8.175q0 2.1-.725 4.1-.725 2-2.025 3.45l12.8 12.75ZM19 28.65q4.15 0 6.975-2.8 2.825-2.8 2.825-7 0-4.15-2.825-6.95T19 9.1q-4.2 0-7 2.8t-2.8 6.95q0 4.2 2.8 7t7 2.8Zm-.9-5.1V19.7h-3.85v-1.75h3.85v-3.8h1.75v3.8h3.8v1.75h-3.8v3.85Z\";\r\nexport const ZOOM_OUT: string = \"M41.25 39.35 29.55 27.7q-1.5 1.25-3.525 1.975Q24 30.4 22.05 30.4q-2.1 0-3.975-.725T14.9 27.65l1.2-1.2q1.2 1.1 2.65 1.65 1.45.55 3.25.55 4.2 0 7-2.8t2.8-7q0-4.15-2.8-6.95t-7-2.8q-4.15 0-7 2.8-2.85 2.8-2.75 6.95l3.2-3.4 1.3 1.3-5.35 5.35-5.3-5.35 1.3-1.3 3.05 3.3q0-4.85 3.4-8.125Q17.25 7.35 22 7.35q4.9 0 8.225 3.325Q33.55 14 33.55 18.85q0 2.1-.75 4.1-.75 2-1.95 3.45L42.5 38.05Z\";\r\nexport const SAVE_AS_SVG: string = \"M11.3 40.05q-1.35 0-2.35-1t-1-2.35V11.3q0-1.4 1-2.375 1-.975 2.35-.975h25.4q1.4 0 2.375.975.975.975.975 2.375v25.4q0 1.35-.975 2.35t-2.375 1Zm0-1.75h25.4q.6 0 1.1-.5.5-.5.5-1.1V11.3q0-.6-.5-1.1-.5-.5-1.1-.5H11.3q-.6 0-1.1.5-.5.5-.5 1.1v25.4q0 .6.5 1.1.5.5 1.1.5Zm4.1-5.15h17.65l-5.5-7.3-5.2 6.45-3.3-3.85ZM9.7 38.3V9.7v28.6Z\";\r\nexport const RESTORE: string = \"M24.2 25.65q-.65 0-1.125-.475T22.6 24q0-.7.475-1.2t1.175-.5q.65 0 1.175.525T25.95 24q0 .7-.55 1.175-.55.475-1.2.475Zm.1 14.55q-6.4 0-11.1-4.25Q8.5 31.7 8.1 25.4h1.8q.5 5.55 4.6 9.3 4.1 3.75 9.75 3.75 6.05 0 10.225-4.225T38.65 24.05q0-6.05-4.2-10.275Q30.25 9.55 24.3 9.55q-3.2 0-6.025 1.3t-4.875 3.6h4.95v1.75H10.4v-8h1.75v5.05q2.25-2.6 5.475-4.025Q20.85 7.8 24.3 7.8q3.3 0 6.225 1.25t5.125 3.475q2.2 2.225 3.475 5.175Q40.4 20.65 40.4 24q0 3.35-1.275 6.3-1.275 2.95-3.475 5.175-2.2 2.225-5.125 3.475T24.3 40.2Z\";\r\nexport const ADD_POINT: string = \"M222.895-189.538q-22.456 0-37.906-15.451-15.451-15.45-15.451-37.906v-474.21q0-22.456 15.451-37.906 15.45-15.451 38.088-15.451h322.346v28.924H223.077q-10.769 0-17.692 6.923t-6.923 17.692v473.846q0 10.769 6.923 17.692t17.692 6.923h473.846q10.77 0 17.693-6.923 6.923-6.923 6.923-17.692v-322.346h28.923v322.346q0 22.638-15.451 38.088-15.45 15.451-37.906 15.451h-474.21Zm78.028-121.539h28.923v-243.077h-28.923v243.077Zm144.923 0h28.923v-337.846h-28.923v337.846Zm144.308 0h28.923v-148.308h-28.923v148.308Zm100-327.692v-71.385h-71.385v-28.923h71.385v-71.385h28.923v71.385h71.385v28.923h-71.385v71.385h-28.923ZM460-480Z\";\r\n","// Angular Imports\r\nimport { AfterViewInit, Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core';\r\n// Kiwi Chart Imports\r\nimport { BasePoint, Chart, Point, Shape, ShapeVariant, Trace } from '../models/chart.models';\r\nimport { ADD_POINT, RESTORE, SAVE_AS_SVG, ZOOM_IN, ZOOM_OUT } from '../constants/chart.constants';\r\n// Echarts Imports\r\nimport * as echarts from 'echarts/core';\r\nimport {\r\n ComposeOption,\r\n CustomSeriesOption,\r\n LegendComponentOption,\r\n LineSeriesOption,\r\n ScatterSeriesOption,\r\n ToolboxComponentOption\r\n} from 'echarts/types/dist/shared'; \r\nimport { TitleComponent, TooltipComponent, GridComponent, LegendComponent, DataZoomComponent, ToolboxComponent, TitleComponentOption, TooltipComponentOption, GridComponentOption, DatasetComponentOption } from 'echarts/components';\r\nimport { LineChart, ScatterChart } from 'echarts/charts';\r\nimport { CanvasRenderer } from 'echarts/renderers';\r\necharts.use([\r\n TitleComponent,\r\n TooltipComponent,\r\n GridComponent,\r\n LineChart,\r\n ScatterChart,\r\n CanvasRenderer,\r\n LegendComponent,\r\n DataZoomComponent,\r\n ToolboxComponent,\r\n]);\r\nexport type ECOption = ComposeOption<\r\n | LineSeriesOption\r\n | TitleComponentOption\r\n | TooltipComponentOption\r\n | GridComponentOption\r\n | DatasetComponentOption\r\n | LegendComponentOption\r\n | ToolboxComponentOption\r\n>;\r\n\r\n@Directive({\r\n selector: 'div[kiwi-chart]',\r\n standalone: true\r\n})\r\nexport class KiwiChartDirective implements OnChanges, AfterViewInit {\r\n\r\n /**\r\n * The Chart Object rendered by the canvas. For all the available options refer \r\n * to Chart interface in the models folder.\r\n *\r\n * @type {(Chart | null)}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Input({ required: true }) chart: Chart | null = null;\r\n\r\n /**\r\n * Width and Height of the chart area. The dimensions refer to the father component \r\n * into which the kiwi-chart is inserted. For example in an empty page the width/height \r\n * of the chart can take the whole available space in the page.\r\n *\r\n * @type {string}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Input() width: string = '100%';\r\n @Input() height: string = '480px';\r\n\r\n @Output() chartInit = new EventEmitter<echarts.ECharts>();\r\n\r\n /**\r\n * Output event used to emit to the father component the coordinates\r\n * of the point clicked in the chart area. This functionality to be used must\r\n * have the property \"clickToAddPoint\" in the Chart object set to true.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Output() addPoint: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n /**\r\n * When the cursor hovers the chart area it emits to the father component the\r\n * x and y coordinates relative to the chart reference system.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Output() chartHover: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n /**\r\n * This property simply activates or not the dark theme of the chart\r\n * defined by the Echarts library. In addition the background color can be custom\r\n * so that the chart can match the background of the application in which it's used.\r\n *\r\n * @type {boolean}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Input() darkTheme: boolean = false;\r\n @Input() darkThemeBackground: string | null = null;\r\n\r\n /**\r\n * The instance of the Chart.\r\n *\r\n * @type {ECharts}\r\n * @memberof KiwiChartDirective\r\n */\r\n echartsInstance: echarts.ECharts | null = null;\r\n\r\n /**\r\n * Default number of decimals that can have\r\n * the values on the x and y axes.\r\n *\r\n * @private\r\n * @type {number}\r\n * @memberof KiwiChartDirective\r\n */\r\n private readonly MAX_DECIMALS: number = 3;\r\n\r\n private legendSelected: { [key: string]: boolean } = {};\r\n private isLegendClicked: boolean = false;\r\n\r\n /**\r\n * Used to perform actions (as point addition based on the cursor position) on the chart.\r\n *\r\n * @type {(zrender.ZRenderType | null)}\r\n * @memberof KiwiChartComponent\r\n */\r\n zr: echarts.zrender.ZRenderType | null = null;\r\n\r\n /**\r\n * If you resize the page, the chart is automatically re-rendered wiht the right proportions.\r\n *\r\n * @memberof EnchartingDirective\r\n */\r\n @HostListener('window:resize', ['$event'])\r\n onResize() {\r\n if (this.echartsInstance) {\r\n this.echartsInstance.resize();\r\n }\r\n }\r\n\r\n constructor(\r\n private el: ElementRef<HTMLDivElement>\r\n ) { }\r\n\r\n ngAfterViewInit(): void {\r\n if (this.chart) {\r\n this.renderChart(this.chart);\r\n }\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n let chart: Chart = changes['chart']?.currentValue;\r\n if (this.echartsInstance) {\r\n // Every time we have an external change we\r\n // destroy the chart and re-initialize it\r\n this.echartsInstance.dispose();\r\n this.renderChart(chart);\r\n }\r\n }\r\n\r\n renderChart(chart: Chart): void {\r\n // Update ElementRef styles\r\n this.el.nativeElement.style.width = this.width;\r\n this.el.nativeElement.style.height = this.height;\r\n\r\n this.echartsInstance = echarts.init(\r\n this.el.nativeElement,\r\n this.darkTheme ? 'dark' : 'default',\r\n {\r\n renderer: 'svg'\r\n }\r\n );\r\n\r\n if (chart) {\r\n this.echartsInstance.setOption({\r\n title: {\r\n text: chart.title,\r\n },\r\n grid: {\r\n id: 0,\r\n width: '70%'\r\n },\r\n backgroundColor: this.darkTheme ? this.darkThemeBackground ?? '#303030' : 'transparent', tooltip: {\r\n axisPointer: {\r\n type: 'cross',\r\n crossStyle: {\r\n color: '#bebebe'\r\n }\r\n }\r\n },\r\n toolbox: {\r\n orient: 'horizontal',\r\n left: 'center',\r\n top: '25px',\r\n feature: {\r\n dataZoom: {\r\n brushStyle: {\r\n borderColor: '#000',\r\n borderWidth: 1,\r\n borderType: 'dashed'\r\n },\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5\r\n }\r\n },\r\n icon: {\r\n zoom: ZOOM_IN,\r\n back: ZOOM_OUT\r\n },\r\n },\r\n saveAsImage: {\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5\r\n }\r\n },\r\n icon: SAVE_AS_SVG,\r\n },\r\n restore: {\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5\r\n }\r\n },\r\n icon: RESTORE,\r\n },\r\n myAddPoint: {\r\n show: chart.clickToAddPoint ?? false,\r\n title: chart.addPointCustomName ?? 'Add Point',\r\n icon: ADD_POINT,\r\n onclick: () => {\r\n if (this.echartsInstance) {\r\n const option: ECOption = this.echartsInstance.getOption();\r\n const toolbox = option.toolbox as ToolboxComponentOption[];\r\n if (toolbox) {\r\n const status: boolean = toolbox[0].feature?.['myAddPoint']?.iconStatus;\r\n const offColor: string = 'rgb(102,102,102)';\r\n const highlightColor: string = 'rgb(62,152,197)';\r\n this.echartsInstance.setOption({\r\n toolbox: {\r\n feature: {\r\n myAddPoint: {\r\n iconStatus: !status,\r\n iconStyle: {\r\n borderColor: !status ? highlightColor : offColor\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n },\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5\r\n }\r\n }\r\n }\r\n },\r\n },\r\n dataZoom: [\r\n {\r\n type: 'inside',\r\n xAxisIndex: [0],\r\n throttle: 0,\r\n filterMode: 'none',\r\n disabled: !chart.scrollToZoom\r\n },\r\n {\r\n type: 'inside',\r\n yAxisIndex: [0],\r\n throttle: 0,\r\n filterMode: 'none',\r\n disabled: !chart.scrollToZoom\r\n },\r\n ],\r\n legend: {\r\n inactiveColor: this.darkTheme ? '#8b8b8b' : '#ccc',\r\n data: chart.shapes.map(\r\n (shape: Shape) => ({\r\n name: shape.name,\r\n icon: 'circle',\r\n })\r\n ),\r\n selected: chart.shapes.reduce(\r\n (accumulator, shape: Shape) => ({\r\n ...accumulator,\r\n [shape.name as string]: this.getLegendItemSelection(shape),\r\n }),\r\n {}),\r\n show: chart.showLegend ?? false,\r\n orient: 'vertical',\r\n left: 'right',\r\n padding: [60, 20],\r\n type: 'scroll',\r\n textStyle: {\r\n width: 120,\r\n fontWeight: 'bold',\r\n overflow: 'break'\r\n }\r\n },\r\n xAxis: {\r\n type: chart.xAxisType,\r\n name: chart.xAxisUom ? `${chart.xAxisName} [ ${chart.xAxisUom} ]` : chart.xAxisName,\r\n nameLocation: 'middle',\r\n nameGap: 30,\r\n splitLine: {\r\n show: chart.showGrid ?? true,\r\n lineStyle: {\r\n color: this.darkTheme ? '#595959' : '#ccc'\r\n }\r\n },\r\n min: chart.xMin?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n max: chart.xMax?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n },\r\n yAxis: {\r\n type: chart.yAxisType,\r\n name: chart.yAxisUom ? `${chart.yAxisName} [ ${chart.yAxisUom} ]` : chart.yAxisName,\r\n nameLocation: 'middle',\r\n nameGap: 50,\r\n splitLine: {\r\n show: chart.showGrid ?? true,\r\n lineStyle: {\r\n color: this.darkTheme ? '#595959' : '#ccc'\r\n }\r\n },\r\n min: chart.yMin?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n max: chart.yMax?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n },\r\n series: this.createSeries(chart.shapes),\r\n animation: chart.hasAnimations,\r\n animationDuration: chart.animationDuration ?? 250,\r\n animationEasing: 'cubicOut'\r\n },\r\n true,\r\n true\r\n );\r\n }\r\n\r\n this.setupZrEventHandler(this.echartsInstance);\r\n\r\n this.setupLegendEventHandler(this.echartsInstance);\r\n }\r\n\r\n createSeries(shapes: Shape[]): Array<LineSeriesOption | CustomSeriesOption | ScatterSeriesOption> {\r\n let series: Array<LineSeriesOption | CustomSeriesOption | ScatterSeriesOption> = [];\r\n shapes.forEach(\r\n (shape: Shape) => {\r\n switch (shape.variant) {\r\n case ShapeVariant.TRACE:\r\n series.push(this.createTrace(shape as Trace))\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n );\r\n return series;\r\n }\r\n\r\n createTrace(trace: Trace): LineSeriesOption | ScatterSeriesOption {\r\n return {\r\n type: trace.type,\r\n name: trace.name,\r\n data: trace.points.map(\r\n (point: Point) => ({\r\n value: [point.x, point.y],\r\n symbol: point.symbol ?? 'circle',\r\n name: point.name,\r\n symbolSize: point.symbolSize ?? 2,\r\n itemStyle: {\r\n color: point.color\r\n },\r\n emphasis: {\r\n disabled: true\r\n },\r\n label: {\r\n show: true,\r\n position: 'bottom',\r\n align: 'left',\r\n verticalAlign: 'bottom',\r\n formatter: () => `${point.name ?? ''}`,\r\n fontSize: 13,\r\n padding: [0, 0, 0, 10],\r\n width: 100,\r\n overflow: 'truncate',\r\n ellipsis: '...',\r\n fontWeight: 'bold',\r\n color: this.darkTheme ? '#fff' : '#000'\r\n },\r\n tooltip: {\r\n formatter: ({ value }: { value: number[] }) => `\r\n <strong>${this.chart?.xAxisName}:</strong> ${value[0].toFixed(3).replace(/[.,]000$/, \"\")}\r\n <br>\r\n <strong>${this.chart?.yAxisName}:</strong> ${value[1].toFixed(3).replace(/[.,]000$/, \"\")}\r\n `\r\n }\r\n })\r\n ),\r\n color: trace.color,\r\n lineStyle: {\r\n width: trace.width,\r\n type: trace.style,\r\n opacity: trace.opacity ?? 1\r\n },\r\n smooth: trace.smooth ?? false\r\n };\r\n }\r\n\r\n getLegendItemSelection(shape: Shape): boolean {\r\n if (this.isLegendClicked) {\r\n return this.legendSelected[shape.name as string] ?? true;\r\n }\r\n else {\r\n return shape.selectedByDefault ?? true\r\n }\r\n }\r\n\r\n /**\r\n * intercept a selection change event on the legend and save the state \r\n * of all selections on the supporting variable legendSelected\r\n * \r\n * @param ec \r\n */\r\n setupLegendEventHandler(ec: echarts.ECharts) {\r\n if (this.echartsInstance != null) {\r\n this.echartsInstance.on('legendselectchanged', (params: any) => {\r\n this.isLegendClicked = true;\r\n this.legendSelected = params.selected;\r\n });\r\n }\r\n\r\n }\r\n\r\n setupZrEventHandler(ec: echarts.ECharts) {\r\n this.zr = ec.getZr();\r\n /** \r\n * Intercepts the click event on the chart (if the clickToAddPoint property is set to true)\r\n * and emits the point coordinates to the father component.\r\n */\r\n this.zr.on('click', params => {\r\n let option: any = ec.getOption();\r\n let active = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;\r\n if (active && this.chart?.clickToAddPoint) {\r\n const pointInPixel = [params.offsetX, params.offsetY];\r\n const pointInGrid = ec.convertFromPixel({gridId: 0}, pointInPixel);\r\n if (ec.containPixel({gridId: 0}, pointInPixel) && pointInGrid) {\r\n let newPoint: { x: number, y: number } = {\r\n x: +pointInGrid[0].toFixed(3),\r\n y: +pointInGrid[1].toFixed(3)\r\n };\r\n this.addPoint.emit(newPoint);\r\n }\r\n }\r\n });\r\n /** \r\n * This is used perform custom actions when the mouse is hovering the chart area\r\n */\r\n this.zr.on('mousemove', params => {\r\n const pointInPixel = [params.offsetX, params.offsetY];\r\n const pointInGrid = ec.convertFromPixel('grid', pointInPixel);\r\n /* \r\n * Logic to emit to the father component the x and y cdinates when the\r\n * cursor is hovering the chart area .\r\n */\r\n if (ec.containPixel('grid', pointInPixel) && pointInGrid) {\r\n let newPoint: { x: number, y: number } = {\r\n x: +pointInGrid[0].toFixed(3),\r\n y: +pointInGrid[1].toFixed(3)\r\n };\r\n this.chartHover.emit(newPoint);\r\n }\r\n /* Logic to change the cursor icon when the \"Click to Add Point\" feature is active and viceversa. */\r\n const option: any = ec.getOption();\r\n const addPointIsActive = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;\r\n if (addPointIsActive) {\r\n this.zr?.setCursorStyle(\r\n ec.containPixel('grid', pointInPixel) ? 'copy' : 'default'\r\n );\r\n }\r\n });\r\n }\r\n\r\n}\r\n","// Angular General\r\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\r\n// Kiwi Chart\r\nimport { Chart, BasePoint } from '../models/chart.models';\r\nimport { KiwiChartDirective } from '../directives/kiwi-chart.directive';\r\n\r\n@Component({\r\n selector: 'kiwi-chart',\r\n template: `\r\n <div \r\n kiwi-chart \r\n [chart]=\"chart\" \r\n [width]=\"width\"\r\n [height]=\"height\"\r\n [darkTheme]=\"darkTheme\"\r\n [darkThemeBackground]=\"darkThemeBackground\"\r\n (addPoint)=\"addPoint.emit($event)\"\r\n (chartHover)=\"chartHover.emit($event)\"\r\n ></div> \r\n `,\r\n styles: [``],\r\n imports: [KiwiChartDirective]\r\n})\r\nexport class KiwiChartComponent {\r\n\r\n /**\r\n * The Chart Object rendered by the canvas. For all the available options refer \r\n * to Chart interface in the models folder.\r\n *\r\n * @type {(Chart | null)}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Input({ required: true }) chart: Chart | null = null;\r\n\r\n /**\r\n * Width and Height of the chart area. The dimensions refer to the father component \r\n * into which the kiwi-chart is inserted. For example in an empty page the width/height \r\n * of the chart can take the whole available space in the page.\r\n *\r\n * @type {string}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Input() width: string = '100%';\r\n @Input() height: string = '480px';\r\n\r\n /**\r\n * This property simply activates or not the dark theme of the chart\r\n * defined by the Echarts library. In addition the background color can be custom\r\n * so that the chart can match the background of the application in which it's used.\r\n *\r\n * @type {boolean}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Input() darkTheme: boolean = false;\r\n @Input() darkThemeBackground: string | null = null;\r\n\r\n /**\r\n * Output event used to emit to the father component the coordinates\r\n * of the point clicked in the chart area. This functionality to be used must\r\n * have the property \"clickToAddPoint\" in the Chart object set to true.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Output() addPoint: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n /**\r\n * When the cursor hovers the chart area it emits to the father component the\r\n * x and y coordinates relative to the chart reference system.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Output() chartHover: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n}\r\n","/*\r\n * Public API Surface of chart\r\n */\r\n\r\nexport * from './lib/components/chart.component';\r\nexport * from './lib/models/chart.models';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;IA2JY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACjB,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACvB,CAAC,EAHW,SAAS,KAAT,SAAS,G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AA,QAAA,EAfjB,CAAA;;;;;;;;;;;AAWX,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAEW,kBAAkB,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,QAAA,EAAA,WAAA,EAAA,qBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,WAAA,EAAA,UAAA,EAAA,YAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;4FAEnB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAjB9B,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,YAAY,EAAA,QAAA,EACZ,CAAA;;;;;;;;;;;GAWX,EAAA,OAAA,EAEU,CAAC,kBAAkB,CAAC,EAAA;;sBAW9B,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAUxB;;sBACA;;sBAUA;;sBACA;;sBAUA;;sBASA;;;ACzEH;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"kiwibit-chart.mjs","sources":["../../../../projects/kiwibit/chart/src/lib/models/chart.models.ts","../../../../projects/kiwibit/chart/src/lib/constants/chart.constants.ts","../../../../projects/kiwibit/chart/src/lib/directives/kiwi-chart.directive.ts","../../../../projects/kiwibit/chart/src/lib/components/chart.component.ts","../../../../projects/kiwibit/chart/src/public-api.ts","../../../../projects/kiwibit/chart/src/kiwibit-chart.ts"],"sourcesContent":["/**\r\n * Interface to define the Chart model.\r\n *\r\n * @export\r\n * @interface Chart\r\n */\r\nexport interface Chart {\r\n title: string;\r\n showLegend?: boolean;\r\n xAxisType: AxisType;\r\n xAxisName: string;\r\n xAxisUom?: string;\r\n xMin?: number;\r\n xMax?: number;\r\n yAxisType: AxisType;\r\n yAxisName: string;\r\n yAxisUom?: string;\r\n yMin?: number;\r\n yMax?: number;\r\n /**\r\n * The maximum decimals that can have the values on the x and y axes.\r\n * If omitted the default is 3 decimals.\r\n *\r\n * @type {number}\r\n * @memberof Chart\r\n */\r\n maxAxesDecimals?: number;\r\n /**\r\n * If the chart should have rendering animations.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n hasAnimations?: boolean;\r\n /**\r\n * How long the animation should last.\r\n * Expressed in milliseconds. If omitted the Default is 500 ms.\r\n *\r\n * @type {number}\r\n * @memberof Chart\r\n */\r\n animationDuration?: number;\r\n /**\r\n * The list of Shapes that the chart must render.\r\n * Each Shape corrisponds to a single chart component.\r\n *\r\n * @type {Shape[]}\r\n * @memberof Chart\r\n */\r\n shapes: Shape[];\r\n /**\r\n * Adds interaction with the chart, so that when clicking\r\n * everywhere in the chart area a point gets added and it's coordinate are \r\n * emitted with an event to the parent component.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n clickToAddPoint?: boolean;\r\n /**\r\n * Custom name for the \"clickToAddPoint\" event related button. \r\n *\r\n * @type {string}\r\n * @memberof Chart\r\n */\r\n addPointCustomName?: string;\r\n /**\r\n * Adds the possibility to use the scroll \r\n * to zoom in/out the chart area.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n scrollToZoom?: boolean;\r\n /**\r\n * Tells the chart to render or not the grid lines.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n showGrid?: boolean;\r\n}\r\n\r\nexport type Shape = Trace;\r\n\r\nexport interface Trace {\r\n name?: string;\r\n /**\r\n * The variant of the Shape, must be of type Trace.\r\n *\r\n * @type {ShapeVariant}\r\n * @memberof Trace\r\n */\r\n variant: ShapeVariant;\r\n color?: string;\r\n /**\r\n * The type of the Trace drawn by the chart.\r\n * Can be a line or a scatter. \r\n *\r\n * @type {TraceType}\r\n * @memberof Trace\r\n */\r\n type: TraceType;\r\n width?: number;\r\n /**\r\n * The list of points that define the Trace.\r\n *\r\n * @type {Point[]}\r\n * @memberof Trace\r\n */\r\n points: Point[];\r\n /**\r\n * Whether to show a smooth curve or a segmented curve.\r\n *\r\n * @type {boolean}\r\n * @memberof Trace\r\n */\r\n smooth?: boolean;\r\n /**\r\n * The style of the Trace.\r\n * Can be solid, dashed or dotted.\r\n *\r\n * @type {TraceStyle}\r\n * @memberof Trace\r\n */\r\n style?: TraceStyle;\r\n /**\r\n * Option to make the Trace selected/deselected by default.\r\n * A deselected Trace is obscured from the chart and can be toggled from the legend. \r\n *\r\n * @type {boolean}\r\n * @memberof Trace\r\n */\r\n selectedByDefault?: boolean;\r\n opacity?: number;\r\n}\r\n\r\nexport interface Point extends BasePoint {\r\n name?: string;\r\n /**\r\n * Symbol used to represent the point in the chart.\r\n *\r\n * @type {PointSymbol}\r\n * @memberof Point\r\n */\r\n symbol?: PointSymbol;\r\n symbolSize?: number;\r\n color?: string;\r\n}\r\n\r\nexport interface BasePoint {\r\n x: number;\r\n y: number\r\n}\r\n\r\nexport enum TraceType {\r\n LINE = \"line\",\r\n SCATTER = \"scatter\"\r\n}\r\n\r\nexport enum PointSymbol {\r\n NONE = \"none\",\r\n CIRCLE = \"circle\",\r\n TRIANGLE = \"triangle\",\r\n PIN = \"pin\",\r\n DIAMOND = \"diamond\"\r\n}\r\n\r\nexport enum TraceStyle {\r\n SOLID = \"solid\",\r\n DASHED = \"dashed\",\r\n DOTTED = \"dotted\"\r\n}\r\n\r\nexport enum AxisType {\r\n VALUE = \"value\"\r\n}\r\n\r\nexport enum ShapeVariant {\r\n TRACE\r\n}\r\n\r\nexport type ChartTheme = 'default' | 'dark';","export const ZOOM_IN: string = \"M39.35 40.45 26.6 27.7q-1.55 1.35-3.6 2.025-2.05.675-4 .675-4.9 0-8.225-3.325Q7.45 23.75 7.45 18.9q0-4.9 3.325-8.225Q14.1 7.35 18.95 7.35q4.85 0 8.225 3.325t3.375 8.175q0 2.1-.725 4.1-.725 2-2.025 3.45l12.8 12.75ZM19 28.65q4.15 0 6.975-2.8 2.825-2.8 2.825-7 0-4.15-2.825-6.95T19 9.1q-4.2 0-7 2.8t-2.8 6.95q0 4.2 2.8 7t7 2.8Zm-.9-5.1V19.7h-3.85v-1.75h3.85v-3.8h1.75v3.8h3.8v1.75h-3.8v3.85Z\";\r\nexport const ZOOM_OUT: string = \"M41.25 39.35 29.55 27.7q-1.5 1.25-3.525 1.975Q24 30.4 22.05 30.4q-2.1 0-3.975-.725T14.9 27.65l1.2-1.2q1.2 1.1 2.65 1.65 1.45.55 3.25.55 4.2 0 7-2.8t2.8-7q0-4.15-2.8-6.95t-7-2.8q-4.15 0-7 2.8-2.85 2.8-2.75 6.95l3.2-3.4 1.3 1.3-5.35 5.35-5.3-5.35 1.3-1.3 3.05 3.3q0-4.85 3.4-8.125Q17.25 7.35 22 7.35q4.9 0 8.225 3.325Q33.55 14 33.55 18.85q0 2.1-.75 4.1-.75 2-1.95 3.45L42.5 38.05Z\";\r\nexport const SAVE_AS_SVG: string = \"M11.3 40.05q-1.35 0-2.35-1t-1-2.35V11.3q0-1.4 1-2.375 1-.975 2.35-.975h25.4q1.4 0 2.375.975.975.975.975 2.375v25.4q0 1.35-.975 2.35t-2.375 1Zm0-1.75h25.4q.6 0 1.1-.5.5-.5.5-1.1V11.3q0-.6-.5-1.1-.5-.5-1.1-.5H11.3q-.6 0-1.1.5-.5.5-.5 1.1v25.4q0 .6.5 1.1.5.5 1.1.5Zm4.1-5.15h17.65l-5.5-7.3-5.2 6.45-3.3-3.85ZM9.7 38.3V9.7v28.6Z\";\r\nexport const RESTORE: string = \"M24.2 25.65q-.65 0-1.125-.475T22.6 24q0-.7.475-1.2t1.175-.5q.65 0 1.175.525T25.95 24q0 .7-.55 1.175-.55.475-1.2.475Zm.1 14.55q-6.4 0-11.1-4.25Q8.5 31.7 8.1 25.4h1.8q.5 5.55 4.6 9.3 4.1 3.75 9.75 3.75 6.05 0 10.225-4.225T38.65 24.05q0-6.05-4.2-10.275Q30.25 9.55 24.3 9.55q-3.2 0-6.025 1.3t-4.875 3.6h4.95v1.75H10.4v-8h1.75v5.05q2.25-2.6 5.475-4.025Q20.85 7.8 24.3 7.8q3.3 0 6.225 1.25t5.125 3.475q2.2 2.225 3.475 5.175Q40.4 20.65 40.4 24q0 3.35-1.275 6.3-1.275 2.95-3.475 5.175-2.2 2.225-5.125 3.475T24.3 40.2Z\";\r\nexport const ADD_POINT: string = \"M222.895-189.538q-22.456 0-37.906-15.451-15.451-15.45-15.451-37.906v-474.21q0-22.456 15.451-37.906 15.45-15.451 38.088-15.451h322.346v28.924H223.077q-10.769 0-17.692 6.923t-6.923 17.692v473.846q0 10.769 6.923 17.692t17.692 6.923h473.846q10.77 0 17.693-6.923 6.923-6.923 6.923-17.692v-322.346h28.923v322.346q0 22.638-15.451 38.088-15.45 15.451-37.906 15.451h-474.21Zm78.028-121.539h28.923v-243.077h-28.923v243.077Zm144.923 0h28.923v-337.846h-28.923v337.846Zm144.308 0h28.923v-148.308h-28.923v148.308Zm100-327.692v-71.385h-71.385v-28.923h71.385v-71.385h28.923v71.385h71.385v28.923h-71.385v71.385h-28.923ZM460-480Z\";\r\nexport const highlightColor: string = '#98BD13';","// Angular Imports\r\nimport { AfterViewInit, Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core';\r\n// Kiwi Chart Imports\r\nimport { BasePoint, Chart, Point, Shape, ShapeVariant, Trace } from '../models/chart.models';\r\nimport { ADD_POINT, highlightColor, RESTORE, SAVE_AS_SVG, ZOOM_IN, ZOOM_OUT } from '../constants/chart.constants';\r\n// Echarts Imports\r\nimport * as echarts from 'echarts/core';\r\nimport {\r\n ComposeOption,\r\n CustomSeriesOption,\r\n LegendComponentOption,\r\n LineSeriesOption,\r\n ScatterSeriesOption,\r\n ToolboxComponentOption\r\n} from 'echarts/types/dist/shared';\r\nimport { TitleComponent, TooltipComponent, GridComponent, LegendComponent, DataZoomComponent, ToolboxComponent, TitleComponentOption, TooltipComponentOption, GridComponentOption, DatasetComponentOption } from 'echarts/components';\r\nimport { LineChart, ScatterChart } from 'echarts/charts';\r\nimport { CanvasRenderer } from 'echarts/renderers';\r\necharts.use([\r\n TitleComponent,\r\n TooltipComponent,\r\n GridComponent,\r\n LineChart,\r\n ScatterChart,\r\n CanvasRenderer,\r\n LegendComponent,\r\n DataZoomComponent,\r\n ToolboxComponent,\r\n]);\r\nexport type ECOption = ComposeOption<\r\n | LineSeriesOption\r\n | TitleComponentOption\r\n | TooltipComponentOption\r\n | GridComponentOption\r\n | DatasetComponentOption\r\n | LegendComponentOption\r\n | ToolboxComponentOption\r\n>;\r\n\r\n@Directive({\r\n selector: 'div[kiwi-chart]',\r\n standalone: true\r\n})\r\nexport class KiwiChartDirective implements OnChanges, AfterViewInit {\r\n\r\n /**\r\n * The Chart Object rendered by the canvas. For all the available options refer \r\n * to Chart interface in the models folder.\r\n *\r\n * @type {(Chart | null)}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Input({ required: true }) chart: Chart | null = null;\r\n\r\n /**\r\n * Width and Height of the chart area. The dimensions refer to the father component \r\n * into which the kiwi-chart is inserted. For example in an empty page the width/height \r\n * of the chart can take the whole available space in the page.\r\n *\r\n * @type {string}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Input() width: string = '100%';\r\n @Input() height: string = '480px';\r\n\r\n @Output() chartInit = new EventEmitter<echarts.ECharts>();\r\n\r\n /**\r\n * Output event used to emit to the father component the coordinates\r\n * of the point clicked in the chart area. This functionality to be used must\r\n * have the property \"clickToAddPoint\" in the Chart object set to true.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Output() addPoint: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n /**\r\n * When the cursor hovers the chart area it emits to the father component the\r\n * x and y coordinates relative to the chart reference system.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Output() chartHover: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n /**\r\n * This property simply activates or not the dark theme of the chart\r\n * defined by the Echarts library. In addition the background color can be custom\r\n * so that the chart can match the background of the application in which it's used.\r\n *\r\n * @type {boolean}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Input() darkTheme: boolean = false;\r\n @Input() darkThemeBackground: string | null = null;\r\n\r\n /**\r\n * The instance of the Chart.\r\n *\r\n * @type {ECharts}\r\n * @memberof KiwiChartDirective\r\n */\r\n echartsInstance: echarts.ECharts | null = null;\r\n\r\n /**\r\n * Default number of decimals that can have\r\n * the values on the x and y axes.\r\n *\r\n * @private\r\n * @type {number}\r\n * @memberof KiwiChartDirective\r\n */\r\n private readonly MAX_DECIMALS: number = 3;\r\n\r\n private legendSelected: { [key: string]: boolean } = {};\r\n private isLegendClicked: boolean = false;\r\n\r\n /**\r\n * Used to perform actions (as point addition based on the cursor position) on the chart.\r\n *\r\n * @type {(zrender.ZRenderType | null)}\r\n * @memberof KiwiChartComponent\r\n */\r\n zr: echarts.zrender.ZRenderType | null = null;\r\n\r\n /**\r\n * If you resize the page, the chart is automatically re-rendered wiht the right proportions.\r\n *\r\n * @memberof EnchartingDirective\r\n */\r\n @HostListener('window:resize')\r\n onResize() {\r\n if (this.echartsInstance) {\r\n this.echartsInstance.resize();\r\n }\r\n }\r\n\r\n constructor(\r\n private el: ElementRef<HTMLDivElement>\r\n ) { }\r\n\r\n ngAfterViewInit(): void {\r\n if (this.chart) {\r\n this.renderChart(this.chart);\r\n }\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n let chart: Chart = changes['chart']?.currentValue;\r\n if (this.echartsInstance) {\r\n // Every time we have an external change we\r\n // destroy the chart and re-initialize it\r\n this.echartsInstance.dispose();\r\n this.renderChart(chart);\r\n }\r\n }\r\n\r\n renderChart(chart: Chart): void {\r\n // Update ElementRef styles\r\n this.el.nativeElement.style.width = this.width;\r\n this.el.nativeElement.style.height = this.height;\r\n\r\n this.echartsInstance = echarts.init(\r\n this.el.nativeElement,\r\n this.darkTheme ? 'dark' : 'default',\r\n {\r\n renderer: 'svg'\r\n }\r\n );\r\n\r\n if (chart) {\r\n this.echartsInstance.setOption({\r\n title: {\r\n text: chart.title,\r\n left: 0\r\n },\r\n grid: {\r\n id: 0,\r\n width: '70%'\r\n },\r\n backgroundColor: this.darkTheme ? this.darkThemeBackground ?? '#303030' : 'transparent', tooltip: {\r\n axisPointer: {\r\n type: 'cross',\r\n crossStyle: {\r\n color: '#bebebe'\r\n }\r\n }\r\n },\r\n toolbox: {\r\n orient: 'horizontal',\r\n left: 'center',\r\n top: '25px',\r\n feature: {\r\n dataZoom: {\r\n brushStyle: {\r\n borderColor: '#000',\r\n borderWidth: 1,\r\n borderType: 'dashed'\r\n },\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5,\r\n borderColor: highlightColor\r\n }\r\n },\r\n icon: {\r\n zoom: ZOOM_IN,\r\n back: ZOOM_OUT\r\n },\r\n },\r\n saveAsImage: {\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5\r\n }\r\n },\r\n icon: SAVE_AS_SVG,\r\n },\r\n restore: {\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5\r\n }\r\n },\r\n icon: RESTORE,\r\n },\r\n myAddPoint: {\r\n show: chart.clickToAddPoint ?? false,\r\n title: chart.addPointCustomName ?? 'Add Point',\r\n icon: ADD_POINT,\r\n onclick: () => {\r\n if (this.echartsInstance) {\r\n const option: ECOption = this.echartsInstance.getOption();\r\n const toolbox = option.toolbox as ToolboxComponentOption[];\r\n if (toolbox) {\r\n const status: boolean = toolbox[0].feature?.['myAddPoint']?.iconStatus;\r\n const offColor: string = '#6578BA';\r\n this.echartsInstance.setOption({\r\n toolbox: {\r\n feature: {\r\n myAddPoint: {\r\n iconStatus: !status,\r\n iconStyle: {\r\n borderColor: !status ? highlightColor : offColor\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n },\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5,\r\n borderColor: highlightColor\r\n }\r\n }\r\n }\r\n },\r\n },\r\n dataZoom: [\r\n {\r\n type: 'inside',\r\n xAxisIndex: [0],\r\n throttle: 0,\r\n filterMode: 'none',\r\n disabled: !chart.scrollToZoom\r\n },\r\n {\r\n type: 'inside',\r\n yAxisIndex: [0],\r\n throttle: 0,\r\n filterMode: 'none',\r\n disabled: !chart.scrollToZoom\r\n },\r\n ],\r\n legend: {\r\n inactiveColor: this.darkTheme ? '#8b8b8b' : '#ccc',\r\n data: chart.shapes.map(\r\n (shape: Shape) => ({\r\n name: shape.name,\r\n icon: 'circle',\r\n })\r\n ),\r\n selected: chart.shapes.reduce(\r\n (accumulator, shape: Shape) => ({\r\n ...accumulator,\r\n [shape.name as string]: this.getLegendItemSelection(shape),\r\n }),\r\n {}),\r\n show: chart.showLegend ?? false,\r\n orient: 'vertical',\r\n left: 'right',\r\n top: 0,\r\n padding: [60, 20],\r\n type: 'scroll',\r\n textStyle: {\r\n width: 120,\r\n fontWeight: 'bold',\r\n overflow: 'break'\r\n }\r\n },\r\n xAxis: {\r\n type: chart.xAxisType,\r\n name: chart.xAxisUom ? `${chart.xAxisName} [ ${chart.xAxisUom} ]` : chart.xAxisName,\r\n nameLocation: 'middle',\r\n nameGap: 30,\r\n splitLine: {\r\n show: chart.showGrid ?? true,\r\n lineStyle: {\r\n color: this.darkTheme ? '#595959' : '#ccc'\r\n }\r\n },\r\n min: chart.xMin?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n max: chart.xMax?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n },\r\n yAxis: {\r\n type: chart.yAxisType,\r\n name: chart.yAxisUom ? `${chart.yAxisName} [ ${chart.yAxisUom} ]` : chart.yAxisName,\r\n nameLocation: 'middle',\r\n nameGap: 50,\r\n splitLine: {\r\n show: chart.showGrid ?? true,\r\n lineStyle: {\r\n color: this.darkTheme ? '#595959' : '#ccc'\r\n }\r\n },\r\n min: chart.yMin?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n max: chart.yMax?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n },\r\n series: this.createSeries(chart.shapes),\r\n animation: chart.hasAnimations,\r\n animationDuration: chart.animationDuration ?? 250,\r\n animationEasing: 'cubicOut'\r\n },\r\n true,\r\n true\r\n );\r\n }\r\n\r\n this.setupZrEventHandler(this.echartsInstance);\r\n\r\n this.setupLegendEventHandler(this.echartsInstance);\r\n }\r\n\r\n createSeries(shapes: Shape[]): Array<LineSeriesOption | CustomSeriesOption | ScatterSeriesOption> {\r\n let series: Array<LineSeriesOption | CustomSeriesOption | ScatterSeriesOption> = [];\r\n shapes.forEach(\r\n (shape: Shape) => {\r\n switch (shape.variant) {\r\n case ShapeVariant.TRACE:\r\n series.push(this.createTrace(shape as Trace))\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n );\r\n return series;\r\n }\r\n\r\n createTrace(trace: Trace): LineSeriesOption | ScatterSeriesOption {\r\n return {\r\n type: trace.type,\r\n name: trace.name,\r\n data: trace.points.map(\r\n (point: Point) => ({\r\n value: [point.x, point.y],\r\n symbol: point.symbol ?? 'circle',\r\n name: point.name,\r\n symbolSize: point.symbolSize ?? 2,\r\n itemStyle: {\r\n color: point.color\r\n },\r\n emphasis: {\r\n disabled: true\r\n },\r\n label: {\r\n show: true,\r\n position: 'bottom',\r\n align: 'left',\r\n verticalAlign: 'bottom',\r\n formatter: () => `${point.name ?? ''}`,\r\n fontSize: 13,\r\n padding: [0, 0, 0, 10],\r\n width: 100,\r\n overflow: 'truncate',\r\n ellipsis: '...',\r\n fontWeight: 'bold',\r\n color: this.darkTheme ? '#fff' : '#000'\r\n },\r\n tooltip: {\r\n formatter: ({ value }: { value: number[] }) => `\r\n <strong>${this.chart?.xAxisName}:</strong> ${value[0].toFixed(3).replace(/[.,]000$/, \"\")}\r\n <br>\r\n <strong>${this.chart?.yAxisName}:</strong> ${value[1].toFixed(3).replace(/[.,]000$/, \"\")}\r\n `\r\n }\r\n })\r\n ),\r\n color: trace.color,\r\n lineStyle: {\r\n width: trace.width,\r\n type: trace.style,\r\n opacity: trace.opacity ?? 1\r\n },\r\n smooth: trace.smooth ?? false\r\n };\r\n }\r\n\r\n getLegendItemSelection(shape: Shape): boolean {\r\n if (this.isLegendClicked) {\r\n return this.legendSelected[shape.name as string] ?? true;\r\n }\r\n else {\r\n return shape.selectedByDefault ?? true\r\n }\r\n }\r\n\r\n /**\r\n * intercept a selection change event on the legend and save the state \r\n * of all selections on the supporting variable legendSelected\r\n * \r\n * @param ec \r\n */\r\n setupLegendEventHandler(ec: echarts.ECharts) {\r\n if (this.echartsInstance != null) {\r\n this.echartsInstance.on('legendselectchanged', (params: any) => {\r\n this.isLegendClicked = true;\r\n this.legendSelected = params.selected;\r\n });\r\n }\r\n\r\n }\r\n\r\n setupZrEventHandler(ec: echarts.ECharts) {\r\n this.zr = ec.getZr();\r\n /** \r\n * Intercepts the click event on the chart (if the clickToAddPoint property is set to true)\r\n * and emits the point coordinates to the father component.\r\n */\r\n this.zr.on('click', params => {\r\n let option: any = ec.getOption();\r\n let active = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;\r\n if (active && this.chart?.clickToAddPoint) {\r\n const pointInPixel = [params.offsetX, params.offsetY];\r\n const pointInGrid = ec.convertFromPixel({ gridIndex: 0 }, pointInPixel);\r\n if (ec.containPixel({ gridIndex: 0 }, pointInPixel) && pointInGrid) {\r\n let newPoint: { x: number, y: number } = {\r\n x: +pointInGrid[0].toFixed(3),\r\n y: +pointInGrid[1].toFixed(3)\r\n };\r\n this.addPoint.emit(newPoint);\r\n }\r\n }\r\n });\r\n /** \r\n * This is used perform custom actions when the mouse is hovering the chart area\r\n */\r\n this.zr.on('mousemove', params => {\r\n const pointInPixel = [params.offsetX, params.offsetY];\r\n const pointInGrid = ec.convertFromPixel({ gridIndex: 0 }, pointInPixel);\r\n /*\r\n * Logic to emit to the father component the x and y coordinates when the\r\n * cursor is hovering the chart area.\r\n */\r\n if (ec.containPixel({ gridIndex: 0 }, pointInPixel) && pointInGrid) {\r\n let newPoint: { x: number, y: number } = {\r\n x: +pointInGrid[0].toFixed(3),\r\n y: +pointInGrid[1].toFixed(3)\r\n };\r\n this.chartHover.emit(newPoint);\r\n }\r\n /* Logic to change the cursor icon when the \"Click to Add Point\" feature is active and viceversa. */\r\n const option: any = ec.getOption();\r\n const addPointIsActive = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;\r\n if (addPointIsActive) {\r\n this.zr?.setCursorStyle(\r\n ec.containPixel({ gridIndex: 0 }, pointInPixel) ? 'copy' : 'default'\r\n );\r\n }\r\n });\r\n }\r\n\r\n}\r\n","// Angular General\r\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\r\n// Kiwi Chart\r\nimport { Chart, BasePoint } from '../models/chart.models';\r\nimport { KiwiChartDirective } from '../directives/kiwi-chart.directive';\r\n\r\n@Component({\r\n selector: 'kiwi-chart',\r\n template: `\r\n <div \r\n kiwi-chart \r\n [chart]=\"chart\" \r\n [width]=\"width\"\r\n [height]=\"height\"\r\n [darkTheme]=\"darkTheme\"\r\n [darkThemeBackground]=\"darkThemeBackground\"\r\n (addPoint)=\"addPoint.emit($event)\"\r\n (chartHover)=\"chartHover.emit($event)\"\r\n ></div> \r\n `,\r\n styles: [``],\r\n imports: [KiwiChartDirective]\r\n})\r\nexport class KiwiChartComponent {\r\n\r\n /**\r\n * The Chart Object rendered by the canvas. For all the available options refer \r\n * to Chart interface in the models folder.\r\n *\r\n * @type {(Chart | null)}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Input({ required: true }) chart: Chart | null = null;\r\n\r\n /**\r\n * Width and Height of the chart area. The dimensions refer to the father component \r\n * into which the kiwi-chart is inserted. For example in an empty page the width/height \r\n * of the chart can take the whole available space in the page.\r\n *\r\n * @type {string}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Input() width: string = '100%';\r\n @Input() height: string = '480px';\r\n\r\n /**\r\n * This property simply activates or not the dark theme of the chart\r\n * defined by the Echarts library. In addition the background color can be custom\r\n * so that the chart can match the background of the application in which it's used.\r\n *\r\n * @type {boolean}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Input() darkTheme: boolean = false;\r\n @Input() darkThemeBackground: string | null = null;\r\n\r\n /**\r\n * Output event used to emit to the father component the coordinates\r\n * of the point clicked in the chart area. This functionality to be used must\r\n * have the property \"clickToAddPoint\" in the Chart object set to true.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Output() addPoint: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n /**\r\n * When the cursor hovers the chart area it emits to the father component the\r\n * x and y coordinates relative to the chart reference system.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Output() chartHover: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n}\r\n","/*\r\n * Public API Surface of chart\r\n */\r\n\r\nexport * from './lib/components/chart.component';\r\nexport * from './lib/models/chart.models';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;IA2JY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACjB,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACvB,CAAC,EAHW,SAAS,KAAT,SAAS,GAAA,EAAA,CAAA,CAAA;IAKT;AAAZ,CAAA,UAAY,WAAW,EAAA;AACnB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,WAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,WAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,WAAA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EAAA,UAAA,EAAA,CAAA;kBAjB9B,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,YAAY,EAAA,QAAA,EACZ,CAAA;;;;;;;;;;;GAWX,EAAA,OAAA,EAEU,CAAC,kBAAkB,CAAC,EAAA;;sBAW9B,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAUxB;;sBACA;;sBAUA;;sBACA;;sBAUA;;sBASA;;;ACzEH;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiwibit/chart",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.0",
|
|
4
4
|
"engines": {
|
|
5
|
-
"node": "^
|
|
5
|
+
"node": "^20.19.0 || ^22.12.0 || ^24.0.0"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@angular/common": "^
|
|
9
|
-
"@angular/core": "^
|
|
8
|
+
"@angular/common": "^21.0.0",
|
|
9
|
+
"@angular/core": "^21.0.0"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"echarts": "^
|
|
12
|
+
"echarts": "^6.0.0",
|
|
13
13
|
"tslib": "^2.3.0"
|
|
14
14
|
},
|
|
15
|
-
"
|
|
15
|
+
"license": "MIT",
|
|
16
16
|
"module": "fesm2022/kiwibit-chart.mjs",
|
|
17
|
-
"typings": "
|
|
17
|
+
"typings": "types/kiwibit-chart.d.ts",
|
|
18
18
|
"exports": {
|
|
19
19
|
"./package.json": {
|
|
20
20
|
"default": "./package.json"
|
|
21
21
|
},
|
|
22
22
|
".": {
|
|
23
|
-
"types": "./
|
|
23
|
+
"types": "./types/kiwibit-chart.d.ts",
|
|
24
24
|
"default": "./fesm2022/kiwibit-chart.mjs"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
File without changes
|