@eclipse-scout/chart 24.1.3 → 24.1.6
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/dist/d.ts/chart/AbstractChartRenderer.d.ts +10 -2
- package/dist/d.ts/chart/AbstractChartRenderer.d.ts.map +1 -1
- package/dist/d.ts/chart/Chart.d.ts.map +1 -1
- package/dist/d.ts/chart/ChartJsRenderer.d.ts +3 -1
- package/dist/d.ts/chart/ChartJsRenderer.d.ts.map +1 -1
- package/dist/d.ts/chart/VennChartRenderer.d.ts.map +1 -1
- package/dist/eclipse-scout-chart-3ba6b8f30d5806cac8ae.min.js +3 -0
- package/dist/eclipse-scout-chart-3ba6b8f30d5806cac8ae.min.js.map +1 -0
- package/dist/eclipse-scout-chart-theme-dark.css.map +1 -1
- package/dist/eclipse-scout-chart-theme.css.map +1 -1
- package/dist/eclipse-scout-chart.esm-8d9db200429e545abcae.min.js +3 -0
- package/dist/eclipse-scout-chart.esm-8d9db200429e545abcae.min.js.map +1 -0
- package/dist/eclipse-scout-chart.esm.js +93 -36
- package/dist/eclipse-scout-chart.esm.js.map +1 -1
- package/dist/eclipse-scout-chart.js +93 -36
- package/dist/eclipse-scout-chart.js.map +1 -1
- package/dist/file-list +4 -4
- package/package.json +3 -3
- package/src/chart/AbstractChartRenderer.ts +40 -6
- package/src/chart/Chart.ts +9 -2
- package/src/chart/ChartJsRenderer.ts +31 -11
- package/src/chart/VennChartRenderer.ts +6 -1
- package/dist/eclipse-scout-chart-1a81682e3fb823b0ca01.min.js +0 -3
- package/dist/eclipse-scout-chart-1a81682e3fb823b0ca01.min.js.map +0 -1
- package/dist/eclipse-scout-chart.esm-063bb266266e01e3ccd0.min.js +0 -3
- package/dist/eclipse-scout-chart.esm-063bb266266e01e3ccd0.min.js.map +0 -1
package/dist/file-list
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
eclipse-scout-chart-
|
|
2
|
-
eclipse-scout-chart-
|
|
1
|
+
eclipse-scout-chart-3ba6b8f30d5806cac8ae.min.js
|
|
2
|
+
eclipse-scout-chart-3ba6b8f30d5806cac8ae.min.js.map
|
|
3
3
|
eclipse-scout-chart-theme-56ba6667e592ef147869.min.css
|
|
4
4
|
eclipse-scout-chart-theme-dark-593955eea95984c5aa62.min.css
|
|
5
5
|
eclipse-scout-chart-theme-dark.css
|
|
6
6
|
eclipse-scout-chart-theme-dark.css.map
|
|
7
7
|
eclipse-scout-chart-theme.css
|
|
8
8
|
eclipse-scout-chart-theme.css.map
|
|
9
|
-
eclipse-scout-chart.esm-
|
|
10
|
-
eclipse-scout-chart.esm-
|
|
9
|
+
eclipse-scout-chart.esm-8d9db200429e545abcae.min.js
|
|
10
|
+
eclipse-scout-chart.esm-8d9db200429e545abcae.min.js.map
|
|
11
11
|
eclipse-scout-chart.esm.js
|
|
12
12
|
eclipse-scout-chart.esm.js.map
|
|
13
13
|
eclipse-scout-chart.js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-scout/chart",
|
|
3
|
-
"version": "24.1.
|
|
3
|
+
"version": "24.1.6",
|
|
4
4
|
"description": "Eclipse Scout chart",
|
|
5
5
|
"author": "BSI Business Systems Integration AG",
|
|
6
6
|
"homepage": "https://www.eclipse.org/scout",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"src"
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@eclipse-scout/cli": "24.1.
|
|
29
|
+
"@eclipse-scout/cli": "24.1.6",
|
|
30
30
|
"@eclipse-scout/releng": "^24.1.0",
|
|
31
31
|
"jasmine-core": "5.1.1",
|
|
32
32
|
"jasmine-jquery": "2.1.1",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/jasmine-jquery": "1.5.37"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@eclipse-scout/core": "24.1.
|
|
39
|
+
"@eclipse-scout/core": "24.1.6",
|
|
40
40
|
"jquery": "3.7.1",
|
|
41
41
|
"chart.js": "4.4.0",
|
|
42
42
|
"chartjs-plugin-datalabels": "2.2.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2010,
|
|
2
|
+
* Copyright (c) 2010, 2024 BSI Business Systems Integration AG
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import {Chart} from '../index';
|
|
12
|
-
import {arrays, Session} from '@eclipse-scout/core';
|
|
12
|
+
import {arrays, PropertyChangeEvent, PropertyEventEmitter, PropertyEventMap, Session} from '@eclipse-scout/core';
|
|
13
13
|
import {UpdateChartOptions} from './Chart';
|
|
14
14
|
|
|
15
|
-
export class AbstractChartRenderer {
|
|
15
|
+
export class AbstractChartRenderer extends PropertyEventEmitter {
|
|
16
|
+
declare eventMap: AbstractChartRendererEventMap;
|
|
17
|
+
|
|
16
18
|
chart: Chart;
|
|
17
19
|
session: Session;
|
|
18
20
|
|
|
@@ -25,6 +27,7 @@ export class AbstractChartRenderer {
|
|
|
25
27
|
firstOpaqueBackgroundColor: string;
|
|
26
28
|
|
|
27
29
|
constructor(chart: Chart) {
|
|
30
|
+
super();
|
|
28
31
|
this.chart = chart;
|
|
29
32
|
this.session = chart.session;
|
|
30
33
|
this.rendering = false;
|
|
@@ -87,14 +90,16 @@ export class AbstractChartRenderer {
|
|
|
87
90
|
* property is ignored when chart.config.options.animation.duration is <code>0</code>!
|
|
88
91
|
*/
|
|
89
92
|
render(requestAnimation: boolean) {
|
|
90
|
-
this.animationDuration = requestAnimation ? this.chart.config.options.animation.duration : 0;
|
|
91
93
|
if (!this.validate() || !this.chart.rendered) {
|
|
92
94
|
return;
|
|
93
95
|
}
|
|
96
|
+
const configAnimationDuration = this.chart.config.options.animation.duration;
|
|
97
|
+
this.setAnimationDuration(requestAnimation ? configAnimationDuration : 0);
|
|
94
98
|
this.rendering = true;
|
|
95
99
|
this._render();
|
|
96
100
|
this.rendering = false;
|
|
97
101
|
this.rendered = true;
|
|
102
|
+
this.setAnimationDuration(configAnimationDuration);
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
protected _render() {
|
|
@@ -121,11 +126,13 @@ export class AbstractChartRenderer {
|
|
|
121
126
|
this.render(requestAnimation);
|
|
122
127
|
return;
|
|
123
128
|
}
|
|
124
|
-
this.animationDuration = requestAnimation ? this.chart.config.options.animation.duration : 0;
|
|
125
129
|
if (!this.validate() || !this.isDataUpdatable()) {
|
|
126
130
|
return;
|
|
127
131
|
}
|
|
132
|
+
const configAnimationDuration = this.chart.config.options.animation.duration;
|
|
133
|
+
this.setAnimationDuration(requestAnimation ? configAnimationDuration : 0);
|
|
128
134
|
this._updateData();
|
|
135
|
+
this.setAnimationDuration(configAnimationDuration);
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
protected _updateData() {
|
|
@@ -136,6 +143,10 @@ export class AbstractChartRenderer {
|
|
|
136
143
|
return false;
|
|
137
144
|
}
|
|
138
145
|
|
|
146
|
+
isDetachSupported(): boolean {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
|
|
139
150
|
refresh() {
|
|
140
151
|
if (this.rendered) {
|
|
141
152
|
this.remove(false);
|
|
@@ -143,18 +154,37 @@ export class AbstractChartRenderer {
|
|
|
143
154
|
this.render(false);
|
|
144
155
|
}
|
|
145
156
|
|
|
157
|
+
setAnimationDuration(animationDuration: number) {
|
|
158
|
+
if (!this.setProperty('animationDuration', animationDuration)) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (this.rendered) {
|
|
162
|
+
this._renderAnimationDuration();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
protected _setAnimationDuration(animationDuration: number) {
|
|
167
|
+
this._setProperty('animationDuration', animationDuration);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
protected _renderAnimationDuration() {
|
|
171
|
+
// nop
|
|
172
|
+
}
|
|
173
|
+
|
|
146
174
|
/**
|
|
147
175
|
* @param requestAnimation
|
|
148
176
|
* Whether animations should be used while removing the chart. Note that his
|
|
149
177
|
* property is ignored when chart.config.options.animation.duration is <code>0</code>!
|
|
150
178
|
*/
|
|
151
179
|
remove(requestAnimation = false, afterRemoveFunc?: (chartAnimationStopping?: boolean) => void) {
|
|
152
|
-
|
|
180
|
+
const configAnimationDuration = this.chart.config.options.animation.duration;
|
|
181
|
+
this.setAnimationDuration(requestAnimation && configAnimationDuration);
|
|
153
182
|
if (this.animationDuration && this.rendered) {
|
|
154
183
|
this._removeAnimated(afterRemoveFunc);
|
|
155
184
|
} else {
|
|
156
185
|
this._remove(afterRemoveFunc);
|
|
157
186
|
}
|
|
187
|
+
this.setAnimationDuration(configAnimationDuration);
|
|
158
188
|
}
|
|
159
189
|
|
|
160
190
|
protected _remove(afterRemoveFunc: (chartAnimationStopping?: boolean) => void) {
|
|
@@ -174,3 +204,7 @@ export class AbstractChartRenderer {
|
|
|
174
204
|
return opts.requestAnimation;
|
|
175
205
|
}
|
|
176
206
|
}
|
|
207
|
+
|
|
208
|
+
export interface AbstractChartRendererEventMap extends PropertyEventMap {
|
|
209
|
+
'propertyChange:animationDuration': PropertyChangeEvent<number>;
|
|
210
|
+
}
|
package/src/chart/Chart.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2010,
|
|
2
|
+
* Copyright (c) 2010, 2024 BSI Business Systems Integration AG
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -107,7 +107,14 @@ export class Chart extends Widget implements ChartModel {
|
|
|
107
107
|
|
|
108
108
|
protected override _renderOnAttach() {
|
|
109
109
|
super._renderOnAttach();
|
|
110
|
-
this._updateChartOptsWhileNotAttached.splice(0)
|
|
110
|
+
const updateChartOptsWhileNotAttached = this._updateChartOptsWhileNotAttached.splice(0);
|
|
111
|
+
if (!this.chartRenderer?.isDetachSupported()) {
|
|
112
|
+
// the chartRenderer does not support detach => recreate it
|
|
113
|
+
this._updateChartRenderer();
|
|
114
|
+
updateChartOptsWhileNotAttached.forEach(opts => delete opts.requestAnimation);
|
|
115
|
+
updateChartOptsWhileNotAttached.push({requestAnimation: false});
|
|
116
|
+
}
|
|
117
|
+
updateChartOptsWhileNotAttached.forEach(opts => this.updateChart($.extend(true, {}, opts, {debounce: true})));
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
protected override _remove() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2010,
|
|
2
|
+
* Copyright (c) 2010, 2024 BSI Business Systems Integration AG
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -241,10 +241,10 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
241
241
|
}
|
|
242
242
|
let config = $.extend(true, {}, this.chart.config);
|
|
243
243
|
this._adjustConfig(config);
|
|
244
|
-
this._renderChart(config
|
|
244
|
+
this._renderChart(config);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
protected _renderChart(config: ChartConfig
|
|
247
|
+
protected _renderChart(config: ChartConfig) {
|
|
248
248
|
if (this.chartJs) {
|
|
249
249
|
this.chartJs.destroy();
|
|
250
250
|
}
|
|
@@ -253,11 +253,11 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
253
253
|
animation: {}
|
|
254
254
|
}
|
|
255
255
|
}, config);
|
|
256
|
-
config.options.animation.duration =
|
|
256
|
+
config.options.animation.duration = this.animationDuration;
|
|
257
257
|
|
|
258
258
|
this.chartJs = new ChartJs(this.$canvas[0].getContext('2d'), config as ChartConfiguration) as ChartJsChart;
|
|
259
259
|
this._adjustSize(this.chartJs.config, this.chartJs.chartArea);
|
|
260
|
-
this.
|
|
260
|
+
this.refresh();
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
protected override _updateData() {
|
|
@@ -435,16 +435,22 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
435
435
|
(axis.ticks || {} as (LinearScaleOptions | RadialLinearScaleOptions)['ticks']).stepSize = undefined;
|
|
436
436
|
});
|
|
437
437
|
|
|
438
|
-
this.
|
|
438
|
+
this.refresh();
|
|
439
439
|
|
|
440
440
|
this._adjustSize(this.chartJs.config, this.chartJs.chartArea);
|
|
441
|
-
this.
|
|
441
|
+
this.refresh();
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
override isDataUpdatable(): boolean {
|
|
445
445
|
return true;
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
+
override isDetachSupported(): boolean {
|
|
449
|
+
// chart.js removes the animation-listeners onProgress and onComplete on detach and does not add them again on attach
|
|
450
|
+
// these listeners are needed for the datalabels => this renderer does not support detach
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
|
|
448
454
|
override refresh() {
|
|
449
455
|
if (this.chartJs) {
|
|
450
456
|
this.chartJs.update();
|
|
@@ -453,9 +459,23 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
453
459
|
}
|
|
454
460
|
}
|
|
455
461
|
|
|
462
|
+
protected override _renderAnimationDuration() {
|
|
463
|
+
if (!this.chartJs) {
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
$.extend(true, this.chartJs.config, {
|
|
467
|
+
options: {
|
|
468
|
+
animation: {
|
|
469
|
+
duration: this.animationDuration
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
this.refresh();
|
|
474
|
+
}
|
|
475
|
+
|
|
456
476
|
protected override _renderCheckedItems() {
|
|
457
477
|
if (this.chartJs && this._checkItems(this.chartJs.config)) {
|
|
458
|
-
this.
|
|
478
|
+
this.refresh();
|
|
459
479
|
}
|
|
460
480
|
}
|
|
461
481
|
|
|
@@ -2249,7 +2269,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2249
2269
|
}
|
|
2250
2270
|
});
|
|
2251
2271
|
if (update) {
|
|
2252
|
-
this.
|
|
2272
|
+
this.refresh();
|
|
2253
2273
|
}
|
|
2254
2274
|
}
|
|
2255
2275
|
|
|
@@ -2297,7 +2317,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2297
2317
|
datasetType = dataset ? dataset.type : null;
|
|
2298
2318
|
if ((datasetType || type) === Chart.Type.LINE) {
|
|
2299
2319
|
this._setHoverBackgroundColor(dataset);
|
|
2300
|
-
this.
|
|
2320
|
+
this.refresh();
|
|
2301
2321
|
}
|
|
2302
2322
|
this._updateHoverStyle(index, true);
|
|
2303
2323
|
this.chartJs.render();
|
|
@@ -2328,7 +2348,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2328
2348
|
datasetType = dataset ? dataset.type : null;
|
|
2329
2349
|
if ((datasetType || type) === Chart.Type.LINE) {
|
|
2330
2350
|
this._restoreBackgroundColor(dataset);
|
|
2331
|
-
this.
|
|
2351
|
+
this.refresh();
|
|
2332
2352
|
}
|
|
2333
2353
|
this._updateHoverStyle(index, false);
|
|
2334
2354
|
this.chartJs.render();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2010,
|
|
2
|
+
* Copyright (c) 2010, 2024 BSI Business Systems Integration AG
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -103,6 +103,8 @@ export class VennChartRenderer extends AbstractSvgChartRenderer {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// Final callback
|
|
106
|
+
// In the case of 3 circles, draw will be called async after render is completed. Therefore, the current animationDuration needs to be set again when _draw is finally called.
|
|
107
|
+
const animationDurationRender = this.animationDuration;
|
|
106
108
|
let draw = function() {
|
|
107
109
|
this.readyToDraw = true;
|
|
108
110
|
if (!this.$svg.isAttached()) {
|
|
@@ -110,7 +112,10 @@ export class VennChartRenderer extends AbstractSvgChartRenderer {
|
|
|
110
112
|
return;
|
|
111
113
|
}
|
|
112
114
|
this.readyToDraw = false;
|
|
115
|
+
const animationDuration = this.animationDuration;
|
|
116
|
+
this.setAnimationDuration(animationDurationRender);
|
|
113
117
|
this._draw(true, true);
|
|
118
|
+
this.setAnimationDuration(animationDuration);
|
|
114
119
|
}.bind(this);
|
|
115
120
|
|
|
116
121
|
// save callback if user navigated away while calculating and _draw is not executed.
|