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
|
@@ -71,7 +71,20 @@ var _default = BaseBarSeries.extend({
|
|
|
71
71
|
clip: true,
|
|
72
72
|
// If use caps on two sides of bars
|
|
73
73
|
// Only available on tangential polar bar
|
|
74
|
-
roundCap: false
|
|
74
|
+
roundCap: false,
|
|
75
|
+
showBackground: false,
|
|
76
|
+
backgroundStyle: {
|
|
77
|
+
color: 'rgba(180, 180, 180, 0.2)',
|
|
78
|
+
borderColor: null,
|
|
79
|
+
borderWidth: 0,
|
|
80
|
+
borderType: 'solid',
|
|
81
|
+
borderRadius: 0,
|
|
82
|
+
shadowBlur: 0,
|
|
83
|
+
shadowColor: null,
|
|
84
|
+
shadowOffsetX: 0,
|
|
85
|
+
shadowOffsetY: 0,
|
|
86
|
+
opacity: 1
|
|
87
|
+
}
|
|
75
88
|
}
|
|
76
89
|
});
|
|
77
90
|
|
package/lib/chart/bar/BarView.js
CHANGED
|
@@ -38,6 +38,8 @@ var barItemStyle = require("./barItemStyle");
|
|
|
38
38
|
|
|
39
39
|
var Path = require("zrender/lib/graphic/Path");
|
|
40
40
|
|
|
41
|
+
var Group = require("zrender/lib/container/Group");
|
|
42
|
+
|
|
41
43
|
var _throttle = require("../../util/throttle");
|
|
42
44
|
|
|
43
45
|
var throttle = _throttle.throttle;
|
|
@@ -149,14 +151,25 @@ var _default = echarts.extendChartView({
|
|
|
149
151
|
// And don't want the label are clipped.
|
|
150
152
|
|
|
151
153
|
var roundCap = seriesModel.get('roundCap', true);
|
|
154
|
+
var drawBackground = seriesModel.get('showBackground', true);
|
|
155
|
+
var backgroundModel = seriesModel.getModel('backgroundStyle');
|
|
156
|
+
var bgEls = [];
|
|
157
|
+
var oldBgEls = this._backgroundEls || [];
|
|
152
158
|
data.diff(oldData).add(function (dataIndex) {
|
|
159
|
+
var itemModel = data.getItemModel(dataIndex);
|
|
160
|
+
var layout = getLayout[coord.type](data, dataIndex, itemModel);
|
|
161
|
+
|
|
162
|
+
if (drawBackground) {
|
|
163
|
+
var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
|
|
164
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
165
|
+
bgEls[dataIndex] = bgEl;
|
|
166
|
+
} // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
|
|
167
|
+
|
|
168
|
+
|
|
153
169
|
if (!data.hasValue(dataIndex)) {
|
|
154
170
|
return;
|
|
155
171
|
}
|
|
156
172
|
|
|
157
|
-
var itemModel = data.getItemModel(dataIndex);
|
|
158
|
-
var layout = getLayout[coord.type](data, dataIndex, itemModel);
|
|
159
|
-
|
|
160
173
|
if (needsClip) {
|
|
161
174
|
// Clip will modify the layout params.
|
|
162
175
|
// And return a boolean to determine if the shape are fully clipped.
|
|
@@ -173,6 +186,19 @@ var _default = echarts.extendChartView({
|
|
|
173
186
|
group.add(el);
|
|
174
187
|
updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontalOrRadial, coord.type === 'polar');
|
|
175
188
|
}).update(function (newIndex, oldIndex) {
|
|
189
|
+
var itemModel = data.getItemModel(newIndex);
|
|
190
|
+
var layout = getLayout[coord.type](data, newIndex, itemModel);
|
|
191
|
+
|
|
192
|
+
if (drawBackground) {
|
|
193
|
+
var bgEl = oldBgEls[oldIndex];
|
|
194
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
195
|
+
bgEls[newIndex] = bgEl;
|
|
196
|
+
var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
|
|
197
|
+
graphic.updateProps(bgEl, {
|
|
198
|
+
shape: shape
|
|
199
|
+
}, animationModel, newIndex);
|
|
200
|
+
}
|
|
201
|
+
|
|
176
202
|
var el = oldData.getItemGraphicEl(oldIndex);
|
|
177
203
|
|
|
178
204
|
if (!data.hasValue(newIndex)) {
|
|
@@ -180,9 +206,6 @@ var _default = echarts.extendChartView({
|
|
|
180
206
|
return;
|
|
181
207
|
}
|
|
182
208
|
|
|
183
|
-
var itemModel = data.getItemModel(newIndex);
|
|
184
|
-
var layout = getLayout[coord.type](data, newIndex, itemModel);
|
|
185
|
-
|
|
186
209
|
if (needsClip) {
|
|
187
210
|
var isClipped = clip[coord.type](coordSysClipArea, layout);
|
|
188
211
|
|
|
@@ -213,6 +236,15 @@ var _default = echarts.extendChartView({
|
|
|
213
236
|
el && removeSector(dataIndex, animationModel, el);
|
|
214
237
|
}
|
|
215
238
|
}).execute();
|
|
239
|
+
var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group());
|
|
240
|
+
bgGroup.removeAll();
|
|
241
|
+
|
|
242
|
+
for (var i = 0; i < bgEls.length; ++i) {
|
|
243
|
+
bgGroup.add(bgEls[i]);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
group.add(bgGroup);
|
|
247
|
+
this._backgroundEls = bgEls;
|
|
216
248
|
this._data = data;
|
|
217
249
|
},
|
|
218
250
|
_renderLarge: function (seriesModel, ecModel, api) {
|
|
@@ -229,6 +261,8 @@ var _default = echarts.extendChartView({
|
|
|
229
261
|
}
|
|
230
262
|
},
|
|
231
263
|
_incrementalRenderLarge: function (params, seriesModel) {
|
|
264
|
+
this._removeBackground();
|
|
265
|
+
|
|
232
266
|
createLarge(seriesModel, this.group, true);
|
|
233
267
|
},
|
|
234
268
|
dispose: zrUtil.noop,
|
|
@@ -240,6 +274,9 @@ var _default = echarts.extendChartView({
|
|
|
240
274
|
var data = this._data;
|
|
241
275
|
|
|
242
276
|
if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
|
|
277
|
+
this._removeBackground();
|
|
278
|
+
|
|
279
|
+
this._backgroundEls = [];
|
|
243
280
|
data.eachItemGraphicEl(function (el) {
|
|
244
281
|
if (el.type === 'sector') {
|
|
245
282
|
removeSector(el.dataIndex, ecModel, el);
|
|
@@ -252,6 +289,10 @@ var _default = echarts.extendChartView({
|
|
|
252
289
|
}
|
|
253
290
|
|
|
254
291
|
this._data = null;
|
|
292
|
+
},
|
|
293
|
+
_removeBackground: function () {
|
|
294
|
+
this.group.remove(this._backgroundGroup);
|
|
295
|
+
this._backgroundGroup = null;
|
|
255
296
|
}
|
|
256
297
|
});
|
|
257
298
|
|
|
@@ -301,8 +342,10 @@ var clip = {
|
|
|
301
342
|
var elementCreator = {
|
|
302
343
|
cartesian2d: function (dataIndex, layout, isHorizontal, animationModel, isUpdate) {
|
|
303
344
|
var rect = new graphic.Rect({
|
|
304
|
-
shape: zrUtil.extend({}, layout)
|
|
305
|
-
|
|
345
|
+
shape: zrUtil.extend({}, layout),
|
|
346
|
+
z2: 1
|
|
347
|
+
});
|
|
348
|
+
rect.name = 'item'; // Animation
|
|
306
349
|
|
|
307
350
|
if (animationModel) {
|
|
308
351
|
var rectShape = rect.shape;
|
|
@@ -327,8 +370,10 @@ var elementCreator = {
|
|
|
327
370
|
var sector = new ShapeClass({
|
|
328
371
|
shape: zrUtil.defaults({
|
|
329
372
|
clockwise: clockwise
|
|
330
|
-
}, layout)
|
|
331
|
-
|
|
373
|
+
}, layout),
|
|
374
|
+
z2: 1
|
|
375
|
+
});
|
|
376
|
+
sector.name = 'item'; // Animation
|
|
332
377
|
|
|
333
378
|
if (animationModel) {
|
|
334
379
|
var sectorShape = sector.shape;
|
|
@@ -433,8 +478,11 @@ function updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHori
|
|
|
433
478
|
|
|
434
479
|
|
|
435
480
|
function getLineWidth(itemModel, rawLayout) {
|
|
436
|
-
var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
|
|
437
|
-
|
|
481
|
+
var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0; // width or height may be NaN for empty data
|
|
482
|
+
|
|
483
|
+
var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);
|
|
484
|
+
var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);
|
|
485
|
+
return Math.min(lineWidth, width, height);
|
|
438
486
|
}
|
|
439
487
|
|
|
440
488
|
var LargePath = Path.extend({
|
|
@@ -463,6 +511,31 @@ function createLarge(seriesModel, group, incremental) {
|
|
|
463
511
|
var startPoint = [];
|
|
464
512
|
var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;
|
|
465
513
|
startPoint[1 - baseDimIdx] = data.getLayout('valueAxisStart');
|
|
514
|
+
var largeDataIndices = data.getLayout('largeDataIndices');
|
|
515
|
+
var barWidth = data.getLayout('barWidth');
|
|
516
|
+
var backgroundModel = seriesModel.getModel('backgroundStyle');
|
|
517
|
+
var drawBackground = seriesModel.get('showBackground', true);
|
|
518
|
+
|
|
519
|
+
if (drawBackground) {
|
|
520
|
+
var points = data.getLayout('largeBackgroundPoints');
|
|
521
|
+
var backgroundStartPoint = [];
|
|
522
|
+
backgroundStartPoint[1 - baseDimIdx] = data.getLayout('backgroundStart');
|
|
523
|
+
var bgEl = new LargePath({
|
|
524
|
+
shape: {
|
|
525
|
+
points: points
|
|
526
|
+
},
|
|
527
|
+
incremental: !!incremental,
|
|
528
|
+
__startPoint: backgroundStartPoint,
|
|
529
|
+
__baseDimIdx: baseDimIdx,
|
|
530
|
+
__largeDataIndices: largeDataIndices,
|
|
531
|
+
__barWidth: barWidth,
|
|
532
|
+
silent: true,
|
|
533
|
+
z2: 0
|
|
534
|
+
});
|
|
535
|
+
setLargeBackgroundStyle(bgEl, backgroundModel, data);
|
|
536
|
+
group.add(bgEl);
|
|
537
|
+
}
|
|
538
|
+
|
|
466
539
|
var el = new LargePath({
|
|
467
540
|
shape: {
|
|
468
541
|
points: data.getLayout('largePoints')
|
|
@@ -470,8 +543,8 @@ function createLarge(seriesModel, group, incremental) {
|
|
|
470
543
|
incremental: !!incremental,
|
|
471
544
|
__startPoint: startPoint,
|
|
472
545
|
__baseDimIdx: baseDimIdx,
|
|
473
|
-
__largeDataIndices:
|
|
474
|
-
__barWidth:
|
|
546
|
+
__largeDataIndices: largeDataIndices,
|
|
547
|
+
__barWidth: barWidth
|
|
475
548
|
});
|
|
476
549
|
group.add(el);
|
|
477
550
|
setLargeStyle(el, seriesModel, data); // Enable tooltip and user mouse/touch event handlers.
|
|
@@ -527,4 +600,51 @@ function setLargeStyle(el, seriesModel, data) {
|
|
|
527
600
|
el.style.lineWidth = data.getLayout('barWidth');
|
|
528
601
|
}
|
|
529
602
|
|
|
603
|
+
function setLargeBackgroundStyle(el, backgroundModel, data) {
|
|
604
|
+
var borderColor = backgroundModel.get('borderColor') || backgroundModel.get('color');
|
|
605
|
+
var itemStyle = backgroundModel.getItemStyle(['color', 'borderColor']);
|
|
606
|
+
el.useStyle(itemStyle);
|
|
607
|
+
el.style.fill = null;
|
|
608
|
+
el.style.stroke = borderColor;
|
|
609
|
+
el.style.lineWidth = data.getLayout('barWidth');
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
function createBackgroundShape(isHorizontalOrRadial, layout, coord) {
|
|
613
|
+
var coordLayout;
|
|
614
|
+
var isPolar = coord.type === 'polar';
|
|
615
|
+
|
|
616
|
+
if (isPolar) {
|
|
617
|
+
coordLayout = coord.getArea();
|
|
618
|
+
} else {
|
|
619
|
+
coordLayout = coord.grid.getRect();
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
if (isPolar) {
|
|
623
|
+
return {
|
|
624
|
+
cx: coordLayout.cx,
|
|
625
|
+
cy: coordLayout.cy,
|
|
626
|
+
r0: isHorizontalOrRadial ? coordLayout.r0 : layout.r0,
|
|
627
|
+
r: isHorizontalOrRadial ? coordLayout.r : layout.r,
|
|
628
|
+
startAngle: isHorizontalOrRadial ? layout.startAngle : 0,
|
|
629
|
+
endAngle: isHorizontalOrRadial ? layout.endAngle : Math.PI * 2
|
|
630
|
+
};
|
|
631
|
+
} else {
|
|
632
|
+
return {
|
|
633
|
+
x: isHorizontalOrRadial ? layout.x : coordLayout.x,
|
|
634
|
+
y: isHorizontalOrRadial ? coordLayout.y : layout.y,
|
|
635
|
+
width: isHorizontalOrRadial ? layout.width : coordLayout.width,
|
|
636
|
+
height: isHorizontalOrRadial ? coordLayout.height : layout.height
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function createBackgroundEl(coord, isHorizontalOrRadial, layout) {
|
|
642
|
+
var ElementClz = coord.type === 'polar' ? graphic.Sector : graphic.Rect;
|
|
643
|
+
return new ElementClz({
|
|
644
|
+
shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),
|
|
645
|
+
silent: true,
|
|
646
|
+
z2: 0
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
|
|
530
650
|
module.exports = _default;
|
|
@@ -49,7 +49,6 @@ var _default = {
|
|
|
49
49
|
performRawSeries: true,
|
|
50
50
|
reset: function (seriesModel, ecModel) {
|
|
51
51
|
var data = seriesModel.getData();
|
|
52
|
-
var isLargeRender = seriesModel.pipelineContext.large;
|
|
53
52
|
data.setVisual({
|
|
54
53
|
legendSymbol: 'roundRect',
|
|
55
54
|
colorP: getColor(1, seriesModel),
|
|
@@ -62,6 +61,7 @@ var _default = {
|
|
|
62
61
|
return;
|
|
63
62
|
}
|
|
64
63
|
|
|
64
|
+
var isLargeRender = seriesModel.pipelineContext.large;
|
|
65
65
|
return !isLargeRender && {
|
|
66
66
|
progress: progress
|
|
67
67
|
};
|
|
@@ -22,8 +22,6 @@ var echarts = require("../../echarts");
|
|
|
22
22
|
|
|
23
23
|
var zrUtil = require("zrender/lib/core/util");
|
|
24
24
|
|
|
25
|
-
var bind = zrUtil.bind;
|
|
26
|
-
|
|
27
25
|
var createListSimply = require("../helper/createListSimply");
|
|
28
26
|
|
|
29
27
|
var _model = require("../../util/model");
|
|
@@ -60,7 +58,7 @@ var FunnelSeries = echarts.extendSeriesModel({
|
|
|
60
58
|
FunnelSeries.superApply(this, 'init', arguments); // Enable legend selection for each data item
|
|
61
59
|
// Use a function instead of direct access because data reference may changed
|
|
62
60
|
|
|
63
|
-
this.legendVisualProvider = new LegendVisualProvider(bind(this.getData, this), bind(this.getRawData, this)); // Extend labelLine emphasis
|
|
61
|
+
this.legendVisualProvider = new LegendVisualProvider(zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this)); // Extend labelLine emphasis
|
|
64
62
|
|
|
65
63
|
this._defaultLabelLine(option);
|
|
66
64
|
},
|
|
@@ -286,8 +286,7 @@ var _default = echarts.extendChartView({
|
|
|
286
286
|
}
|
|
287
287
|
},
|
|
288
288
|
focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
|
|
289
|
-
var data =
|
|
290
|
-
|
|
289
|
+
var data = seriesModel.getData();
|
|
291
290
|
var graph = data.graph;
|
|
292
291
|
var dataIndex = payload.dataIndex;
|
|
293
292
|
var edgeDataIndex = payload.edgeDataIndex;
|
|
@@ -325,8 +324,7 @@ var _default = echarts.extendChartView({
|
|
|
325
324
|
}
|
|
326
325
|
},
|
|
327
326
|
unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
|
|
328
|
-
var graph =
|
|
329
|
-
|
|
327
|
+
var graph = seriesModel.getData().graph;
|
|
330
328
|
graph.eachNode(function (node) {
|
|
331
329
|
fadeOutItem(node, nodeOpacityPath);
|
|
332
330
|
});
|
|
@@ -108,6 +108,7 @@ effectLineProto._updateEffectSymbol = function (lineData, idx) {
|
|
|
108
108
|
symbol.setColor(color);
|
|
109
109
|
symbol.attr('scale', size);
|
|
110
110
|
this._symbolType = symbolType;
|
|
111
|
+
this._symbolScale = size;
|
|
111
112
|
|
|
112
113
|
this._updateEffectAnimation(lineData, effectModel, idx);
|
|
113
114
|
};
|
|
@@ -191,6 +192,7 @@ effectLineProto.updateSymbolPosition = function (symbol) {
|
|
|
191
192
|
var cp1 = symbol.__cp1;
|
|
192
193
|
var t = symbol.__t;
|
|
193
194
|
var pos = symbol.position;
|
|
195
|
+
var lastPos = [pos[0], pos[1]];
|
|
194
196
|
var quadraticAt = curveUtil.quadraticAt;
|
|
195
197
|
var quadraticDerivativeAt = curveUtil.quadraticDerivativeAt;
|
|
196
198
|
pos[0] = quadraticAt(p1[0], cp1[0], p2[0], t);
|
|
@@ -198,7 +200,27 @@ effectLineProto.updateSymbolPosition = function (symbol) {
|
|
|
198
200
|
|
|
199
201
|
var tx = quadraticDerivativeAt(p1[0], cp1[0], p2[0], t);
|
|
200
202
|
var ty = quadraticDerivativeAt(p1[1], cp1[1], p2[1], t);
|
|
201
|
-
symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2;
|
|
203
|
+
symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2; // enable continuity trail for 'line', 'rect', 'roundRect' symbolType
|
|
204
|
+
|
|
205
|
+
if (this._symbolType === 'line' || this._symbolType === 'rect' || this._symbolType === 'roundRect') {
|
|
206
|
+
if (symbol.__lastT !== undefined && symbol.__lastT < symbol.__t) {
|
|
207
|
+
var scaleY = vec2.dist(lastPos, pos) * 1.05;
|
|
208
|
+
symbol.attr('scale', [symbol.scale[0], scaleY]); // make sure the last segment render within endPoint
|
|
209
|
+
|
|
210
|
+
if (t === 1) {
|
|
211
|
+
pos[0] = lastPos[0] + (pos[0] - lastPos[0]) / 2;
|
|
212
|
+
pos[1] = lastPos[1] + (pos[1] - lastPos[1]) / 2;
|
|
213
|
+
}
|
|
214
|
+
} else if (symbol.__lastT === 1) {
|
|
215
|
+
// After first loop, symbol.__t does NOT start with 0, so connect p1 to pos directly.
|
|
216
|
+
var scaleY = 2 * vec2.dist(p1, pos);
|
|
217
|
+
symbol.attr('scale', [symbol.scale[0], scaleY]);
|
|
218
|
+
} else {
|
|
219
|
+
symbol.attr('scale', this._symbolScale);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
symbol.__lastT = symbol.__t;
|
|
202
224
|
symbol.ignore = false;
|
|
203
225
|
};
|
|
204
226
|
|
package/lib/chart/helper/Line.js
CHANGED
|
@@ -161,40 +161,93 @@ function updateSymbolAndLabelBeforeLineUpdate() {
|
|
|
161
161
|
var textPosition;
|
|
162
162
|
var textAlign;
|
|
163
163
|
var textVerticalAlign;
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
164
|
+
var textOrigin;
|
|
165
|
+
var distance = label.__labelDistance;
|
|
166
|
+
var distanceX = distance[0] * invScale;
|
|
167
|
+
var distanceY = distance[1] * invScale;
|
|
168
|
+
var halfPercent = percent / 2;
|
|
169
|
+
var tangent = line.tangentAt(halfPercent);
|
|
170
|
+
var n = [tangent[1], -tangent[0]];
|
|
171
|
+
var cp = line.pointAt(halfPercent);
|
|
172
|
+
|
|
173
|
+
if (n[1] > 0) {
|
|
174
|
+
n[0] = -n[0];
|
|
175
|
+
n[1] = -n[1];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
var dir = tangent[0] < 0 ? -1 : 1;
|
|
179
|
+
|
|
180
|
+
if (label.__position !== 'start' && label.__position !== 'end') {
|
|
181
|
+
var rotation = -Math.atan2(tangent[1], tangent[0]);
|
|
182
|
+
|
|
183
|
+
if (toPos[0] < fromPos[0]) {
|
|
184
|
+
rotation = Math.PI + rotation;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
label.attr('rotation', rotation);
|
|
188
|
+
}
|
|
186
189
|
|
|
187
|
-
|
|
188
|
-
rotation = Math.PI + rotation;
|
|
189
|
-
}
|
|
190
|
+
var dy;
|
|
190
191
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
switch (label.__position) {
|
|
193
|
+
case 'insideStartTop':
|
|
194
|
+
case 'insideMiddleTop':
|
|
195
|
+
case 'insideEndTop':
|
|
196
|
+
case 'middle':
|
|
197
|
+
dy = -distanceY;
|
|
198
|
+
textVerticalAlign = 'bottom';
|
|
199
|
+
break;
|
|
200
|
+
|
|
201
|
+
case 'insideStartBottom':
|
|
202
|
+
case 'insideMiddleBottom':
|
|
203
|
+
case 'insideEndBottom':
|
|
204
|
+
dy = distanceY;
|
|
205
|
+
textVerticalAlign = 'top';
|
|
206
|
+
break;
|
|
207
|
+
|
|
208
|
+
default:
|
|
209
|
+
dy = 0;
|
|
210
|
+
textVerticalAlign = 'middle';
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
switch (label.__position) {
|
|
214
|
+
case 'end':
|
|
215
|
+
textPosition = [d[0] * distanceX + toPos[0], d[1] * distanceY + toPos[1]];
|
|
216
|
+
textAlign = d[0] > 0.8 ? 'left' : d[0] < -0.8 ? 'right' : 'center';
|
|
217
|
+
textVerticalAlign = d[1] > 0.8 ? 'top' : d[1] < -0.8 ? 'bottom' : 'middle';
|
|
218
|
+
break;
|
|
219
|
+
|
|
220
|
+
case 'start':
|
|
221
|
+
textPosition = [-d[0] * distanceX + fromPos[0], -d[1] * distanceY + fromPos[1]];
|
|
222
|
+
textAlign = d[0] > 0.8 ? 'right' : d[0] < -0.8 ? 'left' : 'center';
|
|
223
|
+
textVerticalAlign = d[1] > 0.8 ? 'bottom' : d[1] < -0.8 ? 'top' : 'middle';
|
|
224
|
+
break;
|
|
225
|
+
|
|
226
|
+
case 'insideStartTop':
|
|
227
|
+
case 'insideStart':
|
|
228
|
+
case 'insideStartBottom':
|
|
229
|
+
textPosition = [distanceX * dir + fromPos[0], fromPos[1] + dy];
|
|
230
|
+
textAlign = tangent[0] < 0 ? 'right' : 'left';
|
|
231
|
+
textOrigin = [-distanceX * dir, -dy];
|
|
232
|
+
break;
|
|
233
|
+
|
|
234
|
+
case 'insideMiddleTop':
|
|
235
|
+
case 'insideMiddle':
|
|
236
|
+
case 'insideMiddleBottom':
|
|
237
|
+
case 'middle':
|
|
238
|
+
textPosition = [cp[0], cp[1] + dy];
|
|
239
|
+
textAlign = 'center';
|
|
240
|
+
textOrigin = [0, -dy];
|
|
241
|
+
break;
|
|
242
|
+
|
|
243
|
+
case 'insideEndTop':
|
|
244
|
+
case 'insideEnd':
|
|
245
|
+
case 'insideEndBottom':
|
|
246
|
+
textPosition = [-distanceX * dir + toPos[0], toPos[1] + dy];
|
|
247
|
+
textAlign = tangent[0] >= 0 ? 'right' : 'left';
|
|
248
|
+
textOrigin = [distanceX * dir, -dy];
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
198
251
|
|
|
199
252
|
label.attr({
|
|
200
253
|
style: {
|
|
@@ -203,7 +256,8 @@ function updateSymbolAndLabelBeforeLineUpdate() {
|
|
|
203
256
|
textAlign: label.__textAlign || textAlign
|
|
204
257
|
},
|
|
205
258
|
position: textPosition,
|
|
206
|
-
scale: [invScale, invScale]
|
|
259
|
+
scale: [invScale, invScale],
|
|
260
|
+
origin: textOrigin
|
|
207
261
|
});
|
|
208
262
|
}
|
|
209
263
|
}
|
|
@@ -347,6 +401,13 @@ lineProto._updateCommonStl = function (lineData, idx, seriesScope) {
|
|
|
347
401
|
label.__verticalAlign = labelStyle.textVerticalAlign; // 'start', 'middle', 'end'
|
|
348
402
|
|
|
349
403
|
label.__position = labelModel.get('position') || 'middle';
|
|
404
|
+
var distance = labelModel.get('distance');
|
|
405
|
+
|
|
406
|
+
if (!zrUtil.isArray(distance)) {
|
|
407
|
+
distance = [distance, distance];
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
label.__labelDistance = distance;
|
|
350
411
|
}
|
|
351
412
|
|
|
352
413
|
if (emphasisText != null) {
|
|
@@ -50,9 +50,12 @@ function _default() {
|
|
|
50
50
|
var fields = inner(seriesModel);
|
|
51
51
|
var pipelineContext = seriesModel.pipelineContext;
|
|
52
52
|
var originalLarge = fields.large;
|
|
53
|
-
var originalProgressive = fields.progressiveRender;
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
var originalProgressive = fields.progressiveRender; // FIXME: if the planner works on a filtered series, `pipelineContext` does not
|
|
54
|
+
// exists. See #11611 . Probably we need to modify this structure, see the comment
|
|
55
|
+
// on `performRawSeries` in `Schedular.js`.
|
|
56
|
+
|
|
57
|
+
var large = fields.large = pipelineContext && pipelineContext.large;
|
|
58
|
+
var progressive = fields.progressiveRender = pipelineContext && pipelineContext.progressiveRender;
|
|
56
59
|
return !!(originalLarge ^ large || originalProgressive ^ progressive) && 'reset';
|
|
57
60
|
};
|
|
58
61
|
}
|
package/lib/chart/pie/PieView.js
CHANGED
|
@@ -159,7 +159,7 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
|
|
|
159
159
|
var cursorStyle = itemModel.getShallow('cursor');
|
|
160
160
|
cursorStyle && sector.attr('cursor', cursorStyle); // Toggle selected
|
|
161
161
|
|
|
162
|
-
toggleItemSelected(this, data.getItemLayout(idx), seriesModel.isSelected(
|
|
162
|
+
toggleItemSelected(this, data.getItemLayout(idx), seriesModel.isSelected(data.getName(idx)), seriesModel.get('selectedOffset'), seriesModel.get('animation')); // Label and text animation should be applied only for transition type animation when update
|
|
163
163
|
|
|
164
164
|
var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
|
|
165
165
|
|
|
@@ -74,6 +74,26 @@ var RadarSeries = SeriesModel.extend({
|
|
|
74
74
|
return encodeHTML(axis.name + ' : ' + val);
|
|
75
75
|
}).join('<br />');
|
|
76
76
|
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @implement
|
|
80
|
+
*/
|
|
81
|
+
getTooltipPosition: function (dataIndex) {
|
|
82
|
+
if (dataIndex != null) {
|
|
83
|
+
var data = this.getData();
|
|
84
|
+
var coordSys = this.coordinateSystem;
|
|
85
|
+
var values = data.getValues(zrUtil.map(coordSys.dimensions, function (dim) {
|
|
86
|
+
return data.mapDimension(dim);
|
|
87
|
+
}), dataIndex, true);
|
|
88
|
+
|
|
89
|
+
for (var i = 0, len = values.length; i < len; i++) {
|
|
90
|
+
if (!isNaN(values[i])) {
|
|
91
|
+
var indicatorAxes = coordSys.getIndicatorAxes();
|
|
92
|
+
return coordSys.coordToPoint(indicatorAxes[i].dataToCoord(values[i]), i);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
77
97
|
defaultOption: {
|
|
78
98
|
zlevel: 0,
|
|
79
99
|
z: 2,
|
|
@@ -160,6 +160,18 @@ var SankeySeries = SeriesModel.extend({
|
|
|
160
160
|
option.focusNodeAdjacency = 'allEdges';
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
|
+
// Override Series.getDataParams()
|
|
164
|
+
getDataParams: function (dataIndex, dataType) {
|
|
165
|
+
var params = SankeySeries.superCall(this, 'getDataParams', dataIndex, dataType);
|
|
166
|
+
|
|
167
|
+
if (params.value == null && dataType === 'node') {
|
|
168
|
+
var node = this.getGraph().getNodeByIndex(dataIndex);
|
|
169
|
+
var nodeValue = node.getLayout().value;
|
|
170
|
+
params.value = nodeValue;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return params;
|
|
174
|
+
},
|
|
163
175
|
defaultOption: {
|
|
164
176
|
zlevel: 0,
|
|
165
177
|
z: 2,
|
|
@@ -205,7 +217,7 @@ var SankeySeries = SeriesModel.extend({
|
|
|
205
217
|
show: true
|
|
206
218
|
},
|
|
207
219
|
lineStyle: {
|
|
208
|
-
opacity: 0.
|
|
220
|
+
opacity: 0.5
|
|
209
221
|
}
|
|
210
222
|
},
|
|
211
223
|
animationEasing: 'linear',
|