jmchart 1.2.18 → 1.2.20
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 +173 -19
- package/dist/jmchart.amd.js +3754 -732
- package/dist/jmchart.cjs.js +3754 -732
- package/dist/jmchart.esm.js +3754 -732
- package/dist/jmchart.iife.js +3754 -732
- package/dist/jmchart.system.js +3754 -732
- package/index.d.ts +553 -32
- package/package.json +2 -2
- package/src/common/tooltip.js +3 -3
- package/src/common/utils.js +1 -1
- package/src/core/axis/axis.js +2 -2
- package/src/core/legend/legend.js +106 -108
- package/src/core/markLine/manager.js +2 -0
- package/src/core/markLine/markLine.js +3 -2
- package/src/jmChart.js +2 -5
- package/src/series/areaSeries.js +6 -6
- package/src/series/boxPlotSeries.js +2 -4
- package/src/series/bubbleSeries.js +3 -8
- package/src/series/candlestickSeries.js +1 -5
- package/src/series/funnelSeries.js +1 -3
- package/src/series/gaugeSeries.js +3 -7
- package/src/series/heatmapSeries.js +3 -8
- package/src/series/lineSeries.js +2 -6
- package/src/series/pieSeries.js +36 -31
- package/src/series/radarSeries.js +30 -51
- package/src/series/rangeSeries.js +9 -12
- package/src/series/ringProgressSeries.js +0 -2
- package/src/series/scatterSeries.js +3 -8
- package/src/series/stackBarSeries.js +3 -2
- package/src/series/stackLineSeries.js +0 -4
- package/src/series/waterfallSeries.js +0 -4
- package/src/series/wordCloudSeries.js +2 -4
|
@@ -116,7 +116,6 @@ export default class jmRadarSeries extends jmSeries {
|
|
|
116
116
|
let aniIsEnd = true;// 当次是否结束动画
|
|
117
117
|
const len = points.length;
|
|
118
118
|
const shapeMap = {};
|
|
119
|
-
const self = this;
|
|
120
119
|
|
|
121
120
|
for(let i=0; i<len; i++) {
|
|
122
121
|
const p = points[i];
|
|
@@ -130,19 +129,22 @@ export default class jmRadarSeries extends jmSeries {
|
|
|
130
129
|
this.addShape(shape);
|
|
131
130
|
|
|
132
131
|
// 如果有点击事件
|
|
132
|
+
if(this.option.onClick || this.option.onOver || this.option.onLeave) {
|
|
133
|
+
shape.interactive = true;
|
|
134
|
+
}
|
|
133
135
|
if(this.option.onClick) {
|
|
134
|
-
shape.on('click',
|
|
135
|
-
return
|
|
136
|
+
shape.on('click', (e) => {
|
|
137
|
+
return this.option.onClick.call(this, e);
|
|
136
138
|
});
|
|
137
139
|
}
|
|
138
140
|
if(this.option.onOver) {
|
|
139
|
-
shape.on('mouseover touchover',
|
|
140
|
-
return
|
|
141
|
+
shape.on('mouseover touchover', (e) => {
|
|
142
|
+
return this.option.onOver.call(this, e);
|
|
141
143
|
});
|
|
142
144
|
}
|
|
143
145
|
if(this.option.onLeave) {
|
|
144
|
-
shape.on('mouseleave touchleave',
|
|
145
|
-
return
|
|
146
|
+
shape.on('mouseleave touchleave', (e) => {
|
|
147
|
+
return this.option.onLeave.call(this, e);
|
|
146
148
|
});
|
|
147
149
|
}
|
|
148
150
|
this.createLegend(p);
|
|
@@ -194,7 +196,7 @@ export default class jmRadarSeries extends jmSeries {
|
|
|
194
196
|
center = center || this.center;
|
|
195
197
|
const points = [];
|
|
196
198
|
|
|
197
|
-
for(
|
|
199
|
+
for(let i=0;i< this.data.length;i++) {
|
|
198
200
|
const s = this.data[i];
|
|
199
201
|
let strokeColor;
|
|
200
202
|
if(this.style.color && typeof this.style.color === 'function') {
|
|
@@ -268,53 +270,30 @@ export default class jmRadarSeries extends jmSeries {
|
|
|
268
270
|
this.addShape(text);
|
|
269
271
|
return text;
|
|
270
272
|
}
|
|
271
|
-
|
|
273
|
+
|
|
272
274
|
const label = this.graph.createShape('label', {
|
|
273
|
-
style: this.style.label,
|
|
274
|
-
text: text
|
|
275
|
-
point,
|
|
276
|
-
position: function() {
|
|
277
|
-
const p = {
|
|
278
|
-
x: this.option.point.x,
|
|
279
|
-
y: this.option.point.y
|
|
280
|
-
}
|
|
281
|
-
if(p.x < self.center.x) {
|
|
282
|
-
p.x -= this.width;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if(p.y < self.center.y) {
|
|
286
|
-
p.y -= this.height;
|
|
287
|
-
}
|
|
288
|
-
return p;
|
|
289
|
-
}
|
|
275
|
+
style: this.style.label || {},
|
|
276
|
+
text: text
|
|
290
277
|
});
|
|
291
|
-
|
|
278
|
+
label.position = { x: point.x, y: point.y };
|
|
292
279
|
this.addShape(label);
|
|
280
|
+
return label;
|
|
293
281
|
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
282
|
|
|
298
|
-
/**
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
jmRadarSeries.prototype.createLegend = function(point) {
|
|
304
|
-
if(!point) return;
|
|
283
|
+
/**
|
|
284
|
+
* 生成图例
|
|
285
|
+
*/
|
|
286
|
+
createLegend(point) {
|
|
287
|
+
if(!point) return;
|
|
305
288
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
name: this.legendLabel,
|
|
317
|
-
data: point.data
|
|
318
|
-
});
|
|
289
|
+
const style = this.graph.utils.clone(point.style);
|
|
290
|
+
const shape = this.graph.createShape('rect',{
|
|
291
|
+
style: style,
|
|
292
|
+
position : {x: 0, y: 0}
|
|
293
|
+
});
|
|
294
|
+
this.graph.legend.append(this, shape, {
|
|
295
|
+
name: this.legendLabel,
|
|
296
|
+
data: point.data
|
|
297
|
+
});
|
|
298
|
+
}
|
|
319
299
|
}
|
|
320
|
-
|
|
@@ -105,7 +105,8 @@ export default class jmRangeSeries extends jmLineSeries {
|
|
|
105
105
|
if(endShapePoints.length) endShapePoints[0].m = true;
|
|
106
106
|
this.points = startShapePoints.concat(endShapePoints);
|
|
107
107
|
|
|
108
|
-
const
|
|
108
|
+
const reversedEndPoints = endShapePoints.slice().reverse();
|
|
109
|
+
const areaPoints = startShapePoints.concat(reversedEndPoints);
|
|
109
110
|
const areaEnd = areaPoints[areaPoints.length - 1] = this.graph.utils.clone(areaPoints[areaPoints.length - 1]);
|
|
110
111
|
areaEnd.m = false;
|
|
111
112
|
this.createArea(areaPoints, false);
|
|
@@ -116,15 +117,15 @@ export default class jmRangeSeries extends jmLineSeries {
|
|
|
116
117
|
*/
|
|
117
118
|
createLegend() {
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
const style = this.graph.utils.clone(this.style);
|
|
120
121
|
style.stroke = style.color;
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
const shape = this.graph.createShape('path',{style:style});
|
|
123
|
+
|
|
123
124
|
if(this.curve || this.style.curve) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
const p1 = {x:0,y: this.graph.style.legend.item.shape.height};
|
|
126
|
+
const p2 = {x:this.graph.style.legend.item.shape.width / 3,y:this.graph.style.legend.item.shape.height/3};
|
|
127
|
+
const p3 = {x:this.graph.style.legend.item.shape.width / 3 * 2,y:this.graph.style.legend.item.shape.height/3*2};
|
|
128
|
+
const p4 = {x:this.graph.style.legend.item.shape.width,y:0};
|
|
128
129
|
|
|
129
130
|
this.__bezier = this.__bezier || this.graph.createShape('bezier');
|
|
130
131
|
this.__bezier.cpoints = [
|
|
@@ -143,7 +144,3 @@ export default class jmRangeSeries extends jmLineSeries {
|
|
|
143
144
|
this.graph.legend.append(this, shape);
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
|
|
147
|
-
export {
|
|
148
|
-
jmRangeSeries
|
|
149
|
-
}
|
|
@@ -102,12 +102,11 @@ export default class jmScatterSeries extends jmSeries {
|
|
|
102
102
|
* @for jmScatterSeries
|
|
103
103
|
*/
|
|
104
104
|
createLegend() {
|
|
105
|
-
|
|
106
|
-
var style = this.graph.utils.clone(this.style);
|
|
105
|
+
const style = this.graph.utils.clone(this.style);
|
|
107
106
|
style.stroke = style.color;
|
|
108
107
|
style.fill = style.color;
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
|
|
109
|
+
const shape = this.graph.createShape('circle', {
|
|
111
110
|
style: style,
|
|
112
111
|
center: {
|
|
113
112
|
x: this.graph.style.legend.item.shape.width / 2,
|
|
@@ -118,8 +117,4 @@ export default class jmScatterSeries extends jmSeries {
|
|
|
118
117
|
|
|
119
118
|
this.graph.legend.append(this, shape);
|
|
120
119
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export {
|
|
124
|
-
jmScatterSeries
|
|
125
120
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import jmSeries, { ANIMATION_DATA_THRESHOLD, DEFAULT_ANIMATION_COUNT } from './series.js';
|
|
1
2
|
import jmBarSeries from './barSeries.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -50,9 +51,9 @@ export default class jmStackBarSeries extends jmBarSeries {
|
|
|
50
51
|
|
|
51
52
|
this.initWidth(len);
|
|
52
53
|
|
|
53
|
-
const isRunningAni = this.enableAnimate && (dataChanged || this.___animateCounter > 0 ) && len <
|
|
54
|
+
const isRunningAni = this.enableAnimate && (dataChanged || this.___animateCounter > 0 ) && len < ANIMATION_DATA_THRESHOLD;
|
|
54
55
|
let aniIsEnd = true;
|
|
55
|
-
const aniCount = (this.style.aniCount ||
|
|
56
|
+
const aniCount = (this.style.aniCount || DEFAULT_ANIMATION_COUNT);
|
|
56
57
|
|
|
57
58
|
for(let i=0; i<len; i++) {
|
|
58
59
|
const point = points[i];
|
|
@@ -55,8 +55,8 @@ export default class jmWordCloudSeries extends jmSeries {
|
|
|
55
55
|
const xField = this.option.xField || 'word';
|
|
56
56
|
|
|
57
57
|
const weights = data.map(item => Math.abs(item[field] || 0));
|
|
58
|
-
const maxWeight = Math.max(
|
|
59
|
-
const minWeight = Math.min(
|
|
58
|
+
const maxWeight = weights.reduce((a, b) => Math.max(a, b));
|
|
59
|
+
const minWeight = weights.reduce((a, b) => Math.min(a, b));
|
|
60
60
|
|
|
61
61
|
if(maxWeight === 0) return;
|
|
62
62
|
|
|
@@ -230,5 +230,3 @@ export default class jmWordCloudSeries extends jmSeries {
|
|
|
230
230
|
this.graph.legend.append(this, shape);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
|
|
234
|
-
export { jmWordCloudSeries };
|