@kiwibit/chart 15.0.1 → 16.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.
- package/README.md +2 -0
- package/{esm2020 → esm2022}/kiwibit-chart.mjs +4 -4
- package/esm2022/lib/chart.component.mjs +456 -0
- package/{esm2020 → esm2022}/lib/chart.module.mjs +43 -43
- package/{esm2020 → esm2022}/lib/constants/chart.constants.mjs +3 -3
- package/{esm2020 → esm2022}/lib/models/chart.models.mjs +27 -27
- package/{esm2020 → esm2022}/public-api.mjs +7 -7
- package/{fesm2020 → fesm2022}/kiwibit-chart.mjs +484 -433
- package/fesm2022/kiwibit-chart.mjs.map +1 -0
- package/index.d.ts +5 -5
- package/lib/chart.component.d.ts +111 -101
- package/lib/chart.module.d.ts +9 -9
- package/lib/constants/chart.constants.d.ts +3 -3
- package/lib/models/chart.models.d.ts +172 -172
- package/package.json +9 -14
- package/public-api.d.ts +4 -4
- package/esm2020/lib/chart.component.mjs +0 -405
- package/fesm2015/kiwibit-chart.mjs +0 -495
- package/fesm2015/kiwibit-chart.mjs.map +0 -1
- package/fesm2020/kiwibit-chart.mjs.map +0 -1
|
@@ -10,394 +10,444 @@ import { TitleComponent, TooltipComponent, GridComponent, LegendComponent, DataZ
|
|
|
10
10
|
import { LineChart, ScatterChart } from 'echarts/charts';
|
|
11
11
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
12
12
|
|
|
13
|
-
const ADD_POINT_IMG_OFF_LIGHT = "image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAADkUlEQVR4nO2bz0sUYRjHv8/otviDGDuWrhKdskBaQZi57MmLgVpIkJ06bH9AEdF/kF46dEg726liBSGwBEFnTm0oaF3s4lhdh1BhNuTpsDPLu+MvmHXm0ZzP6X2feWfn+3x33nf3fXlfIOV8Q0dd7O3tvaDr+igzDxPRLQCdANqSkRaZHQBbzPyVi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|
-
var TraceType;
|
|
18
|
-
(function (TraceType) {
|
|
19
|
-
TraceType["LINE"] = "line";
|
|
20
|
-
TraceType["SCATTER"] = "scatter";
|
|
21
|
-
})(TraceType || (TraceType = {}));
|
|
22
|
-
var PointSymbol;
|
|
23
|
-
(function (PointSymbol) {
|
|
24
|
-
PointSymbol["NONE"] = "none";
|
|
25
|
-
PointSymbol["CIRCLE"] = "circle";
|
|
26
|
-
PointSymbol["TRIANGLE"] = "triangle";
|
|
27
|
-
PointSymbol["PIN"] = "pin";
|
|
28
|
-
PointSymbol["DIAMOND"] = "diamond";
|
|
29
|
-
})(PointSymbol || (PointSymbol = {}));
|
|
30
|
-
var TraceStyle;
|
|
31
|
-
(function (TraceStyle) {
|
|
32
|
-
TraceStyle["SOLID"] = "solid";
|
|
33
|
-
TraceStyle["DASHED"] = "dashed";
|
|
34
|
-
TraceStyle["DOTTED"] = "dotted";
|
|
35
|
-
})(TraceStyle || (TraceStyle = {}));
|
|
36
|
-
var AxisType;
|
|
37
|
-
(function (AxisType) {
|
|
38
|
-
AxisType["VALUE"] = "value";
|
|
39
|
-
})(AxisType || (AxisType = {}));
|
|
40
|
-
var ShapeVariant;
|
|
41
|
-
(function (ShapeVariant) {
|
|
42
|
-
ShapeVariant[ShapeVariant["TRACE"] = 0] = "TRACE";
|
|
17
|
+
var TraceType;
|
|
18
|
+
(function (TraceType) {
|
|
19
|
+
TraceType["LINE"] = "line";
|
|
20
|
+
TraceType["SCATTER"] = "scatter";
|
|
21
|
+
})(TraceType || (TraceType = {}));
|
|
22
|
+
var PointSymbol;
|
|
23
|
+
(function (PointSymbol) {
|
|
24
|
+
PointSymbol["NONE"] = "none";
|
|
25
|
+
PointSymbol["CIRCLE"] = "circle";
|
|
26
|
+
PointSymbol["TRIANGLE"] = "triangle";
|
|
27
|
+
PointSymbol["PIN"] = "pin";
|
|
28
|
+
PointSymbol["DIAMOND"] = "diamond";
|
|
29
|
+
})(PointSymbol || (PointSymbol = {}));
|
|
30
|
+
var TraceStyle;
|
|
31
|
+
(function (TraceStyle) {
|
|
32
|
+
TraceStyle["SOLID"] = "solid";
|
|
33
|
+
TraceStyle["DASHED"] = "dashed";
|
|
34
|
+
TraceStyle["DOTTED"] = "dotted";
|
|
35
|
+
})(TraceStyle || (TraceStyle = {}));
|
|
36
|
+
var AxisType;
|
|
37
|
+
(function (AxisType) {
|
|
38
|
+
AxisType["VALUE"] = "value";
|
|
39
|
+
})(AxisType || (AxisType = {}));
|
|
40
|
+
var ShapeVariant;
|
|
41
|
+
(function (ShapeVariant) {
|
|
42
|
+
ShapeVariant[ShapeVariant["TRACE"] = 0] = "TRACE";
|
|
43
43
|
})(ShapeVariant || (ShapeVariant = {}));
|
|
44
44
|
|
|
45
|
-
// Angular General
|
|
46
|
-
class KiwiChartComponent {
|
|
47
|
-
constructor(cd) {
|
|
48
|
-
this.cd = cd;
|
|
49
|
-
/**
|
|
50
|
-
* The Chart Object rendered by the canvas. For all the available options refer
|
|
51
|
-
* to Chart interface in the models folder.
|
|
52
|
-
*
|
|
53
|
-
* @type {(Chart | null)}
|
|
54
|
-
* @memberof KiwiChartComponent
|
|
55
|
-
*/
|
|
56
|
-
this.chart = null;
|
|
57
|
-
/**
|
|
58
|
-
* Width and Height of the chart area. The dimensions refer to the father component
|
|
59
|
-
* into which the kiwi-chart is inserted. For example in an empty page the width/height
|
|
60
|
-
* of the chart can take the whole available space in the page.
|
|
61
|
-
*
|
|
62
|
-
* @type {string}
|
|
63
|
-
* @memberof KiwiChartComponent
|
|
64
|
-
*/
|
|
65
|
-
this.width = '100%';
|
|
66
|
-
this.height = '480px';
|
|
67
|
-
/**
|
|
68
|
-
* This property simply activates or not the dark theme of the chart
|
|
69
|
-
* defined by the Echarts library. In addition the background color can be custom
|
|
70
|
-
* so that the chart can match the background of the application in which it's used.
|
|
71
|
-
*
|
|
72
|
-
* @type {boolean}
|
|
73
|
-
* @memberof KiwiChartComponent
|
|
74
|
-
*/
|
|
75
|
-
this.darkTheme = false;
|
|
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 KiwiChartComponent
|
|
83
|
-
*/
|
|
84
|
-
this.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 KiwiChartComponent
|
|
91
|
-
*/
|
|
92
|
-
this.chartHover = new EventEmitter();
|
|
93
|
-
/**
|
|
94
|
-
* The object used by echarts to initially create the Chart.
|
|
95
|
-
* Has a default configuration that can be totally overrided using specific properties.
|
|
96
|
-
*
|
|
97
|
-
* @type {EChartsOption}
|
|
98
|
-
* @memberof KiwiChartComponent
|
|
99
|
-
*/
|
|
100
|
-
this.chartOption = {
|
|
101
|
-
title: {
|
|
102
|
-
text: 'Kiwi Chart'
|
|
103
|
-
},
|
|
104
|
-
xAxis: {
|
|
105
|
-
name: 'X'
|
|
106
|
-
},
|
|
107
|
-
yAxis: {
|
|
108
|
-
name: 'Y'
|
|
109
|
-
},
|
|
110
|
-
series: [
|
|
111
|
-
{
|
|
112
|
-
type: TraceType.LINE,
|
|
113
|
-
data: [[0, 0]]
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* The instance of the Chart.
|
|
119
|
-
*
|
|
120
|
-
* @type {(ECharts | null)}
|
|
121
|
-
* @memberof KiwiChartComponent
|
|
122
|
-
*/
|
|
123
|
-
this.echartsInstance = null;
|
|
124
|
-
/**
|
|
125
|
-
* Used to perform actions (as point addition based on the cursor position) on the chart.
|
|
126
|
-
*
|
|
127
|
-
* @type {(zrender.ZRenderType | null)}
|
|
128
|
-
* @memberof KiwiChartComponent
|
|
129
|
-
*/
|
|
130
|
-
this.zr = null;
|
|
131
|
-
/**
|
|
132
|
-
* Subject used to unsubscribe once the component gets destroyed.
|
|
133
|
-
*
|
|
134
|
-
* @private
|
|
135
|
-
* @type {Subject<void>}
|
|
136
|
-
* @memberof KiwiChartComponent
|
|
137
|
-
*/
|
|
138
|
-
this.destroyed$ = new Subject();
|
|
139
|
-
/**
|
|
140
|
-
* Default number of decimals that can have
|
|
141
|
-
* the values on the x and y axes.
|
|
142
|
-
*
|
|
143
|
-
* @private
|
|
144
|
-
* @type {number}
|
|
145
|
-
* @memberof KiwiChartComponent
|
|
146
|
-
*/
|
|
147
|
-
this.MAX_DECIMALS = 3;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
this.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
},
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
45
|
+
// Angular General
|
|
46
|
+
class KiwiChartComponent {
|
|
47
|
+
constructor(cd) {
|
|
48
|
+
this.cd = cd;
|
|
49
|
+
/**
|
|
50
|
+
* The Chart Object rendered by the canvas. For all the available options refer
|
|
51
|
+
* to Chart interface in the models folder.
|
|
52
|
+
*
|
|
53
|
+
* @type {(Chart | null)}
|
|
54
|
+
* @memberof KiwiChartComponent
|
|
55
|
+
*/
|
|
56
|
+
this.chart = null;
|
|
57
|
+
/**
|
|
58
|
+
* Width and Height of the chart area. The dimensions refer to the father component
|
|
59
|
+
* into which the kiwi-chart is inserted. For example in an empty page the width/height
|
|
60
|
+
* of the chart can take the whole available space in the page.
|
|
61
|
+
*
|
|
62
|
+
* @type {string}
|
|
63
|
+
* @memberof KiwiChartComponent
|
|
64
|
+
*/
|
|
65
|
+
this.width = '100%';
|
|
66
|
+
this.height = '480px';
|
|
67
|
+
/**
|
|
68
|
+
* This property simply activates or not the dark theme of the chart
|
|
69
|
+
* defined by the Echarts library. In addition the background color can be custom
|
|
70
|
+
* so that the chart can match the background of the application in which it's used.
|
|
71
|
+
*
|
|
72
|
+
* @type {boolean}
|
|
73
|
+
* @memberof KiwiChartComponent
|
|
74
|
+
*/
|
|
75
|
+
this.darkTheme = false;
|
|
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 KiwiChartComponent
|
|
83
|
+
*/
|
|
84
|
+
this.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 KiwiChartComponent
|
|
91
|
+
*/
|
|
92
|
+
this.chartHover = new EventEmitter();
|
|
93
|
+
/**
|
|
94
|
+
* The object used by echarts to initially create the Chart.
|
|
95
|
+
* Has a default configuration that can be totally overrided using specific properties.
|
|
96
|
+
*
|
|
97
|
+
* @type {EChartsOption}
|
|
98
|
+
* @memberof KiwiChartComponent
|
|
99
|
+
*/
|
|
100
|
+
this.chartOption = {
|
|
101
|
+
title: {
|
|
102
|
+
text: 'Kiwi Chart'
|
|
103
|
+
},
|
|
104
|
+
xAxis: {
|
|
105
|
+
name: 'X'
|
|
106
|
+
},
|
|
107
|
+
yAxis: {
|
|
108
|
+
name: 'Y'
|
|
109
|
+
},
|
|
110
|
+
series: [
|
|
111
|
+
{
|
|
112
|
+
type: TraceType.LINE,
|
|
113
|
+
data: [[0, 0]]
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* The instance of the Chart.
|
|
119
|
+
*
|
|
120
|
+
* @type {(ECharts | null)}
|
|
121
|
+
* @memberof KiwiChartComponent
|
|
122
|
+
*/
|
|
123
|
+
this.echartsInstance = null;
|
|
124
|
+
/**
|
|
125
|
+
* Used to perform actions (as point addition based on the cursor position) on the chart.
|
|
126
|
+
*
|
|
127
|
+
* @type {(zrender.ZRenderType | null)}
|
|
128
|
+
* @memberof KiwiChartComponent
|
|
129
|
+
*/
|
|
130
|
+
this.zr = null;
|
|
131
|
+
/**
|
|
132
|
+
* Subject used to unsubscribe once the component gets destroyed.
|
|
133
|
+
*
|
|
134
|
+
* @private
|
|
135
|
+
* @type {Subject<void>}
|
|
136
|
+
* @memberof KiwiChartComponent
|
|
137
|
+
*/
|
|
138
|
+
this.destroyed$ = new Subject();
|
|
139
|
+
/**
|
|
140
|
+
* Default number of decimals that can have
|
|
141
|
+
* the values on the x and y axes.
|
|
142
|
+
*
|
|
143
|
+
* @private
|
|
144
|
+
* @type {number}
|
|
145
|
+
* @memberof KiwiChartComponent
|
|
146
|
+
*/
|
|
147
|
+
this.MAX_DECIMALS = 3;
|
|
148
|
+
this.legendSelected = {};
|
|
149
|
+
this.isLegendClicked = false;
|
|
150
|
+
}
|
|
151
|
+
ngOnInit() {
|
|
152
|
+
/**
|
|
153
|
+
* This is a manual change detection running every 200ms, the memory should not be much afflicted.
|
|
154
|
+
* It's necessary because when interacting with the chart (for example addPoint),
|
|
155
|
+
* Angular loses the change detection and the point is not added in the chart canvas.
|
|
156
|
+
*/
|
|
157
|
+
interval(200)
|
|
158
|
+
.pipe(takeUntil(this.destroyed$))
|
|
159
|
+
.subscribe({
|
|
160
|
+
next: () => {
|
|
161
|
+
this.cd.detectChanges();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
onChartInit(ec) {
|
|
166
|
+
this.echartsInstance = ec;
|
|
167
|
+
this.setupZrEventHandler(ec);
|
|
168
|
+
this.setupLegendEventHandler(ec);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* intercept a selection change event on the legend and save the state
|
|
172
|
+
* of all selections on the supporting variable legendSelected
|
|
173
|
+
*
|
|
174
|
+
* @param ec
|
|
175
|
+
*/
|
|
176
|
+
setupLegendEventHandler(ec) {
|
|
177
|
+
if (this.echartsInstance != null) {
|
|
178
|
+
this.echartsInstance.on('legendselectchanged', (params) => {
|
|
179
|
+
this.isLegendClicked = true;
|
|
180
|
+
this.legendSelected = params.selected;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
setupZrEventHandler(ec) {
|
|
185
|
+
this.zr = ec.getZr();
|
|
186
|
+
/**
|
|
187
|
+
* Intercepts the click event on the chart (if the clickToAddPoint property is set to true)
|
|
188
|
+
* and emits the point coordinates to the father component.
|
|
189
|
+
*/
|
|
190
|
+
this.zr.on('click', params => {
|
|
191
|
+
let option = ec.getOption();
|
|
192
|
+
let active = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;
|
|
193
|
+
if (active && this.chart?.clickToAddPoint) {
|
|
194
|
+
const pointInPixel = [params.offsetX, params.offsetY];
|
|
195
|
+
const pointInGrid = ec.convertFromPixel('grid', pointInPixel);
|
|
196
|
+
if (ec.containPixel('grid', pointInPixel) && pointInGrid) {
|
|
197
|
+
let newPoint = {
|
|
198
|
+
x: +pointInGrid[0].toFixed(3),
|
|
199
|
+
y: +pointInGrid[1].toFixed(3)
|
|
200
|
+
};
|
|
201
|
+
this.addPoint.emit(newPoint);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
/**
|
|
206
|
+
* This is used perform custom actions when the mouse is hovering the chart area
|
|
207
|
+
*/
|
|
208
|
+
this.zr.on('mousemove', params => {
|
|
209
|
+
const pointInPixel = [params.offsetX, params.offsetY];
|
|
210
|
+
const pointInGrid = ec.convertFromPixel('grid', pointInPixel);
|
|
211
|
+
/*
|
|
212
|
+
* Logic to emit to the father component the x and y cdinates when the
|
|
213
|
+
* cursor is hovering the chart area .
|
|
214
|
+
*/
|
|
215
|
+
if (ec.containPixel('grid', pointInPixel) && pointInGrid) {
|
|
216
|
+
let newPoint = {
|
|
217
|
+
x: +pointInGrid[0].toFixed(3),
|
|
218
|
+
y: +pointInGrid[1].toFixed(3)
|
|
219
|
+
};
|
|
220
|
+
this.chartHover.emit(newPoint);
|
|
221
|
+
}
|
|
222
|
+
/* Logic to change the cursor icon when the "Click to Add Point" feature is active and viceversa. */
|
|
223
|
+
const option = ec.getOption();
|
|
224
|
+
const addPointIsActive = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;
|
|
225
|
+
if (addPointIsActive) {
|
|
226
|
+
this.zr?.setCursorStyle(ec.containPixel('grid', pointInPixel) ? 'copy' : 'default');
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
getLegendItemSelection(shape) {
|
|
231
|
+
if (this.isLegendClicked) {
|
|
232
|
+
return this.legendSelected[shape.name] ?? true;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
return shape.selectedByDefault ?? true;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
ngOnChanges(changes) {
|
|
239
|
+
let chart = changes['chart']?.currentValue;
|
|
240
|
+
if (chart) {
|
|
241
|
+
this.chartOption = {
|
|
242
|
+
title: {
|
|
243
|
+
text: chart.title,
|
|
244
|
+
},
|
|
245
|
+
grid: {
|
|
246
|
+
width: '70%'
|
|
247
|
+
},
|
|
248
|
+
backgroundColor: this.darkTheme ? this.darkThemeBackground ?? '#303030' : 'transparent', tooltip: {
|
|
249
|
+
axisPointer: {
|
|
250
|
+
type: 'cross',
|
|
251
|
+
crossStyle: {
|
|
252
|
+
color: '#bebebe'
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
toolbox: {
|
|
257
|
+
orient: 'horizontal',
|
|
258
|
+
left: 'center',
|
|
259
|
+
top: '25px',
|
|
260
|
+
feature: {
|
|
261
|
+
dataZoom: {
|
|
262
|
+
brushStyle: {
|
|
263
|
+
borderColor: '#000',
|
|
264
|
+
borderWidth: 1,
|
|
265
|
+
borderType: 'dashed'
|
|
266
|
+
},
|
|
267
|
+
emphasis: {
|
|
268
|
+
iconStyle: {
|
|
269
|
+
textPosition: 'top'
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
saveAsImage: {
|
|
274
|
+
emphasis: {
|
|
275
|
+
iconStyle: {
|
|
276
|
+
textPosition: 'top'
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
restore: {
|
|
281
|
+
emphasis: {
|
|
282
|
+
iconStyle: {
|
|
283
|
+
textPosition: 'top'
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
myAddPoint: {
|
|
288
|
+
show: chart.clickToAddPoint ?? false,
|
|
289
|
+
title: chart.addPointCustomName ?? 'Add Point',
|
|
290
|
+
icon: this.darkTheme ? ADD_POINT_IMG_OFF_DARK : ADD_POINT_IMG_OFF_LIGHT,
|
|
291
|
+
iconStatus: false,
|
|
292
|
+
onclick: () => {
|
|
293
|
+
let option = this.echartsInstance?.getOption();
|
|
294
|
+
let status = option.toolbox[0].feature.myAddPoint.iconStatus;
|
|
295
|
+
this.echartsInstance?.setOption({
|
|
296
|
+
toolbox: {
|
|
297
|
+
feature: {
|
|
298
|
+
myAddPoint: {
|
|
299
|
+
iconStatus: !status,
|
|
300
|
+
icon: !status ? ADD_POINT_IMG_ON : this.darkTheme ? ADD_POINT_IMG_OFF_DARK : ADD_POINT_IMG_OFF_LIGHT
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
},
|
|
306
|
+
emphasis: {
|
|
307
|
+
iconStyle: {
|
|
308
|
+
textPosition: 'top'
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
dataZoom: [
|
|
315
|
+
{
|
|
316
|
+
type: 'inside',
|
|
317
|
+
xAxisIndex: [0],
|
|
318
|
+
throttle: 0,
|
|
319
|
+
filterMode: 'none',
|
|
320
|
+
disabled: !chart.scrollToZoom ?? true
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
type: 'inside',
|
|
324
|
+
yAxisIndex: [0],
|
|
325
|
+
throttle: 0,
|
|
326
|
+
filterMode: 'none',
|
|
327
|
+
disabled: !chart.scrollToZoom ?? true
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
legend: {
|
|
331
|
+
inactiveColor: this.darkTheme ? '#8b8b8b' : '#ccc',
|
|
332
|
+
data: chart.shapes.map((shape) => ({
|
|
333
|
+
name: shape.name,
|
|
334
|
+
icon: 'circle',
|
|
335
|
+
})),
|
|
336
|
+
selected: chart.shapes.reduce((accumulator, shape) => ({
|
|
337
|
+
...accumulator,
|
|
338
|
+
[shape.name]: this.getLegendItemSelection(shape),
|
|
339
|
+
}), {}),
|
|
340
|
+
show: chart.showLegend ?? false,
|
|
341
|
+
orient: 'vertical',
|
|
342
|
+
left: 'right',
|
|
343
|
+
padding: [60, 20],
|
|
344
|
+
type: 'scroll',
|
|
345
|
+
textStyle: {
|
|
346
|
+
width: 120,
|
|
347
|
+
fontWeight: 'bold',
|
|
348
|
+
overflow: 'break'
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
xAxis: {
|
|
352
|
+
type: chart.xAxisType,
|
|
353
|
+
name: chart.xAxisUom ? `${chart.xAxisName} [ ${chart.xAxisUom} ]` : chart.xAxisName,
|
|
354
|
+
nameLocation: 'middle',
|
|
355
|
+
nameGap: 30,
|
|
356
|
+
splitLine: {
|
|
357
|
+
show: chart.showGrid ?? true,
|
|
358
|
+
lineStyle: {
|
|
359
|
+
color: this.darkTheme ? '#595959' : '#ccc'
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
min: chart.xMin?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),
|
|
363
|
+
max: chart.xMax?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),
|
|
364
|
+
},
|
|
365
|
+
yAxis: {
|
|
366
|
+
type: chart.yAxisType,
|
|
367
|
+
name: chart.yAxisUom ? `${chart.yAxisName} [ ${chart.yAxisUom} ]` : chart.yAxisName,
|
|
368
|
+
nameLocation: 'middle',
|
|
369
|
+
nameGap: 50,
|
|
370
|
+
splitLine: {
|
|
371
|
+
show: chart.showGrid ?? true,
|
|
372
|
+
lineStyle: {
|
|
373
|
+
color: this.darkTheme ? '#595959' : '#ccc'
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
min: chart.yMin?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),
|
|
377
|
+
max: chart.yMax?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),
|
|
378
|
+
},
|
|
379
|
+
series: this.createSeries(chart.shapes),
|
|
380
|
+
animation: chart.hasAnimations,
|
|
381
|
+
animationDuration: chart.animationDuration ?? 500,
|
|
382
|
+
animationEasing: 'cubicOut'
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
createSeries(shapes) {
|
|
387
|
+
let series = [];
|
|
388
|
+
shapes.forEach((shape) => {
|
|
389
|
+
switch (shape.variant) {
|
|
390
|
+
case ShapeVariant.TRACE:
|
|
391
|
+
series.push(this.createTrace(shape));
|
|
392
|
+
break;
|
|
393
|
+
default:
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
return series;
|
|
398
|
+
}
|
|
399
|
+
createTrace(trace) {
|
|
400
|
+
return {
|
|
401
|
+
type: trace.type,
|
|
402
|
+
name: trace.name,
|
|
403
|
+
data: trace.points.map((point) => ({
|
|
404
|
+
value: [point.x, point.y],
|
|
405
|
+
symbol: point.symbol ?? 'circle',
|
|
406
|
+
name: point.name,
|
|
407
|
+
symbolSize: point.symbolSize ?? 2,
|
|
408
|
+
itemStyle: {
|
|
409
|
+
color: point.color
|
|
410
|
+
},
|
|
411
|
+
emphasis: {
|
|
412
|
+
disabled: true
|
|
413
|
+
},
|
|
414
|
+
label: {
|
|
415
|
+
show: true,
|
|
416
|
+
position: 'bottom',
|
|
417
|
+
align: 'left',
|
|
418
|
+
verticalAlign: 'bottom',
|
|
419
|
+
formatter: () => `${point.name ?? ''}`,
|
|
420
|
+
fontSize: 13,
|
|
421
|
+
padding: [0, 0, 0, 10],
|
|
422
|
+
width: 100,
|
|
423
|
+
overflow: 'truncate',
|
|
424
|
+
ellipsis: '...',
|
|
425
|
+
fontWeight: 'bold',
|
|
426
|
+
color: this.darkTheme ? '#fff' : '#000'
|
|
427
|
+
},
|
|
428
|
+
tooltip: {
|
|
378
429
|
formatter: ({ value }) => `
|
|
379
430
|
<strong>${this.chart?.xAxisName}:</strong> ${value[0].toFixed(3).replace(/[.,]000$/, "")}
|
|
380
431
|
<br>
|
|
381
432
|
<strong>${this.chart?.yAxisName}:</strong> ${value[1].toFixed(3).replace(/[.,]000$/, "")}
|
|
382
|
-
`
|
|
383
|
-
}
|
|
384
|
-
})),
|
|
385
|
-
color: trace.color,
|
|
386
|
-
lineStyle: {
|
|
387
|
-
width: trace.width,
|
|
388
|
-
type: trace.style,
|
|
389
|
-
opacity: trace.opacity ?? 1
|
|
390
|
-
},
|
|
391
|
-
smooth: trace.smooth ?? false
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
ngOnDestroy() {
|
|
395
|
-
this.destroyed$.next();
|
|
396
|
-
this.destroyed$.complete();
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
KiwiChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: KiwiChartComponent, selector: "kiwi-chart", inputs: { chart: "chart", width: "width", height: "height", darkTheme: "darkTheme", darkThemeBackground: "darkThemeBackground" }, outputs: { addPoint: "addPoint", chartHover: "chartHover" }, usesOnChanges: true, ngImport: i0, template: `
|
|
433
|
+
`
|
|
434
|
+
}
|
|
435
|
+
})),
|
|
436
|
+
color: trace.color,
|
|
437
|
+
lineStyle: {
|
|
438
|
+
width: trace.width,
|
|
439
|
+
type: trace.style,
|
|
440
|
+
opacity: trace.opacity ?? 1
|
|
441
|
+
},
|
|
442
|
+
smooth: trace.smooth ?? false
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
ngOnDestroy() {
|
|
446
|
+
this.destroyed$.next();
|
|
447
|
+
this.destroyed$.complete();
|
|
448
|
+
}
|
|
449
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: KiwiChartComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
450
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: KiwiChartComponent, selector: "kiwi-chart", inputs: { chart: "chart", width: "width", height: "height", darkTheme: "darkTheme", darkThemeBackground: "darkThemeBackground" }, outputs: { addPoint: "addPoint", chartHover: "chartHover" }, usesOnChanges: true, ngImport: i0, template: `
|
|
401
451
|
<div
|
|
402
452
|
echarts
|
|
403
453
|
[options]="chartOption"
|
|
@@ -408,9 +458,10 @@ KiwiChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ver
|
|
|
408
458
|
(chartInit)="onChartInit($event)"
|
|
409
459
|
[theme]="darkTheme ? 'dark' : ''"
|
|
410
460
|
></div>
|
|
411
|
-
`, isInline: true, styles: [""], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "
|
|
412
|
-
|
|
413
|
-
|
|
461
|
+
`, isInline: true, styles: [""], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] }); }
|
|
462
|
+
}
|
|
463
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: KiwiChartComponent, decorators: [{
|
|
464
|
+
type: Component,
|
|
414
465
|
args: [{ selector: 'kiwi-chart', template: `
|
|
415
466
|
<div
|
|
416
467
|
echarts
|
|
@@ -422,62 +473,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
|
|
|
422
473
|
(chartInit)="onChartInit($event)"
|
|
423
474
|
[theme]="darkTheme ? 'dark' : ''"
|
|
424
475
|
></div>
|
|
425
|
-
` }]
|
|
426
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { chart: [{
|
|
427
|
-
type: Input
|
|
428
|
-
}], width: [{
|
|
429
|
-
type: Input
|
|
430
|
-
}], height: [{
|
|
431
|
-
type: Input
|
|
432
|
-
}], darkTheme: [{
|
|
433
|
-
type: Input
|
|
434
|
-
}], darkThemeBackground: [{
|
|
435
|
-
type: Input
|
|
436
|
-
}], addPoint: [{
|
|
437
|
-
type: Output
|
|
438
|
-
}], chartHover: [{
|
|
439
|
-
type: Output
|
|
476
|
+
` }]
|
|
477
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { chart: [{
|
|
478
|
+
type: Input
|
|
479
|
+
}], width: [{
|
|
480
|
+
type: Input
|
|
481
|
+
}], height: [{
|
|
482
|
+
type: Input
|
|
483
|
+
}], darkTheme: [{
|
|
484
|
+
type: Input
|
|
485
|
+
}], darkThemeBackground: [{
|
|
486
|
+
type: Input
|
|
487
|
+
}], addPoint: [{
|
|
488
|
+
type: Output
|
|
489
|
+
}], chartHover: [{
|
|
490
|
+
type: Output
|
|
440
491
|
}] } });
|
|
441
492
|
|
|
442
|
-
echarts.use([
|
|
443
|
-
TitleComponent,
|
|
444
|
-
TooltipComponent,
|
|
445
|
-
GridComponent,
|
|
446
|
-
LineChart,
|
|
447
|
-
CanvasRenderer,
|
|
448
|
-
LegendComponent,
|
|
449
|
-
DataZoomComponent,
|
|
450
|
-
ToolboxComponent,
|
|
451
|
-
ScatterChart
|
|
452
|
-
]);
|
|
453
|
-
class KiwiChartModule {
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
460
|
-
type: NgModule,
|
|
461
|
-
args: [{
|
|
462
|
-
declarations: [
|
|
463
|
-
KiwiChartComponent
|
|
464
|
-
],
|
|
465
|
-
imports: [
|
|
466
|
-
CommonModule,
|
|
467
|
-
NgxEchartsModule.forRoot({ echarts })
|
|
468
|
-
],
|
|
469
|
-
exports: [
|
|
470
|
-
KiwiChartComponent
|
|
471
|
-
]
|
|
472
|
-
}]
|
|
493
|
+
echarts.use([
|
|
494
|
+
TitleComponent,
|
|
495
|
+
TooltipComponent,
|
|
496
|
+
GridComponent,
|
|
497
|
+
LineChart,
|
|
498
|
+
CanvasRenderer,
|
|
499
|
+
LegendComponent,
|
|
500
|
+
DataZoomComponent,
|
|
501
|
+
ToolboxComponent,
|
|
502
|
+
ScatterChart
|
|
503
|
+
]);
|
|
504
|
+
class KiwiChartModule {
|
|
505
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: KiwiChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
506
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: KiwiChartModule, declarations: [KiwiChartComponent], imports: [CommonModule, i2.NgxEchartsModule], exports: [KiwiChartComponent] }); }
|
|
507
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: KiwiChartModule, imports: [CommonModule,
|
|
508
|
+
NgxEchartsModule.forRoot({ echarts })] }); }
|
|
509
|
+
}
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: KiwiChartModule, decorators: [{
|
|
511
|
+
type: NgModule,
|
|
512
|
+
args: [{
|
|
513
|
+
declarations: [
|
|
514
|
+
KiwiChartComponent
|
|
515
|
+
],
|
|
516
|
+
imports: [
|
|
517
|
+
CommonModule,
|
|
518
|
+
NgxEchartsModule.forRoot({ echarts })
|
|
519
|
+
],
|
|
520
|
+
exports: [
|
|
521
|
+
KiwiChartComponent
|
|
522
|
+
]
|
|
523
|
+
}]
|
|
473
524
|
}] });
|
|
474
525
|
|
|
475
|
-
/*
|
|
476
|
-
* Public API Surface of chart
|
|
526
|
+
/*
|
|
527
|
+
* Public API Surface of chart
|
|
477
528
|
*/
|
|
478
529
|
|
|
479
|
-
/**
|
|
480
|
-
* Generated bundle index. Do not edit.
|
|
530
|
+
/**
|
|
531
|
+
* Generated bundle index. Do not edit.
|
|
481
532
|
*/
|
|
482
533
|
|
|
483
534
|
export { ADD_POINT_IMG_OFF_DARK, ADD_POINT_IMG_OFF_LIGHT, ADD_POINT_IMG_ON, AxisType, KiwiChartComponent, KiwiChartModule, PointSymbol, ShapeVariant, TraceStyle, TraceType };
|