jmchart 1.2.13 → 1.2.16
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/jmchart.amd.js +1389 -1218
- package/dist/jmchart.cjs.js +1389 -1218
- package/dist/jmchart.esm.js +1389 -1218
- package/dist/jmchart.iife.js +1389 -1218
- package/dist/jmchart.system.js +1389 -1218
- package/package.json +2 -2
- package/src/component/vchart.js +24 -3
- package/src/core/axis/axis.js +6 -3
- package/src/core/markLine/manager.js +2 -6
- package/src/jmChart.js +40 -49
- package/src/series/areaSeries.js +7 -230
- package/src/series/barSeries.js +3 -6
- package/src/series/bubbleSeries.js +1 -4
- package/src/series/candlestickSeries.js +5 -4
- package/src/series/gaugeSeries.js +1 -4
- package/src/series/heatmapSeries.js +1 -4
- package/src/series/lineSeries.js +1 -4
- package/src/series/pieSeries.js +5 -3
- package/src/series/radarSeries.js +18 -11
- package/src/series/scatterSeries.js +1 -4
- package/src/series/series.js +18 -9
- package/src/series/stackBarSeries.js +6 -4
- package/src/series/waterfallSeries.js +1 -4
|
@@ -33,11 +33,12 @@ export default class jmRadarSeries extends jmSeries {
|
|
|
33
33
|
const rotateStep = Math.PI * 2 / yCount;
|
|
34
34
|
|
|
35
35
|
// 清空除了一个默认外的所有Y轴
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const yAxisKeys = Object.keys(this.graph.yAxises || {});
|
|
37
|
+
for(let k = 0; k < yAxisKeys.length; k++) {
|
|
38
|
+
const axis = this.graph.yAxises[yAxisKeys[k]];
|
|
38
39
|
if(!axis || axis === this.yAxis) continue;
|
|
39
40
|
axis.remove();
|
|
40
|
-
delete this.graph.yAxises[
|
|
41
|
+
delete this.graph.yAxises[yAxisKeys[k]];
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
for(let index=0; index < yCount; index++) {
|
|
@@ -195,23 +196,29 @@ export default class jmRadarSeries extends jmSeries {
|
|
|
195
196
|
|
|
196
197
|
for(var i=0;i< this.data.length;i++) {
|
|
197
198
|
const s = this.data[i];
|
|
198
|
-
|
|
199
|
-
if(style.color && typeof style.color === 'function') {
|
|
200
|
-
|
|
199
|
+
let strokeColor;
|
|
200
|
+
if(this.style.color && typeof this.style.color === 'function') {
|
|
201
|
+
strokeColor = this.style.color.call(this, {
|
|
201
202
|
data: s,
|
|
202
203
|
index: i
|
|
203
204
|
});
|
|
204
205
|
}
|
|
205
206
|
else {
|
|
206
|
-
|
|
207
|
+
strokeColor = this.graph.getColor(i);
|
|
207
208
|
}
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
let fillColor;
|
|
210
|
+
if(typeof this.style.fill === 'function') {
|
|
211
|
+
fillColor = this.style.fill.call(this, { ...this.style, stroke: strokeColor });
|
|
210
212
|
}
|
|
211
213
|
else {
|
|
212
|
-
const color = this.graph.utils.hexToRGBA(
|
|
213
|
-
|
|
214
|
+
const color = this.graph.utils.hexToRGBA(strokeColor);
|
|
215
|
+
fillColor = `rgba(${color.r},${color.g},${color.b}, 0.2)`;
|
|
214
216
|
}
|
|
217
|
+
// 使用浅拷贝而非深拷贝
|
|
218
|
+
const style = Object.assign({}, this.style, {
|
|
219
|
+
stroke: strokeColor,
|
|
220
|
+
fill: fillColor
|
|
221
|
+
});
|
|
215
222
|
|
|
216
223
|
const shapePoints = [];
|
|
217
224
|
for(const axis of this.axises) {
|
package/src/series/series.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jmPath, jmList, jmControl } from 'jmgraph';
|
|
2
2
|
import utils from '../common/utils.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// 公共常量提取到基类,避免每个子类重复定义
|
|
5
|
+
export const ANIMATION_DATA_THRESHOLD = 100;
|
|
6
|
+
export const DEFAULT_ANIMATION_COUNT = 10;
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* 图表系列基类
|
|
@@ -137,14 +139,21 @@ export default class jmSeries extends jmPath {
|
|
|
137
139
|
let dataChanged = false;
|
|
138
140
|
|
|
139
141
|
if(this.enableAnimate && this.data && this.data.length < ANIMATION_DATA_THRESHOLD) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
// 仅在数据引用变化时才做深度比较
|
|
143
|
+
if(this._lastData !== this.data) {
|
|
144
|
+
this.lastPoints = this.graph.utils.clone(this.dataPoints, null, true, (obj) => {
|
|
145
|
+
if(obj instanceof jmControl) return obj;
|
|
146
|
+
});
|
|
143
147
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
this.dataPoints = this.createPoints(...args);
|
|
149
|
+
dataChanged = utils.arrayIsChange(this.lastPoints, this.dataPoints, (s, t) => {
|
|
150
|
+
return s.x === t.x && s.y === t.y;
|
|
151
|
+
});
|
|
152
|
+
this._lastData = this.data;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this.dataPoints = this.createPoints(...args);
|
|
156
|
+
}
|
|
148
157
|
|
|
149
158
|
if(dataChanged) {
|
|
150
159
|
this.___animateCounter = 0;
|
|
@@ -294,7 +303,7 @@ export default class jmSeries extends jmPath {
|
|
|
294
303
|
xValue: xv,
|
|
295
304
|
xLabel: xv,
|
|
296
305
|
points: [],
|
|
297
|
-
style: this.
|
|
306
|
+
style: this.style, // 共享引用,避免深拷贝;子类如需修改应自行创建副本
|
|
298
307
|
};
|
|
299
308
|
|
|
300
309
|
p.x = xstep * i + this.xAxis.labelStart;
|
|
@@ -60,18 +60,20 @@ export default class jmStackBarSeries extends jmBarSeries {
|
|
|
60
60
|
let topStartY = this.baseY;
|
|
61
61
|
let bottomStartY = this.baseY;
|
|
62
62
|
for(let index=0; index < point.points.length; index ++) {
|
|
63
|
-
const style = this.graph.utils.clone(this.style);
|
|
64
63
|
const p = point.points[index];
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
let fillColor;
|
|
66
|
+
if(this.style.color && typeof this.style.color === 'function') {
|
|
67
|
+
fillColor = this.style.color.call(this, {
|
|
68
68
|
index,
|
|
69
69
|
point: p
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
|
-
|
|
73
|
+
fillColor = this.graph.getColor(index);
|
|
74
74
|
}
|
|
75
|
+
// 使用浅拷贝而非深拷贝
|
|
76
|
+
const style = Object.assign({}, this.style, { fill: fillColor });
|
|
75
77
|
const sp = this.addShape(this.graph.createPath(null, style));
|
|
76
78
|
|
|
77
79
|
let startY = topStartY;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import jmSeries from './series.js';
|
|
2
|
-
|
|
3
|
-
const ANIMATION_DATA_THRESHOLD = 100;
|
|
4
|
-
const DEFAULT_ANIMATION_COUNT = 10;
|
|
1
|
+
import jmSeries, { ANIMATION_DATA_THRESHOLD, DEFAULT_ANIMATION_COUNT } from './series.js';
|
|
5
2
|
|
|
6
3
|
export default class jmWaterfallSeries extends jmSeries {
|
|
7
4
|
constructor(options) {
|