echarts 4.6.0 → 4.7.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/.github/pull_request_template.md +66 -0
- package/.github/workflows/nodejs.yml +12 -2
- package/CONTRIBUTING.md +16 -160
- package/NOTICE +1 -1
- package/README.md +2 -2
- package/dist/echarts-en.common.js +684 -300
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +1070 -407
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +499 -222
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +684 -300
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +1070 -407
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +499 -222
- package/dist/echarts.simple.min.js +1 -1
- package/lib/chart/bar/BarSeries.js +14 -1
- package/lib/chart/bar/BarView.js +134 -14
- package/lib/chart/candlestick/candlestickVisual.js +1 -1
- package/lib/chart/funnel/FunnelSeries.js +1 -3
- package/lib/chart/graph/GraphSeries.js +2 -1
- package/lib/chart/graph/GraphView.js +2 -4
- package/lib/chart/helper/EffectLine.js +23 -1
- package/lib/chart/helper/Line.js +94 -33
- package/lib/chart/helper/createRenderPlanner.js +6 -3
- package/lib/chart/pie/PieView.js +1 -1
- package/lib/chart/radar/RadarSeries.js +20 -0
- package/lib/chart/sankey/SankeySeries.js +13 -1
- package/lib/chart/sankey/SankeyView.js +42 -23
- package/lib/chart/sankey/sankeyLayout.js +4 -3
- package/lib/chart/tree/TreeSeries.js +3 -0
- package/lib/chart/tree/TreeView.js +151 -25
- package/lib/chart/treemap/TreemapView.js +57 -27
- package/lib/component/axis/AxisBuilder.js +0 -1
- package/lib/component/axis/CartesianAxisView.js +7 -84
- package/lib/component/axis/SingleAxisView.js +21 -6
- package/lib/component/axis/axisSplitHelper.js +132 -0
- package/lib/component/brush/BrushView.js +11 -1
- package/lib/component/brush/visualEncoding.js +13 -2
- package/lib/component/helper/MapDraw.js +6 -8
- package/lib/component/legend/ScrollableLegendView.js +18 -18
- package/lib/component/marker/MarkLineModel.js +2 -1
- package/lib/component/marker/markerHelper.js +7 -4
- package/lib/component/tooltip/TooltipContent.js +60 -23
- package/lib/component/tooltip/TooltipView.js +6 -7
- package/lib/coord/View.js +9 -0
- package/lib/coord/radar/Radar.js +4 -4
- package/lib/echarts.js +2 -2
- package/lib/layout/barGrid.js +17 -10
- package/lib/layout/barPolar.js +0 -5
- package/lib/scale/Interval.js +2 -2
- package/lib/stream/Scheduler.js +9 -1
- package/lib/util/graphic.js +2 -2
- package/map/js/china.js +1 -1
- package/map/js/province/chongqing.js +1 -1
- package/map/js/province/tianjin.js +1 -28
- package/map/json/china.json +1 -1
- package/map/json/province/chongqing.json +1 -1
- package/package.json +10 -6
- package/src/chart/bar/BarSeries.js +15 -1
- package/src/chart/bar/BarView.js +136 -12
- package/src/chart/candlestick/candlestickVisual.js +1 -1
- package/src/chart/funnel/FunnelSeries.js +1 -2
- package/src/chart/graph/GraphSeries.js +2 -1
- package/src/chart/graph/GraphView.js +2 -2
- package/src/chart/helper/EffectLine.js +23 -1
- package/src/chart/helper/Line.js +84 -26
- package/src/chart/helper/createRenderPlanner.js +5 -2
- package/src/chart/pie/PieView.js +1 -1
- package/src/chart/pie/labelLayout.js +1 -1
- package/src/chart/radar/RadarSeries.js +22 -0
- package/src/chart/sankey/SankeySeries.js +12 -1
- package/src/chart/sankey/SankeyView.js +49 -21
- package/src/chart/sankey/sankeyLayout.js +4 -3
- package/src/chart/tree/TreeSeries.js +5 -0
- package/src/chart/tree/TreeView.js +155 -22
- package/src/chart/treemap/TreemapView.js +57 -27
- package/src/component/axis/AxisBuilder.js +1 -1
- package/src/component/axis/CartesianAxisView.js +3 -86
- package/src/component/axis/SingleAxisView.js +21 -4
- package/src/component/axis/axisSplitHelper.js +114 -0
- package/src/component/brush/BrushView.js +8 -1
- package/src/component/brush/visualEncoding.js +6 -3
- package/src/component/helper/MapDraw.js +6 -6
- package/src/component/legend/ScrollableLegendView.js +18 -16
- package/src/component/marker/MarkLineModel.js +2 -1
- package/src/component/marker/markerHelper.js +8 -5
- package/src/component/tooltip/TooltipContent.js +59 -22
- package/src/component/tooltip/TooltipView.js +9 -7
- package/src/coord/View.js +10 -1
- package/src/coord/radar/Radar.js +5 -7
- package/src/echarts.js +2 -2
- package/src/layout/barGrid.js +14 -7
- package/src/layout/barPolar.js +0 -4
- package/src/scale/Interval.js +2 -2
- package/src/stream/Scheduler.js +8 -0
- package/src/util/graphic.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echarts",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "A powerful charting and visualization library for browser",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"prepublish": "node build/build.js --prepublish",
|
|
21
21
|
"test:visual": "node test/runTest/server.js",
|
|
22
22
|
"test:visual:report": "node test/runTest/genReport.js",
|
|
23
|
-
"test": "node build/build.js",
|
|
23
|
+
"test": "node build/build.js --prepublish && jest --config test/ut/jest.config.js",
|
|
24
24
|
"mktest": "node test/build/mktest.js",
|
|
25
25
|
"mktest:help": "node test/build/mktest.js -h",
|
|
26
26
|
"lint": "./node_modules/.bin/eslint src extension-src",
|
|
27
27
|
"lint:dist": "echo 'It might take a while. Please wait ...' && ./node_modules/.bin/jshint --config .jshintrc-dist dist/echarts.js"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"zrender": "4.
|
|
30
|
+
"zrender": "4.3.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/core": "7.3.4",
|
|
@@ -36,13 +36,19 @@
|
|
|
36
36
|
"@babel/template": "7.0.0-beta.31",
|
|
37
37
|
"@babel/types": "7.0.0-beta.31",
|
|
38
38
|
"assert": "1.4.1",
|
|
39
|
+
"canvas": "^2.6.0",
|
|
39
40
|
"commander": "2.11.0",
|
|
40
41
|
"coordtransform": "2.0.2",
|
|
41
42
|
"escodegen": "1.8.0",
|
|
43
|
+
"eslint": "6.3.0",
|
|
42
44
|
"esprima": "2.7.2",
|
|
43
45
|
"estraverse": "4.1.1",
|
|
44
46
|
"fs-extra": "0.26.7",
|
|
45
47
|
"glob": "7.0.0",
|
|
48
|
+
"jest": "^24.9.0",
|
|
49
|
+
"jest-canvas-mock": "^2.2.0",
|
|
50
|
+
"jsdom": "^15.2.1",
|
|
51
|
+
"jshint": "2.10.2",
|
|
46
52
|
"open": "6.4.0",
|
|
47
53
|
"pixelmatch": "5.0.2",
|
|
48
54
|
"pngjs": "3.4.0",
|
|
@@ -54,8 +60,6 @@
|
|
|
54
60
|
"semver": "6.3.0",
|
|
55
61
|
"serve-handler": "6.1.1",
|
|
56
62
|
"slugify": "1.3.4",
|
|
57
|
-
"socket.io": "2.2.0"
|
|
58
|
-
"jshint": "2.10.2",
|
|
59
|
-
"eslint": "6.3.0"
|
|
63
|
+
"socket.io": "2.2.0"
|
|
60
64
|
}
|
|
61
65
|
}
|
|
@@ -57,6 +57,20 @@ export default BaseBarSeries.extend({
|
|
|
57
57
|
|
|
58
58
|
// If use caps on two sides of bars
|
|
59
59
|
// Only available on tangential polar bar
|
|
60
|
-
roundCap: false
|
|
60
|
+
roundCap: false,
|
|
61
|
+
|
|
62
|
+
showBackground: false,
|
|
63
|
+
backgroundStyle: {
|
|
64
|
+
color: 'rgba(180, 180, 180, 0.2)',
|
|
65
|
+
borderColor: null,
|
|
66
|
+
borderWidth: 0,
|
|
67
|
+
borderType: 'solid',
|
|
68
|
+
borderRadius: 0,
|
|
69
|
+
shadowBlur: 0,
|
|
70
|
+
shadowColor: null,
|
|
71
|
+
shadowOffsetX: 0,
|
|
72
|
+
shadowOffsetY: 0,
|
|
73
|
+
opacity: 1
|
|
74
|
+
}
|
|
61
75
|
}
|
|
62
76
|
});
|
package/src/chart/bar/BarView.js
CHANGED
|
@@ -25,6 +25,7 @@ import {setLabel} from './helper';
|
|
|
25
25
|
import Model from '../../model/Model';
|
|
26
26
|
import barItemStyle from './barItemStyle';
|
|
27
27
|
import Path from 'zrender/src/graphic/Path';
|
|
28
|
+
import Group from 'zrender/src/container/Group';
|
|
28
29
|
import {throttle} from '../../util/throttle';
|
|
29
30
|
import {createClipPath} from '../helper/createClipPathFromCoordSys';
|
|
30
31
|
import Sausage from '../../util/shape/sausage';
|
|
@@ -127,15 +128,28 @@ export default echarts.extendChartView({
|
|
|
127
128
|
|
|
128
129
|
var roundCap = seriesModel.get('roundCap', true);
|
|
129
130
|
|
|
131
|
+
var drawBackground = seriesModel.get('showBackground', true);
|
|
132
|
+
var backgroundModel = seriesModel.getModel('backgroundStyle');
|
|
133
|
+
|
|
134
|
+
var bgEls = [];
|
|
135
|
+
var oldBgEls = this._backgroundEls || [];
|
|
136
|
+
|
|
130
137
|
data.diff(oldData)
|
|
131
138
|
.add(function (dataIndex) {
|
|
139
|
+
var itemModel = data.getItemModel(dataIndex);
|
|
140
|
+
var layout = getLayout[coord.type](data, dataIndex, itemModel);
|
|
141
|
+
|
|
142
|
+
if (drawBackground) {
|
|
143
|
+
var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
|
|
144
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
145
|
+
bgEls[dataIndex] = bgEl;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
|
|
132
149
|
if (!data.hasValue(dataIndex)) {
|
|
133
150
|
return;
|
|
134
151
|
}
|
|
135
152
|
|
|
136
|
-
var itemModel = data.getItemModel(dataIndex);
|
|
137
|
-
var layout = getLayout[coord.type](data, dataIndex, itemModel);
|
|
138
|
-
|
|
139
153
|
if (needsClip) {
|
|
140
154
|
// Clip will modify the layout params.
|
|
141
155
|
// And return a boolean to determine if the shape are fully clipped.
|
|
@@ -158,16 +172,24 @@ export default echarts.extendChartView({
|
|
|
158
172
|
);
|
|
159
173
|
})
|
|
160
174
|
.update(function (newIndex, oldIndex) {
|
|
161
|
-
var
|
|
175
|
+
var itemModel = data.getItemModel(newIndex);
|
|
176
|
+
var layout = getLayout[coord.type](data, newIndex, itemModel);
|
|
162
177
|
|
|
178
|
+
if (drawBackground) {
|
|
179
|
+
var bgEl = oldBgEls[oldIndex];
|
|
180
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
181
|
+
bgEls[newIndex] = bgEl;
|
|
182
|
+
|
|
183
|
+
var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
|
|
184
|
+
graphic.updateProps(bgEl, { shape: shape }, animationModel, newIndex);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
var el = oldData.getItemGraphicEl(oldIndex);
|
|
163
188
|
if (!data.hasValue(newIndex)) {
|
|
164
189
|
group.remove(el);
|
|
165
190
|
return;
|
|
166
191
|
}
|
|
167
192
|
|
|
168
|
-
var itemModel = data.getItemModel(newIndex);
|
|
169
|
-
var layout = getLayout[coord.type](data, newIndex, itemModel);
|
|
170
|
-
|
|
171
193
|
if (needsClip) {
|
|
172
194
|
var isClipped = clip[coord.type](coordSysClipArea, layout);
|
|
173
195
|
if (isClipped) {
|
|
@@ -205,6 +227,15 @@ export default echarts.extendChartView({
|
|
|
205
227
|
})
|
|
206
228
|
.execute();
|
|
207
229
|
|
|
230
|
+
var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group());
|
|
231
|
+
bgGroup.removeAll();
|
|
232
|
+
|
|
233
|
+
for (var i = 0; i < bgEls.length; ++i) {
|
|
234
|
+
bgGroup.add(bgEls[i]);
|
|
235
|
+
}
|
|
236
|
+
group.add(bgGroup);
|
|
237
|
+
this._backgroundEls = bgEls;
|
|
238
|
+
|
|
208
239
|
this._data = data;
|
|
209
240
|
},
|
|
210
241
|
|
|
@@ -225,6 +256,7 @@ export default echarts.extendChartView({
|
|
|
225
256
|
},
|
|
226
257
|
|
|
227
258
|
_incrementalRenderLarge: function (params, seriesModel) {
|
|
259
|
+
this._removeBackground();
|
|
228
260
|
createLarge(seriesModel, this.group, true);
|
|
229
261
|
},
|
|
230
262
|
|
|
@@ -238,6 +270,9 @@ export default echarts.extendChartView({
|
|
|
238
270
|
var group = this.group;
|
|
239
271
|
var data = this._data;
|
|
240
272
|
if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
|
|
273
|
+
this._removeBackground();
|
|
274
|
+
this._backgroundEls = [];
|
|
275
|
+
|
|
241
276
|
data.eachItemGraphicEl(function (el) {
|
|
242
277
|
if (el.type === 'sector') {
|
|
243
278
|
removeSector(el.dataIndex, ecModel, el);
|
|
@@ -251,6 +286,11 @@ export default echarts.extendChartView({
|
|
|
251
286
|
group.removeAll();
|
|
252
287
|
}
|
|
253
288
|
this._data = null;
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
_removeBackground: function () {
|
|
292
|
+
this.group.remove(this._backgroundGroup);
|
|
293
|
+
this._backgroundGroup = null;
|
|
254
294
|
}
|
|
255
295
|
|
|
256
296
|
});
|
|
@@ -308,7 +348,12 @@ var elementCreator = {
|
|
|
308
348
|
dataIndex, layout, isHorizontal,
|
|
309
349
|
animationModel, isUpdate
|
|
310
350
|
) {
|
|
311
|
-
var rect = new graphic.Rect({
|
|
351
|
+
var rect = new graphic.Rect({
|
|
352
|
+
shape: zrUtil.extend({}, layout),
|
|
353
|
+
z2: 1
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
rect.name = 'item';
|
|
312
357
|
|
|
313
358
|
// Animation
|
|
314
359
|
if (animationModel) {
|
|
@@ -338,9 +383,12 @@ var elementCreator = {
|
|
|
338
383
|
var ShapeClass = (!isRadial && roundCap) ? Sausage : graphic.Sector;
|
|
339
384
|
|
|
340
385
|
var sector = new ShapeClass({
|
|
341
|
-
shape: zrUtil.defaults({clockwise: clockwise}, layout)
|
|
386
|
+
shape: zrUtil.defaults({clockwise: clockwise}, layout),
|
|
387
|
+
z2: 1
|
|
342
388
|
});
|
|
343
389
|
|
|
390
|
+
sector.name = 'item';
|
|
391
|
+
|
|
344
392
|
// Animation
|
|
345
393
|
if (animationModel) {
|
|
346
394
|
var sectorShape = sector.shape;
|
|
@@ -460,7 +508,10 @@ function updateStyle(
|
|
|
460
508
|
// In case width or height are too small.
|
|
461
509
|
function getLineWidth(itemModel, rawLayout) {
|
|
462
510
|
var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
|
|
463
|
-
|
|
511
|
+
// width or height may be NaN for empty data
|
|
512
|
+
var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);
|
|
513
|
+
var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);
|
|
514
|
+
return Math.min(lineWidth, width, height);
|
|
464
515
|
}
|
|
465
516
|
|
|
466
517
|
|
|
@@ -492,13 +543,38 @@ function createLarge(seriesModel, group, incremental) {
|
|
|
492
543
|
var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;
|
|
493
544
|
startPoint[1 - baseDimIdx] = data.getLayout('valueAxisStart');
|
|
494
545
|
|
|
546
|
+
var largeDataIndices = data.getLayout('largeDataIndices');
|
|
547
|
+
var barWidth = data.getLayout('barWidth');
|
|
548
|
+
|
|
549
|
+
var backgroundModel = seriesModel.getModel('backgroundStyle');
|
|
550
|
+
var drawBackground = seriesModel.get('showBackground', true);
|
|
551
|
+
|
|
552
|
+
if (drawBackground) {
|
|
553
|
+
var points = data.getLayout('largeBackgroundPoints');
|
|
554
|
+
var backgroundStartPoint = [];
|
|
555
|
+
backgroundStartPoint[1 - baseDimIdx] = data.getLayout('backgroundStart');
|
|
556
|
+
|
|
557
|
+
var bgEl = new LargePath({
|
|
558
|
+
shape: {points: points},
|
|
559
|
+
incremental: !!incremental,
|
|
560
|
+
__startPoint: backgroundStartPoint,
|
|
561
|
+
__baseDimIdx: baseDimIdx,
|
|
562
|
+
__largeDataIndices: largeDataIndices,
|
|
563
|
+
__barWidth: barWidth,
|
|
564
|
+
silent: true,
|
|
565
|
+
z2: 0
|
|
566
|
+
});
|
|
567
|
+
setLargeBackgroundStyle(bgEl, backgroundModel, data);
|
|
568
|
+
group.add(bgEl);
|
|
569
|
+
}
|
|
570
|
+
|
|
495
571
|
var el = new LargePath({
|
|
496
572
|
shape: {points: data.getLayout('largePoints')},
|
|
497
573
|
incremental: !!incremental,
|
|
498
574
|
__startPoint: startPoint,
|
|
499
575
|
__baseDimIdx: baseDimIdx,
|
|
500
|
-
__largeDataIndices:
|
|
501
|
-
__barWidth:
|
|
576
|
+
__largeDataIndices: largeDataIndices,
|
|
577
|
+
__barWidth: barWidth
|
|
502
578
|
});
|
|
503
579
|
group.add(el);
|
|
504
580
|
setLargeStyle(el, seriesModel, data);
|
|
@@ -563,3 +639,51 @@ function setLargeStyle(el, seriesModel, data) {
|
|
|
563
639
|
el.style.lineWidth = data.getLayout('barWidth');
|
|
564
640
|
}
|
|
565
641
|
|
|
642
|
+
function setLargeBackgroundStyle(el, backgroundModel, data) {
|
|
643
|
+
var borderColor = backgroundModel.get('borderColor') || backgroundModel.get('color');
|
|
644
|
+
var itemStyle = backgroundModel.getItemStyle(['color', 'borderColor']);
|
|
645
|
+
|
|
646
|
+
el.useStyle(itemStyle);
|
|
647
|
+
el.style.fill = null;
|
|
648
|
+
el.style.stroke = borderColor;
|
|
649
|
+
el.style.lineWidth = data.getLayout('barWidth');
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
function createBackgroundShape(isHorizontalOrRadial, layout, coord) {
|
|
653
|
+
var coordLayout;
|
|
654
|
+
var isPolar = coord.type === 'polar';
|
|
655
|
+
if (isPolar) {
|
|
656
|
+
coordLayout = coord.getArea();
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
coordLayout = coord.grid.getRect();
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
if (isPolar) {
|
|
663
|
+
return {
|
|
664
|
+
cx: coordLayout.cx,
|
|
665
|
+
cy: coordLayout.cy,
|
|
666
|
+
r0: isHorizontalOrRadial ? coordLayout.r0 : layout.r0,
|
|
667
|
+
r: isHorizontalOrRadial ? coordLayout.r : layout.r,
|
|
668
|
+
startAngle: isHorizontalOrRadial ? layout.startAngle : 0,
|
|
669
|
+
endAngle: isHorizontalOrRadial ? layout.endAngle : Math.PI * 2
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
return {
|
|
674
|
+
x: isHorizontalOrRadial ? layout.x : coordLayout.x,
|
|
675
|
+
y: isHorizontalOrRadial ? coordLayout.y : layout.y,
|
|
676
|
+
width: isHorizontalOrRadial ? layout.width : coordLayout.width,
|
|
677
|
+
height: isHorizontalOrRadial ? coordLayout.height : layout.height
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
function createBackgroundEl(coord, isHorizontalOrRadial, layout) {
|
|
683
|
+
var ElementClz = coord.type === 'polar' ? graphic.Sector : graphic.Rect;
|
|
684
|
+
return new ElementClz({
|
|
685
|
+
shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),
|
|
686
|
+
silent: true,
|
|
687
|
+
z2: 0
|
|
688
|
+
});
|
|
689
|
+
}
|
|
@@ -36,7 +36,6 @@ export default {
|
|
|
36
36
|
reset: function (seriesModel, ecModel) {
|
|
37
37
|
|
|
38
38
|
var data = seriesModel.getData();
|
|
39
|
-
var isLargeRender = seriesModel.pipelineContext.large;
|
|
40
39
|
|
|
41
40
|
data.setVisual({
|
|
42
41
|
legendSymbol: 'roundRect',
|
|
@@ -51,6 +50,7 @@ export default {
|
|
|
51
50
|
return;
|
|
52
51
|
}
|
|
53
52
|
|
|
53
|
+
var isLargeRender = seriesModel.pipelineContext.large;
|
|
54
54
|
return !isLargeRender && {progress: progress};
|
|
55
55
|
|
|
56
56
|
|
|
@@ -23,7 +23,6 @@ import createListSimply from '../helper/createListSimply';
|
|
|
23
23
|
import {defaultEmphasis} from '../../util/model';
|
|
24
24
|
import {makeSeriesEncodeForNameBased} from '../../data/helper/sourceHelper';
|
|
25
25
|
import LegendVisualProvider from '../../visual/LegendVisualProvider';
|
|
26
|
-
import {bind} from 'zrender/src/core/util';
|
|
27
26
|
|
|
28
27
|
var FunnelSeries = echarts.extendSeriesModel({
|
|
29
28
|
|
|
@@ -35,7 +34,7 @@ var FunnelSeries = echarts.extendSeriesModel({
|
|
|
35
34
|
// Enable legend selection for each data item
|
|
36
35
|
// Use a function instead of direct access because data reference may changed
|
|
37
36
|
this.legendVisualProvider = new LegendVisualProvider(
|
|
38
|
-
bind(this.getData, this), bind(this.getRawData, this)
|
|
37
|
+
zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this)
|
|
39
38
|
);
|
|
40
39
|
// Extend labelLine emphasis
|
|
41
40
|
this._defaultLabelLine(option);
|
|
@@ -270,7 +270,7 @@ export default echarts.extendChartView({
|
|
|
270
270
|
},
|
|
271
271
|
|
|
272
272
|
focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
|
|
273
|
-
var data =
|
|
273
|
+
var data = seriesModel.getData();
|
|
274
274
|
var graph = data.graph;
|
|
275
275
|
var dataIndex = payload.dataIndex;
|
|
276
276
|
var edgeDataIndex = payload.edgeDataIndex;
|
|
@@ -308,7 +308,7 @@ export default echarts.extendChartView({
|
|
|
308
308
|
},
|
|
309
309
|
|
|
310
310
|
unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
|
|
311
|
-
var graph =
|
|
311
|
+
var graph = seriesModel.getData().graph;
|
|
312
312
|
|
|
313
313
|
graph.eachNode(function (node) {
|
|
314
314
|
fadeOutItem(node, nodeOpacityPath);
|
|
@@ -87,6 +87,7 @@ effectLineProto._updateEffectSymbol = function (lineData, idx) {
|
|
|
87
87
|
symbol.attr('scale', size);
|
|
88
88
|
|
|
89
89
|
this._symbolType = symbolType;
|
|
90
|
+
this._symbolScale = size;
|
|
90
91
|
|
|
91
92
|
this._updateEffectAnimation(lineData, effectModel, idx);
|
|
92
93
|
};
|
|
@@ -177,6 +178,7 @@ effectLineProto.updateSymbolPosition = function (symbol) {
|
|
|
177
178
|
var cp1 = symbol.__cp1;
|
|
178
179
|
var t = symbol.__t;
|
|
179
180
|
var pos = symbol.position;
|
|
181
|
+
var lastPos = [pos[0], pos[1]];
|
|
180
182
|
var quadraticAt = curveUtil.quadraticAt;
|
|
181
183
|
var quadraticDerivativeAt = curveUtil.quadraticDerivativeAt;
|
|
182
184
|
pos[0] = quadraticAt(p1[0], cp1[0], p2[0], t);
|
|
@@ -187,7 +189,27 @@ effectLineProto.updateSymbolPosition = function (symbol) {
|
|
|
187
189
|
var ty = quadraticDerivativeAt(p1[1], cp1[1], p2[1], t);
|
|
188
190
|
|
|
189
191
|
symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2;
|
|
190
|
-
|
|
192
|
+
// enable continuity trail for 'line', 'rect', 'roundRect' symbolType
|
|
193
|
+
if (this._symbolType === 'line' || this._symbolType === 'rect' || this._symbolType === 'roundRect') {
|
|
194
|
+
if (symbol.__lastT !== undefined && symbol.__lastT < symbol.__t) {
|
|
195
|
+
var scaleY = vec2.dist(lastPos, pos) * 1.05;
|
|
196
|
+
symbol.attr('scale', [symbol.scale[0], scaleY]);
|
|
197
|
+
// make sure the last segment render within endPoint
|
|
198
|
+
if (t === 1) {
|
|
199
|
+
pos[0] = lastPos[0] + (pos[0] - lastPos[0]) / 2;
|
|
200
|
+
pos[1] = lastPos[1] + (pos[1] - lastPos[1]) / 2;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else if (symbol.__lastT === 1) {
|
|
204
|
+
// After first loop, symbol.__t does NOT start with 0, so connect p1 to pos directly.
|
|
205
|
+
var scaleY = 2 * vec2.dist(p1, pos);
|
|
206
|
+
symbol.attr('scale', [symbol.scale[0], scaleY ]);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
symbol.attr('scale', this._symbolScale);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
symbol.__lastT = symbol.__t;
|
|
191
213
|
symbol.ignore = false;
|
|
192
214
|
};
|
|
193
215
|
|
package/src/chart/helper/Line.js
CHANGED
|
@@ -141,39 +141,90 @@ function updateSymbolAndLabelBeforeLineUpdate() {
|
|
|
141
141
|
var textPosition;
|
|
142
142
|
var textAlign;
|
|
143
143
|
var textVerticalAlign;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
var textOrigin;
|
|
145
|
+
|
|
146
|
+
var distance = label.__labelDistance;
|
|
147
|
+
var distanceX = distance[0] * invScale;
|
|
148
|
+
var distanceY = distance[1] * invScale;
|
|
149
|
+
var halfPercent = percent / 2;
|
|
150
|
+
var tangent = line.tangentAt(halfPercent);
|
|
151
|
+
var n = [tangent[1], -tangent[0]];
|
|
152
|
+
var cp = line.pointAt(halfPercent);
|
|
153
|
+
if (n[1] > 0) {
|
|
154
|
+
n[0] = -n[0];
|
|
155
|
+
n[1] = -n[1];
|
|
151
156
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
var tangent = line.tangentAt(halfPercent);
|
|
156
|
-
var n = [tangent[1], -tangent[0]];
|
|
157
|
-
var cp = line.pointAt(halfPercent);
|
|
158
|
-
if (n[1] > 0) {
|
|
159
|
-
n[0] = -n[0];
|
|
160
|
-
n[1] = -n[1];
|
|
161
|
-
}
|
|
162
|
-
textPosition = [cp[0] + n[0] * distance, cp[1] + n[1] * distance];
|
|
163
|
-
textAlign = 'center';
|
|
164
|
-
textVerticalAlign = 'bottom';
|
|
157
|
+
var dir = tangent[0] < 0 ? -1 : 1;
|
|
158
|
+
|
|
159
|
+
if (label.__position !== 'start' && label.__position !== 'end') {
|
|
165
160
|
var rotation = -Math.atan2(tangent[1], tangent[0]);
|
|
166
161
|
if (toPos[0] < fromPos[0]) {
|
|
167
162
|
rotation = Math.PI + rotation;
|
|
168
163
|
}
|
|
169
164
|
label.attr('rotation', rotation);
|
|
170
165
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
166
|
+
|
|
167
|
+
var dy;
|
|
168
|
+
switch (label.__position) {
|
|
169
|
+
case 'insideStartTop':
|
|
170
|
+
case 'insideMiddleTop':
|
|
171
|
+
case 'insideEndTop':
|
|
172
|
+
case 'middle':
|
|
173
|
+
dy = -distanceY;
|
|
174
|
+
textVerticalAlign = 'bottom';
|
|
175
|
+
break;
|
|
176
|
+
|
|
177
|
+
case 'insideStartBottom':
|
|
178
|
+
case 'insideMiddleBottom':
|
|
179
|
+
case 'insideEndBottom':
|
|
180
|
+
dy = distanceY;
|
|
181
|
+
textVerticalAlign = 'top';
|
|
182
|
+
break;
|
|
183
|
+
|
|
184
|
+
default:
|
|
185
|
+
dy = 0;
|
|
186
|
+
textVerticalAlign = 'middle';
|
|
176
187
|
}
|
|
188
|
+
|
|
189
|
+
switch (label.__position) {
|
|
190
|
+
case 'end':
|
|
191
|
+
textPosition = [d[0] * distanceX + toPos[0], d[1] * distanceY + toPos[1]];
|
|
192
|
+
textAlign = d[0] > 0.8 ? 'left' : (d[0] < -0.8 ? 'right' : 'center');
|
|
193
|
+
textVerticalAlign = d[1] > 0.8 ? 'top' : (d[1] < -0.8 ? 'bottom' : 'middle');
|
|
194
|
+
break;
|
|
195
|
+
|
|
196
|
+
case 'start':
|
|
197
|
+
textPosition = [-d[0] * distanceX + fromPos[0], -d[1] * distanceY + fromPos[1]];
|
|
198
|
+
textAlign = d[0] > 0.8 ? 'right' : (d[0] < -0.8 ? 'left' : 'center');
|
|
199
|
+
textVerticalAlign = d[1] > 0.8 ? 'bottom' : (d[1] < -0.8 ? 'top' : 'middle');
|
|
200
|
+
break;
|
|
201
|
+
|
|
202
|
+
case 'insideStartTop':
|
|
203
|
+
case 'insideStart':
|
|
204
|
+
case 'insideStartBottom':
|
|
205
|
+
textPosition = [distanceX * dir + fromPos[0], fromPos[1] + dy];
|
|
206
|
+
textAlign = tangent[0] < 0 ? 'right' : 'left';
|
|
207
|
+
textOrigin = [-distanceX * dir, -dy];
|
|
208
|
+
break;
|
|
209
|
+
|
|
210
|
+
case 'insideMiddleTop':
|
|
211
|
+
case 'insideMiddle':
|
|
212
|
+
case 'insideMiddleBottom':
|
|
213
|
+
case 'middle':
|
|
214
|
+
textPosition = [cp[0], cp[1] + dy];
|
|
215
|
+
textAlign = 'center';
|
|
216
|
+
textOrigin = [0, -dy];
|
|
217
|
+
break;
|
|
218
|
+
|
|
219
|
+
case 'insideEndTop':
|
|
220
|
+
case 'insideEnd':
|
|
221
|
+
case 'insideEndBottom':
|
|
222
|
+
textPosition = [-distanceX * dir + toPos[0], toPos[1] + dy];
|
|
223
|
+
textAlign = tangent[0] >= 0 ? 'right' : 'left';
|
|
224
|
+
textOrigin = [distanceX * dir, -dy];
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
|
|
177
228
|
label.attr({
|
|
178
229
|
style: {
|
|
179
230
|
// Use the user specified text align and baseline first
|
|
@@ -181,7 +232,8 @@ function updateSymbolAndLabelBeforeLineUpdate() {
|
|
|
181
232
|
textAlign: label.__textAlign || textAlign
|
|
182
233
|
},
|
|
183
234
|
position: textPosition,
|
|
184
|
-
scale: [invScale, invScale]
|
|
235
|
+
scale: [invScale, invScale],
|
|
236
|
+
origin: textOrigin
|
|
185
237
|
});
|
|
186
238
|
}
|
|
187
239
|
}
|
|
@@ -357,6 +409,12 @@ lineProto._updateCommonStl = function (lineData, idx, seriesScope) {
|
|
|
357
409
|
label.__verticalAlign = labelStyle.textVerticalAlign;
|
|
358
410
|
// 'start', 'middle', 'end'
|
|
359
411
|
label.__position = labelModel.get('position') || 'middle';
|
|
412
|
+
|
|
413
|
+
var distance = labelModel.get('distance');
|
|
414
|
+
if (!zrUtil.isArray(distance)) {
|
|
415
|
+
distance = [distance, distance];
|
|
416
|
+
}
|
|
417
|
+
label.__labelDistance = distance;
|
|
360
418
|
}
|
|
361
419
|
|
|
362
420
|
if (emphasisText != null) {
|
|
@@ -32,8 +32,11 @@ export default function () {
|
|
|
32
32
|
var originalLarge = fields.large;
|
|
33
33
|
var originalProgressive = fields.progressiveRender;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
// FIXME: if the planner works on a filtered series, `pipelineContext` does not
|
|
36
|
+
// exists. See #11611 . Probably we need to modify this structure, see the comment
|
|
37
|
+
// on `performRawSeries` in `Schedular.js`.
|
|
38
|
+
var large = fields.large = pipelineContext && pipelineContext.large;
|
|
39
|
+
var progressive = fields.progressiveRender = pipelineContext && pipelineContext.progressiveRender;
|
|
37
40
|
|
|
38
41
|
return !!((originalLarge ^ large) || (originalProgressive ^ progressive)) && 'reset';
|
|
39
42
|
};
|
package/src/chart/pie/PieView.js
CHANGED
|
@@ -171,7 +171,7 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
|
|
|
171
171
|
toggleItemSelected(
|
|
172
172
|
this,
|
|
173
173
|
data.getItemLayout(idx),
|
|
174
|
-
seriesModel.isSelected(
|
|
174
|
+
seriesModel.isSelected(data.getName(idx)),
|
|
175
175
|
seriesModel.get('selectedOffset'),
|
|
176
176
|
seriesModel.get('animation')
|
|
177
177
|
);
|
|
@@ -336,7 +336,7 @@ export default function (seriesModel, r, viewWidth, viewHeight, viewLeft, viewTo
|
|
|
336
336
|
inside: isLabelInside,
|
|
337
337
|
labelDistance: labelDistance,
|
|
338
338
|
labelAlignTo: labelAlignTo,
|
|
339
|
-
labelMargin:labelMargin,
|
|
339
|
+
labelMargin: labelMargin,
|
|
340
340
|
bleedMargin: bleedMargin,
|
|
341
341
|
textRect: textRect,
|
|
342
342
|
text: text,
|
|
@@ -61,6 +61,28 @@ var RadarSeries = SeriesModel.extend({
|
|
|
61
61
|
}).join('<br />');
|
|
62
62
|
},
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @implement
|
|
66
|
+
*/
|
|
67
|
+
getTooltipPosition: function (dataIndex) {
|
|
68
|
+
if (dataIndex != null) {
|
|
69
|
+
var data = this.getData();
|
|
70
|
+
var coordSys = this.coordinateSystem;
|
|
71
|
+
var values = data.getValues(
|
|
72
|
+
zrUtil.map(coordSys.dimensions, function (dim) {
|
|
73
|
+
return data.mapDimension(dim);
|
|
74
|
+
}), dataIndex, true
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
for (var i = 0, len = values.length; i < len; i++) {
|
|
78
|
+
if (!isNaN(values[i])) {
|
|
79
|
+
var indicatorAxes = coordSys.getIndicatorAxes();
|
|
80
|
+
return coordSys.coordToPoint(indicatorAxes[i].dataToCoord(values[i]), i);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
64
86
|
defaultOption: {
|
|
65
87
|
zlevel: 0,
|
|
66
88
|
z: 2,
|
|
@@ -138,6 +138,17 @@ var SankeySeries = SeriesModel.extend({
|
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
|
|
141
|
+
// Override Series.getDataParams()
|
|
142
|
+
getDataParams: function (dataIndex, dataType) {
|
|
143
|
+
var params = SankeySeries.superCall(this, 'getDataParams', dataIndex, dataType);
|
|
144
|
+
if (params.value == null && dataType === 'node') {
|
|
145
|
+
var node = this.getGraph().getNodeByIndex(dataIndex);
|
|
146
|
+
var nodeValue = node.getLayout().value;
|
|
147
|
+
params.value = nodeValue;
|
|
148
|
+
}
|
|
149
|
+
return params;
|
|
150
|
+
},
|
|
151
|
+
|
|
141
152
|
defaultOption: {
|
|
142
153
|
zlevel: 0,
|
|
143
154
|
z: 2,
|
|
@@ -198,7 +209,7 @@ var SankeySeries = SeriesModel.extend({
|
|
|
198
209
|
show: true
|
|
199
210
|
},
|
|
200
211
|
lineStyle: {
|
|
201
|
-
opacity: 0.
|
|
212
|
+
opacity: 0.5
|
|
202
213
|
}
|
|
203
214
|
},
|
|
204
215
|
|