jmchart 1.2.12 → 1.2.15
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 +370 -37
- package/build.js +6 -3
- package/dist/jmchart.amd.js +4459 -772
- package/dist/jmchart.cjs.js +4459 -772
- package/dist/jmchart.esm.js +4459 -772
- package/dist/jmchart.iife.js +4460 -773
- package/dist/jmchart.system.js +4459 -772
- package/package.json +7 -4
- package/server.js +64 -32
- package/src/common/style.js +294 -0
- package/src/component/vchart.js +24 -3
- package/src/core/axis/axis.js +6 -3
- package/src/core/markLine/manager.js +14 -8
- package/src/jmChart.js +72 -29
- package/src/series/areaSeries.js +50 -0
- package/src/series/barSeries.js +3 -6
- package/src/series/boxPlotSeries.js +254 -0
- package/src/series/bubbleSeries.js +131 -0
- package/src/series/candlestickSeries.js +44 -29
- package/src/series/funnelSeries.js +190 -0
- package/src/series/gaugeSeries.js +255 -0
- package/src/series/heatmapSeries.js +184 -0
- package/src/series/lineSeries.js +47 -33
- package/src/series/pieSeries.js +5 -3
- package/src/series/radarSeries.js +18 -11
- package/src/series/rangeSeries.js +149 -0
- package/src/series/ringProgressSeries.js +191 -0
- package/src/series/scatterSeries.js +125 -0
- package/src/series/series.js +149 -49
- package/src/series/stackBarSeries.js +48 -30
- package/src/series/stackLineSeries.js +7 -131
- package/src/series/sunburstSeries.js +240 -0
- package/src/series/waterfallSeries.js +179 -0
- package/src/series/wordCloudSeries.js +234 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import jmSeries, { ANIMATION_DATA_THRESHOLD, DEFAULT_ANIMATION_COUNT } from './series.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 热力图
|
|
5
|
+
*
|
|
6
|
+
* @class jmHeatmapSeries
|
|
7
|
+
* @module jmChart
|
|
8
|
+
* @param {jmChart} chart 当前图表
|
|
9
|
+
* @param {array} mappings 图形字段映射
|
|
10
|
+
* @param {style} style 样式
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default class jmHeatmapSeries extends jmSeries {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
options.style = options.style || options.graph.style.heatmap;
|
|
16
|
+
super(options);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 初始化热力图
|
|
21
|
+
*
|
|
22
|
+
* @method init
|
|
23
|
+
* @for jmHeatmapSeries
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
const {
|
|
27
|
+
points,
|
|
28
|
+
dataChanged
|
|
29
|
+
} = this.initDataPoint();
|
|
30
|
+
|
|
31
|
+
const len = points.length;
|
|
32
|
+
if(!len) return;
|
|
33
|
+
|
|
34
|
+
// 计算数据的最大值和最小值,用于颜色映射
|
|
35
|
+
let minValue = Infinity;
|
|
36
|
+
let maxValue = -Infinity;
|
|
37
|
+
|
|
38
|
+
for(let i = 0; i < len; i++) {
|
|
39
|
+
const p = points[i];
|
|
40
|
+
if(typeof p.value === 'number') {
|
|
41
|
+
minValue = Math.min(minValue, p.value);
|
|
42
|
+
maxValue = Math.max(maxValue, p.value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this.minValue = minValue;
|
|
47
|
+
this.maxValue = maxValue;
|
|
48
|
+
|
|
49
|
+
const isRunningAni = this.enableAnimate && (dataChanged || this.___animateCounter > 0) && len < ANIMATION_DATA_THRESHOLD;
|
|
50
|
+
|
|
51
|
+
const aniCount = (this.style.aniCount || DEFAULT_ANIMATION_COUNT);
|
|
52
|
+
const aniStep = Math.floor(len / aniCount) || 1;
|
|
53
|
+
|
|
54
|
+
for(let i = 0; i < len; i++) {
|
|
55
|
+
const p = points[i];
|
|
56
|
+
|
|
57
|
+
if(typeof p.y === 'undefined' || p.y === null) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if(isRunningAni && i > this.___animateCounter) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.createHeatmapCell(p, minValue, maxValue);
|
|
66
|
+
this.createItemLabel(p);
|
|
67
|
+
|
|
68
|
+
this.emit('onPointCreated', p);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if(this.___animateCounter >= len - 1) {
|
|
72
|
+
this.___animateCounter = 0;
|
|
73
|
+
} else if(isRunningAni) {
|
|
74
|
+
this.___animateCounter += aniStep;
|
|
75
|
+
this.graph.utils.requestAnimationFrame(() => {
|
|
76
|
+
this.needUpdate = true;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 生成热力图单元格
|
|
83
|
+
*
|
|
84
|
+
* @method createHeatmapCell
|
|
85
|
+
* @for jmHeatmapSeries
|
|
86
|
+
* @param {object} p 数据点
|
|
87
|
+
* @param {number} minValue 最小值
|
|
88
|
+
* @param {number} maxValue 最大值
|
|
89
|
+
*/
|
|
90
|
+
createHeatmapCell(p, minValue, maxValue) {
|
|
91
|
+
// 计算单元格大小
|
|
92
|
+
const cellWidth = this.style.cellWidth || 20;
|
|
93
|
+
const cellHeight = this.style.cellHeight || 20;
|
|
94
|
+
|
|
95
|
+
// 计算颜色
|
|
96
|
+
const color = this.getHeatmapColor(p.value, minValue, maxValue);
|
|
97
|
+
|
|
98
|
+
// 创建矩形单元格
|
|
99
|
+
const cellStyle = this.graph.utils.clone(this.style.item, {
|
|
100
|
+
stroke: color,
|
|
101
|
+
fill: color
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const cellShape = this.graph.createShape('rect', {
|
|
105
|
+
style: cellStyle,
|
|
106
|
+
position: {
|
|
107
|
+
x: p.x - cellWidth / 2,
|
|
108
|
+
y: p.y - cellHeight / 2
|
|
109
|
+
},
|
|
110
|
+
width: cellWidth,
|
|
111
|
+
height: cellHeight
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
cellShape.zIndex = (cellShape.style.zIndex || 1) + 1;
|
|
115
|
+
return this.addShape(cellShape);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 获取热力图颜色
|
|
120
|
+
*
|
|
121
|
+
* @method getHeatmapColor
|
|
122
|
+
* @for jmHeatmapSeries
|
|
123
|
+
* @param {number} value 当前值
|
|
124
|
+
* @param {number} minValue 最小值
|
|
125
|
+
* @param {number} maxValue 最大值
|
|
126
|
+
* @return {string} 颜色值
|
|
127
|
+
*/
|
|
128
|
+
getHeatmapColor(value, minValue, maxValue) {
|
|
129
|
+
if(typeof value !== 'number') {
|
|
130
|
+
return this.style.defaultColor || '#ccc';
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// 计算值的比例
|
|
134
|
+
const ratio = (value - minValue) / (maxValue - minValue);
|
|
135
|
+
|
|
136
|
+
// 使用默认的颜色梯度
|
|
137
|
+
const colors = this.style.colorGradient || [
|
|
138
|
+
'#313695', // 蓝色(最小值)
|
|
139
|
+
'#4575b4',
|
|
140
|
+
'#74add1',
|
|
141
|
+
'#abd9e9',
|
|
142
|
+
'#e0f3f8',
|
|
143
|
+
'#ffffbf',
|
|
144
|
+
'#fee090',
|
|
145
|
+
'#fdae61',
|
|
146
|
+
'#f46d43',
|
|
147
|
+
'#d73027',
|
|
148
|
+
'#a50026' // 红色(最大值)
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
// 根据比例获取颜色
|
|
152
|
+
const index = Math.min(Math.floor(ratio * (colors.length - 1)), colors.length - 1);
|
|
153
|
+
return colors[index];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 生成图例
|
|
158
|
+
*
|
|
159
|
+
* @method createLegend
|
|
160
|
+
* @for jmHeatmapSeries
|
|
161
|
+
*/
|
|
162
|
+
createLegend() {
|
|
163
|
+
// 生成图例前的图标
|
|
164
|
+
var style = this.graph.utils.clone(this.style);
|
|
165
|
+
style.stroke = style.color;
|
|
166
|
+
style.fill = style.color;
|
|
167
|
+
|
|
168
|
+
var shape = this.graph.createShape('rect', {
|
|
169
|
+
style: style,
|
|
170
|
+
position: {
|
|
171
|
+
x: 0,
|
|
172
|
+
y: 0
|
|
173
|
+
},
|
|
174
|
+
width: this.graph.style.legend.item.shape.width,
|
|
175
|
+
height: this.graph.style.legend.item.shape.height
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
this.graph.legend.append(this, shape);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export {
|
|
183
|
+
jmHeatmapSeries
|
|
184
|
+
}
|
package/src/series/lineSeries.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import jmSeries from './series.js';
|
|
3
|
-
|
|
4
|
-
const ANIMATION_DATA_THRESHOLD = 100;
|
|
5
|
-
const DEFAULT_ANIMATION_COUNT = 10;
|
|
2
|
+
import jmSeries, { ANIMATION_DATA_THRESHOLD, DEFAULT_ANIMATION_COUNT } from './series.js';
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* 线图
|
|
@@ -97,45 +94,62 @@ export default class jmLineSeries extends jmSeries {
|
|
|
97
94
|
return this.addShape(pointShape);
|
|
98
95
|
}
|
|
99
96
|
|
|
100
|
-
// 根据上下点生成平滑曲线
|
|
101
97
|
createCurePoints(shapePoints, p) {
|
|
102
98
|
const startPoint = shapePoints[shapePoints.length - 1];
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
|
|
100
|
+
if(!startPoint || !p) return shapePoints;
|
|
101
|
+
|
|
102
|
+
if(startPoint.x === undefined || startPoint.x === null ||
|
|
103
|
+
startPoint.y === undefined || startPoint.y === null ||
|
|
104
|
+
p.x === undefined || p.x === null ||
|
|
105
|
+
p.y === undefined || p.y === null) {
|
|
106
|
+
return shapePoints;
|
|
107
|
+
}
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
109
|
+
const p1 = {x: startPoint.x + (p.x - startPoint.x) / 5, y: startPoint.y};
|
|
110
|
+
const p2 = {x: startPoint.x + (p.x - startPoint.x) / 2, y: p.y - (p.y - startPoint.y) / 2};
|
|
111
|
+
const p3 = {x: p.x - (p.x - startPoint.x) / 5, y: p.y};
|
|
112
|
+
|
|
113
|
+
this.__bezier = this.__bezier || this.graph.createShape('bezier');
|
|
114
|
+
this.__bezier.cpoints = [
|
|
115
|
+
startPoint,
|
|
116
|
+
p1,
|
|
117
|
+
p2,
|
|
118
|
+
p3,
|
|
119
|
+
p
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
const bzpoints = this.__bezier.initPoints();
|
|
123
|
+
if(bzpoints && bzpoints.length) {
|
|
124
|
+
shapePoints = shapePoints.concat(bzpoints);
|
|
121
125
|
}
|
|
126
|
+
|
|
122
127
|
return shapePoints;
|
|
123
128
|
}
|
|
124
129
|
|
|
125
|
-
// 生成虚线
|
|
126
130
|
createDotLine(shapePoints, p) {
|
|
127
131
|
const startPoint = shapePoints[shapePoints.length - 1];
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
|
|
133
|
+
if(!startPoint || !p) return shapePoints;
|
|
134
|
+
|
|
135
|
+
if(startPoint.x === undefined || startPoint.x === null ||
|
|
136
|
+
startPoint.y === undefined || startPoint.y === null ||
|
|
137
|
+
p.x === undefined || p.x === null ||
|
|
138
|
+
p.y === undefined || p.y === null) {
|
|
139
|
+
return shapePoints;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
this.__line = this.__line || this.graph.createShape('line', {
|
|
143
|
+
style: this.style,
|
|
144
|
+
});
|
|
145
|
+
this.__line.start = startPoint;
|
|
146
|
+
this.__line.end = p;
|
|
147
|
+
|
|
148
|
+
const dots = this.__line.initPoints();
|
|
149
|
+
if(dots && dots.length) {
|
|
150
|
+
shapePoints = shapePoints.concat(dots);
|
|
138
151
|
}
|
|
152
|
+
|
|
139
153
|
return shapePoints;
|
|
140
154
|
}
|
|
141
155
|
|
package/src/series/pieSeries.js
CHANGED
|
@@ -29,7 +29,7 @@ export default class jmPieSeries extends jmSeries {
|
|
|
29
29
|
this.totalValue = 0;
|
|
30
30
|
//计算最大值和最小值
|
|
31
31
|
if(this.data) {
|
|
32
|
-
for(
|
|
32
|
+
for(let i = 0; i < this.data.length; i++) {
|
|
33
33
|
const s = this.data[i];
|
|
34
34
|
const vy = s[this.field];
|
|
35
35
|
if(vy) {
|
|
@@ -138,16 +138,18 @@ export default class jmPieSeries extends jmSeries {
|
|
|
138
138
|
yValue: yv,
|
|
139
139
|
yLabel: yv,
|
|
140
140
|
step: Math.abs(yv / this.totalValue),// 每个数值点比
|
|
141
|
-
style: this.
|
|
141
|
+
style: this.style, // 共享引用,仅在需要修改时才拷贝
|
|
142
142
|
anticlockwise
|
|
143
143
|
};
|
|
144
144
|
points.push(p);
|
|
145
145
|
//p.style.color = this.graph.getColor(index);
|
|
146
146
|
if(p.style.color && typeof p.style.color === 'function') {
|
|
147
|
+
p.style = this.graph.utils.clone(this.style);
|
|
147
148
|
p.style.fill = p.style.color.call(this, p);
|
|
148
149
|
}
|
|
149
150
|
else {
|
|
150
|
-
|
|
151
|
+
// fill 需要独立,创建轻量样式覆盖
|
|
152
|
+
p.style = Object.assign({}, this.style, { fill: this.graph.getColor(index) });
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
const start = startAni;// 上一个扇形的结束角度为当前的起始角度
|
|
@@ -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) {
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import jmLineSeries from './lineSeries.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 范围图(带状图)
|
|
5
|
+
*
|
|
6
|
+
* 范围图用于显示数据的上下限范围,比如温度范围、价格波动范围等。
|
|
7
|
+
* 它由两条线组成,两条线之间的区域用颜色填充,形成带状效果。
|
|
8
|
+
*
|
|
9
|
+
* 数据格式要求:
|
|
10
|
+
* - fields: ['min', 'max'] - 两个字段,分别表示下限和上限
|
|
11
|
+
* - xField: 'category' - X轴字段
|
|
12
|
+
*
|
|
13
|
+
* 样式配置:
|
|
14
|
+
* - color: 线条和填充颜色
|
|
15
|
+
* - showItem: 是否显示数据点
|
|
16
|
+
* - curve: 是否使用平滑曲线
|
|
17
|
+
* - area: 填充样式配置
|
|
18
|
+
*
|
|
19
|
+
* 应用场景:
|
|
20
|
+
* - 温度范围:显示每天的最高温和最低温
|
|
21
|
+
* - 价格波动:显示股票的最高价和最低价
|
|
22
|
+
* - 误差范围:显示测量值的误差范围
|
|
23
|
+
* - 置信区间:显示统计数据的置信区间
|
|
24
|
+
*
|
|
25
|
+
* @class jmRangeSeries
|
|
26
|
+
* @module jmChart
|
|
27
|
+
* @extends jmLineSeries
|
|
28
|
+
* @param {jmChart} chart 当前图表
|
|
29
|
+
* @param {array} mappings 图形字段映射
|
|
30
|
+
* @param {style} style 样式
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export default class jmRangeSeries extends jmLineSeries {
|
|
34
|
+
constructor(options) {
|
|
35
|
+
options.style = options.style || options.graph.style.range || options.graph.style.stackLine;
|
|
36
|
+
super(options);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 初始化范围图
|
|
41
|
+
*
|
|
42
|
+
* 绘制逻辑:
|
|
43
|
+
* 1. 遍历所有数据点
|
|
44
|
+
* 2. 绘制两条线(上限线和下限线)
|
|
45
|
+
* 3. 在两条线之间创建填充区域
|
|
46
|
+
*/
|
|
47
|
+
init() {
|
|
48
|
+
const {
|
|
49
|
+
points,
|
|
50
|
+
dataChanged
|
|
51
|
+
} = this.initDataPoint();
|
|
52
|
+
|
|
53
|
+
const len = points.length;
|
|
54
|
+
|
|
55
|
+
this.style.stroke = this.style.color;
|
|
56
|
+
this.style.item.stroke = this.style.color;
|
|
57
|
+
|
|
58
|
+
const isRunningAni = this.enableAnimate && (dataChanged || this.___animateCounter > 0 );
|
|
59
|
+
|
|
60
|
+
let startShapePoints = [];
|
|
61
|
+
let endShapePoints = [];
|
|
62
|
+
const aniCount = (this.style.aniCount || 10);
|
|
63
|
+
const aniStep = Math.floor(len / aniCount) || 1;
|
|
64
|
+
|
|
65
|
+
for(let i=0; i< len;i++) {
|
|
66
|
+
const p = points[i];
|
|
67
|
+
|
|
68
|
+
if(isRunningAni) {
|
|
69
|
+
if(i > this.___animateCounter) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if(this.style.showItem) {
|
|
75
|
+
this.createPointItem(p.points[0]);
|
|
76
|
+
this.createPointItem(p.points[1]);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if(this.style.curve) {
|
|
80
|
+
startShapePoints = this.createCurePoints(startShapePoints, p.points[0]);
|
|
81
|
+
endShapePoints = this.createCurePoints(endShapePoints, p.points[1]);
|
|
82
|
+
}
|
|
83
|
+
else if(this.style.lineType === 'dotted') {
|
|
84
|
+
startShapePoints = this.createDotLine(startShapePoints, p.points[0]);
|
|
85
|
+
endShapePoints = this.createDotLine(endShapePoints, p.points[1]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
startShapePoints.push(p.points[0]);
|
|
89
|
+
endShapePoints.push(p.points[1]);
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
this.emit('onPointCreated', p);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if(this.___animateCounter >= len - 1) {
|
|
96
|
+
this.___animateCounter = 0;
|
|
97
|
+
}
|
|
98
|
+
else if(isRunningAni) {
|
|
99
|
+
this.___animateCounter += aniStep;
|
|
100
|
+
this.graph.utils.requestAnimationFrame(()=>{
|
|
101
|
+
this.needUpdate = true;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if(endShapePoints.length) endShapePoints[0].m = true;
|
|
106
|
+
this.points = startShapePoints.concat(endShapePoints);
|
|
107
|
+
|
|
108
|
+
const areaPoints = startShapePoints.concat(endShapePoints.reverse());
|
|
109
|
+
const areaEnd = areaPoints[areaPoints.length - 1] = this.graph.utils.clone(areaPoints[areaPoints.length - 1]);
|
|
110
|
+
areaEnd.m = false;
|
|
111
|
+
this.createArea(areaPoints, false);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 生成图例
|
|
116
|
+
*/
|
|
117
|
+
createLegend() {
|
|
118
|
+
|
|
119
|
+
var style = this.graph.utils.clone(this.style);
|
|
120
|
+
style.stroke = style.color;
|
|
121
|
+
var shape = this.graph.createShape('path',{style:style});
|
|
122
|
+
|
|
123
|
+
if(this.curve || this.style.curve) {
|
|
124
|
+
var p1 = {x:0,y: this.graph.style.legend.item.shape.height};
|
|
125
|
+
var p2 = {x:this.graph.style.legend.item.shape.width / 3,y:this.graph.style.legend.item.shape.height/3};
|
|
126
|
+
var p3 = {x:this.graph.style.legend.item.shape.width / 3 * 2,y:this.graph.style.legend.item.shape.height/3*2};
|
|
127
|
+
var p4 = {x:this.graph.style.legend.item.shape.width,y:0};
|
|
128
|
+
|
|
129
|
+
this.__bezier = this.__bezier || this.graph.createShape('bezier');
|
|
130
|
+
this.__bezier.cpoints = [
|
|
131
|
+
p1,p2,p3,p4
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
shape.points = this.__bezier.initPoints();
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
shape.points = [{
|
|
138
|
+
x:0,y: this.graph.style.legend.item.shape.height/2
|
|
139
|
+
},{
|
|
140
|
+
x: this.graph.style.legend.item.shape.width,y: this.graph.style.legend.item.shape.height/2
|
|
141
|
+
}];
|
|
142
|
+
}
|
|
143
|
+
this.graph.legend.append(this, shape);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export {
|
|
148
|
+
jmRangeSeries
|
|
149
|
+
}
|