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
|
@@ -43,7 +43,9 @@ var zrUtil = require("zrender/lib/core/util");
|
|
|
43
43
|
* under the License.
|
|
44
44
|
*/
|
|
45
45
|
var nodeOpacityPath = ['itemStyle', 'opacity'];
|
|
46
|
+
var hoverNodeOpacityPath = ['emphasis', 'itemStyle', 'opacity'];
|
|
46
47
|
var lineOpacityPath = ['lineStyle', 'opacity'];
|
|
48
|
+
var hoverLineOpacityPath = ['emphasis', 'lineStyle', 'opacity'];
|
|
47
49
|
|
|
48
50
|
function getItemOpacity(item, opacityPath) {
|
|
49
51
|
return item.getVisual('opacity') || item.getModel().get(opacityPath);
|
|
@@ -69,12 +71,13 @@ function fadeOutItem(item, opacityPath, opacityRatio) {
|
|
|
69
71
|
function fadeInItem(item, opacityPath) {
|
|
70
72
|
var opacity = getItemOpacity(item, opacityPath);
|
|
71
73
|
var el = item.getGraphicEl();
|
|
72
|
-
el.highlight && el.highlight();
|
|
73
74
|
el.traverse(function (child) {
|
|
74
75
|
if (child.type !== 'group') {
|
|
75
76
|
child.setStyle('opacity', opacity);
|
|
76
77
|
}
|
|
77
|
-
});
|
|
78
|
+
}); // Support emphasis here.
|
|
79
|
+
|
|
80
|
+
el.highlight && el.highlight();
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
var SankeyShape = graphic.extendShape({
|
|
@@ -104,6 +107,12 @@ var SankeyShape = graphic.extendShape({
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
ctx.closePath();
|
|
110
|
+
},
|
|
111
|
+
highlight: function () {
|
|
112
|
+
this.trigger('emphasis');
|
|
113
|
+
},
|
|
114
|
+
downplay: function () {
|
|
115
|
+
this.trigger('normal');
|
|
107
116
|
}
|
|
108
117
|
});
|
|
109
118
|
|
|
@@ -266,8 +275,19 @@ var _default = echarts.extendChartView({
|
|
|
266
275
|
el.cursor = 'move';
|
|
267
276
|
}
|
|
268
277
|
|
|
278
|
+
el.highlight = function () {
|
|
279
|
+
this.trigger('emphasis');
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
el.downplay = function () {
|
|
283
|
+
this.trigger('normal');
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
el.focusNodeAdjHandler && el.off('mouseover', el.focusNodeAdjHandler);
|
|
287
|
+
el.unfocusNodeAdjHandler && el.off('mouseout', el.unfocusNodeAdjHandler);
|
|
288
|
+
|
|
269
289
|
if (itemModel.get('focusNodeAdjacency')) {
|
|
270
|
-
el.
|
|
290
|
+
el.on('mouseover', el.focusNodeAdjHandler = function () {
|
|
271
291
|
if (!sankeyView._focusAdjacencyDisabled) {
|
|
272
292
|
sankeyView._clearTimer();
|
|
273
293
|
|
|
@@ -278,7 +298,7 @@ var _default = echarts.extendChartView({
|
|
|
278
298
|
});
|
|
279
299
|
}
|
|
280
300
|
});
|
|
281
|
-
el.
|
|
301
|
+
el.on('mouseout', el.unfocusNodeAdjHandler = function () {
|
|
282
302
|
if (!sankeyView._focusAdjacencyDisabled) {
|
|
283
303
|
sankeyView._dispatchUnfocus(api);
|
|
284
304
|
}
|
|
@@ -287,9 +307,11 @@ var _default = echarts.extendChartView({
|
|
|
287
307
|
});
|
|
288
308
|
edgeData.eachItemGraphicEl(function (el, dataIndex) {
|
|
289
309
|
var edgeModel = edgeData.getItemModel(dataIndex);
|
|
310
|
+
el.focusNodeAdjHandler && el.off('mouseover', el.focusNodeAdjHandler);
|
|
311
|
+
el.unfocusNodeAdjHandler && el.off('mouseout', el.unfocusNodeAdjHandler);
|
|
290
312
|
|
|
291
313
|
if (edgeModel.get('focusNodeAdjacency')) {
|
|
292
|
-
el.
|
|
314
|
+
el.on('mouseover', el.focusNodeAdjHandler = function () {
|
|
293
315
|
if (!sankeyView._focusAdjacencyDisabled) {
|
|
294
316
|
sankeyView._clearTimer();
|
|
295
317
|
|
|
@@ -300,7 +322,7 @@ var _default = echarts.extendChartView({
|
|
|
300
322
|
});
|
|
301
323
|
}
|
|
302
324
|
});
|
|
303
|
-
el.
|
|
325
|
+
el.on('mouseout', el.unfocusNodeAdjHandler = function () {
|
|
304
326
|
if (!sankeyView._focusAdjacencyDisabled) {
|
|
305
327
|
sankeyView._dispatchUnfocus(api);
|
|
306
328
|
}
|
|
@@ -339,8 +361,7 @@ var _default = echarts.extendChartView({
|
|
|
339
361
|
}
|
|
340
362
|
},
|
|
341
363
|
focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
|
|
342
|
-
var data =
|
|
343
|
-
|
|
364
|
+
var data = seriesModel.getData();
|
|
344
365
|
var graph = data.graph;
|
|
345
366
|
var dataIndex = payload.dataIndex;
|
|
346
367
|
var itemModel = data.getItemModel(dataIndex);
|
|
@@ -360,7 +381,7 @@ var _default = echarts.extendChartView({
|
|
|
360
381
|
});
|
|
361
382
|
|
|
362
383
|
if (node) {
|
|
363
|
-
fadeInItem(node,
|
|
384
|
+
fadeInItem(node, hoverNodeOpacityPath);
|
|
364
385
|
var focusNodeAdj = itemModel.get('focusNodeAdjacency');
|
|
365
386
|
|
|
366
387
|
if (focusNodeAdj === 'outEdges') {
|
|
@@ -369,8 +390,8 @@ var _default = echarts.extendChartView({
|
|
|
369
390
|
return;
|
|
370
391
|
}
|
|
371
392
|
|
|
372
|
-
fadeInItem(edge,
|
|
373
|
-
fadeInItem(edge.node2,
|
|
393
|
+
fadeInItem(edge, hoverLineOpacityPath);
|
|
394
|
+
fadeInItem(edge.node2, hoverNodeOpacityPath);
|
|
374
395
|
});
|
|
375
396
|
} else if (focusNodeAdj === 'inEdges') {
|
|
376
397
|
zrUtil.each(node.inEdges, function (edge) {
|
|
@@ -378,8 +399,8 @@ var _default = echarts.extendChartView({
|
|
|
378
399
|
return;
|
|
379
400
|
}
|
|
380
401
|
|
|
381
|
-
fadeInItem(edge,
|
|
382
|
-
fadeInItem(edge.node1,
|
|
402
|
+
fadeInItem(edge, hoverLineOpacityPath);
|
|
403
|
+
fadeInItem(edge.node1, hoverNodeOpacityPath);
|
|
383
404
|
});
|
|
384
405
|
} else if (focusNodeAdj === 'allEdges') {
|
|
385
406
|
zrUtil.each(node.edges, function (edge) {
|
|
@@ -387,22 +408,21 @@ var _default = echarts.extendChartView({
|
|
|
387
408
|
return;
|
|
388
409
|
}
|
|
389
410
|
|
|
390
|
-
fadeInItem(edge,
|
|
391
|
-
fadeInItem(edge.node1,
|
|
392
|
-
fadeInItem(edge.node2,
|
|
411
|
+
fadeInItem(edge, hoverLineOpacityPath);
|
|
412
|
+
edge.node1 !== node && fadeInItem(edge.node1, hoverNodeOpacityPath);
|
|
413
|
+
edge.node2 !== node && fadeInItem(edge.node2, hoverNodeOpacityPath);
|
|
393
414
|
});
|
|
394
415
|
}
|
|
395
416
|
}
|
|
396
417
|
|
|
397
418
|
if (edge) {
|
|
398
|
-
fadeInItem(edge,
|
|
399
|
-
fadeInItem(edge.node1,
|
|
400
|
-
fadeInItem(edge.node2,
|
|
419
|
+
fadeInItem(edge, hoverLineOpacityPath);
|
|
420
|
+
fadeInItem(edge.node1, hoverNodeOpacityPath);
|
|
421
|
+
fadeInItem(edge.node2, hoverNodeOpacityPath);
|
|
401
422
|
}
|
|
402
423
|
},
|
|
403
424
|
unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
|
|
404
|
-
var graph =
|
|
405
|
-
|
|
425
|
+
var graph = seriesModel.getGraph();
|
|
406
426
|
graph.eachNode(function (node) {
|
|
407
427
|
fadeOutItem(node, nodeOpacityPath);
|
|
408
428
|
});
|
|
@@ -424,8 +444,7 @@ function createGridClipShape(rect, seriesModel, cb) {
|
|
|
424
444
|
});
|
|
425
445
|
graphic.initProps(rectEl, {
|
|
426
446
|
shape: {
|
|
427
|
-
width: rect.width + 20
|
|
428
|
-
height: rect.height + 20
|
|
447
|
+
width: rect.width + 20
|
|
429
448
|
}
|
|
430
449
|
}, seriesModel, cb);
|
|
431
450
|
return rectEl;
|
|
@@ -97,7 +97,8 @@ function computeNodeValues(nodes) {
|
|
|
97
97
|
zrUtil.each(nodes, function (node) {
|
|
98
98
|
var value1 = sum(node.outEdges, getEdgeValue);
|
|
99
99
|
var value2 = sum(node.inEdges, getEdgeValue);
|
|
100
|
-
var
|
|
100
|
+
var nodeRawValue = node.getValue() || 0;
|
|
101
|
+
var value = Math.max(value1, value2, nodeRawValue);
|
|
101
102
|
node.setLayout({
|
|
102
103
|
value: value
|
|
103
104
|
}, true);
|
|
@@ -488,13 +489,13 @@ function getEdgeValue(edge) {
|
|
|
488
489
|
return edge.getValue();
|
|
489
490
|
}
|
|
490
491
|
|
|
491
|
-
function sum(array,
|
|
492
|
+
function sum(array, cb, orient) {
|
|
492
493
|
var sum = 0;
|
|
493
494
|
var len = array.length;
|
|
494
495
|
var i = -1;
|
|
495
496
|
|
|
496
497
|
while (++i < len) {
|
|
497
|
-
var value = +
|
|
498
|
+
var value = +cb.call(array, array[i], orient);
|
|
498
499
|
|
|
499
500
|
if (!isNaN(value)) {
|
|
500
501
|
sum += value;
|
|
@@ -147,6 +147,9 @@ var _default = SeriesModel.extend({
|
|
|
147
147
|
bottom: '12%',
|
|
148
148
|
// the layout of the tree, two value can be selected, 'orthogonal' or 'radial'
|
|
149
149
|
layout: 'orthogonal',
|
|
150
|
+
// value can be 'polyline'
|
|
151
|
+
edgeShape: 'curve',
|
|
152
|
+
edgeForkPosition: '50%',
|
|
150
153
|
// true | false | 'move' | 'scale', see module:component/helper/RoamController.
|
|
151
154
|
roam: false,
|
|
152
155
|
// Symbol size scale ratio in roam
|
|
@@ -42,6 +42,14 @@ var _cursorHelper = require("../../component/helper/cursorHelper");
|
|
|
42
42
|
|
|
43
43
|
var onIrrelevantElement = _cursorHelper.onIrrelevantElement;
|
|
44
44
|
|
|
45
|
+
var _config = require("../../config");
|
|
46
|
+
|
|
47
|
+
var __DEV__ = _config.__DEV__;
|
|
48
|
+
|
|
49
|
+
var _number = require("../../util/number");
|
|
50
|
+
|
|
51
|
+
var parsePercent = _number.parsePercent;
|
|
52
|
+
|
|
45
53
|
/*
|
|
46
54
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
47
55
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -60,6 +68,55 @@ var onIrrelevantElement = _cursorHelper.onIrrelevantElement;
|
|
|
60
68
|
* specific language governing permissions and limitations
|
|
61
69
|
* under the License.
|
|
62
70
|
*/
|
|
71
|
+
var TreeShape = graphic.extendShape({
|
|
72
|
+
shape: {
|
|
73
|
+
parentPoint: [],
|
|
74
|
+
childPoints: [],
|
|
75
|
+
orient: '',
|
|
76
|
+
forkPosition: ''
|
|
77
|
+
},
|
|
78
|
+
style: {
|
|
79
|
+
stroke: '#000',
|
|
80
|
+
fill: null
|
|
81
|
+
},
|
|
82
|
+
buildPath: function (ctx, shape) {
|
|
83
|
+
var childPoints = shape.childPoints;
|
|
84
|
+
var childLen = childPoints.length;
|
|
85
|
+
var parentPoint = shape.parentPoint;
|
|
86
|
+
var firstChildPos = childPoints[0];
|
|
87
|
+
var lastChildPos = childPoints[childLen - 1];
|
|
88
|
+
|
|
89
|
+
if (childLen === 1) {
|
|
90
|
+
ctx.moveTo(parentPoint[0], parentPoint[1]);
|
|
91
|
+
ctx.lineTo(firstChildPos[0], firstChildPos[1]);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
var orient = shape.orient;
|
|
96
|
+
var forkDim = orient === 'TB' || orient === 'BT' ? 0 : 1;
|
|
97
|
+
var otherDim = 1 - forkDim;
|
|
98
|
+
var forkPosition = parsePercent(shape.forkPosition, 1);
|
|
99
|
+
var tmpPoint = [];
|
|
100
|
+
tmpPoint[forkDim] = parentPoint[forkDim];
|
|
101
|
+
tmpPoint[otherDim] = parentPoint[otherDim] + (lastChildPos[otherDim] - parentPoint[otherDim]) * forkPosition;
|
|
102
|
+
ctx.moveTo(parentPoint[0], parentPoint[1]);
|
|
103
|
+
ctx.lineTo(tmpPoint[0], tmpPoint[1]);
|
|
104
|
+
ctx.moveTo(firstChildPos[0], firstChildPos[1]);
|
|
105
|
+
tmpPoint[forkDim] = firstChildPos[forkDim];
|
|
106
|
+
ctx.lineTo(tmpPoint[0], tmpPoint[1]);
|
|
107
|
+
tmpPoint[forkDim] = lastChildPos[forkDim];
|
|
108
|
+
ctx.lineTo(tmpPoint[0], tmpPoint[1]);
|
|
109
|
+
ctx.lineTo(lastChildPos[0], lastChildPos[1]);
|
|
110
|
+
|
|
111
|
+
for (var i = 1; i < childLen - 1; i++) {
|
|
112
|
+
var point = childPoints[i];
|
|
113
|
+
ctx.moveTo(point[0], point[1]);
|
|
114
|
+
tmpPoint[forkDim] = point[forkDim];
|
|
115
|
+
ctx.lineTo(tmpPoint[0], tmpPoint[1]);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
63
120
|
var _default = echarts.extendChartView({
|
|
64
121
|
type: 'tree',
|
|
65
122
|
|
|
@@ -112,6 +169,8 @@ var _default = echarts.extendChartView({
|
|
|
112
169
|
var seriesScope = {
|
|
113
170
|
expandAndCollapse: seriesModel.get('expandAndCollapse'),
|
|
114
171
|
layout: layout,
|
|
172
|
+
edgeShape: seriesModel.get('edgeShape'),
|
|
173
|
+
edgeForkPosition: seriesModel.get('edgeForkPosition'),
|
|
115
174
|
orient: seriesModel.getOrient(),
|
|
116
175
|
curvature: seriesModel.get('lineStyle.curveness'),
|
|
117
176
|
symbolRotate: seriesModel.get('symbolRotate'),
|
|
@@ -387,27 +446,72 @@ function updateNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope)
|
|
|
387
446
|
});
|
|
388
447
|
}
|
|
389
448
|
|
|
390
|
-
|
|
391
|
-
|
|
449
|
+
drawEdge(seriesModel, node, virtualRoot, symbolEl, sourceOldLayout, sourceLayout, targetLayout, group, seriesScope);
|
|
450
|
+
}
|
|
392
451
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
452
|
+
function drawEdge(seriesModel, node, virtualRoot, symbolEl, sourceOldLayout, sourceLayout, targetLayout, group, seriesScope) {
|
|
453
|
+
var edgeShape = seriesScope.edgeShape;
|
|
454
|
+
var edge = symbolEl.__edge;
|
|
455
|
+
|
|
456
|
+
if (edgeShape === 'curve') {
|
|
457
|
+
if (node.parentNode && node.parentNode !== virtualRoot) {
|
|
458
|
+
if (!edge) {
|
|
459
|
+
edge = symbolEl.__edge = new graphic.BezierCurve({
|
|
460
|
+
shape: getEdgeShape(seriesScope, sourceOldLayout, sourceOldLayout),
|
|
461
|
+
style: zrUtil.defaults({
|
|
462
|
+
opacity: 0,
|
|
463
|
+
strokeNoScale: true
|
|
464
|
+
}, seriesScope.lineStyle)
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
graphic.updateProps(edge, {
|
|
469
|
+
shape: getEdgeShape(seriesScope, sourceLayout, targetLayout),
|
|
470
|
+
style: {
|
|
471
|
+
opacity: 1
|
|
472
|
+
}
|
|
473
|
+
}, seriesModel);
|
|
401
474
|
}
|
|
475
|
+
} else if (edgeShape === 'polyline') {
|
|
476
|
+
if (seriesScope.layout === 'orthogonal') {
|
|
477
|
+
if (node !== virtualRoot && node.children && node.children.length !== 0 && node.isExpand === true) {
|
|
478
|
+
var children = node.children;
|
|
479
|
+
var childPoints = [];
|
|
480
|
+
|
|
481
|
+
for (var i = 0; i < children.length; i++) {
|
|
482
|
+
var childLayout = children[i].getLayout();
|
|
483
|
+
childPoints.push([childLayout.x, childLayout.y]);
|
|
484
|
+
}
|
|
402
485
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
486
|
+
if (!edge) {
|
|
487
|
+
edge = symbolEl.__edge = new TreeShape({
|
|
488
|
+
shape: {
|
|
489
|
+
parentPoint: [targetLayout.x, targetLayout.y],
|
|
490
|
+
childPoints: [[targetLayout.x, targetLayout.y]],
|
|
491
|
+
orient: seriesScope.orient,
|
|
492
|
+
forkPosition: seriesScope.edgeForkPosition
|
|
493
|
+
},
|
|
494
|
+
style: zrUtil.defaults({
|
|
495
|
+
opacity: 0,
|
|
496
|
+
strokeNoScale: true
|
|
497
|
+
}, seriesScope.lineStyle)
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
graphic.updateProps(edge, {
|
|
502
|
+
shape: {
|
|
503
|
+
parentPoint: [targetLayout.x, targetLayout.y],
|
|
504
|
+
childPoints: childPoints
|
|
505
|
+
},
|
|
506
|
+
style: {
|
|
507
|
+
opacity: 1
|
|
508
|
+
}
|
|
509
|
+
}, seriesModel);
|
|
407
510
|
}
|
|
408
|
-
}
|
|
409
|
-
group.add(edge);
|
|
511
|
+
} else {}
|
|
410
512
|
}
|
|
513
|
+
|
|
514
|
+
group.add(edge);
|
|
411
515
|
}
|
|
412
516
|
|
|
413
517
|
function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope) {
|
|
@@ -416,6 +520,7 @@ function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope)
|
|
|
416
520
|
var itemModel = node.getModel();
|
|
417
521
|
var seriesScope = getTreeNodeStyle(node, itemModel, seriesScope);
|
|
418
522
|
var source = node.parentNode === virtualRoot ? node : node.parentNode || node;
|
|
523
|
+
var edgeShape = seriesScope.edgeShape;
|
|
419
524
|
var sourceLayout;
|
|
420
525
|
|
|
421
526
|
while (sourceLayout = source.getLayout(), sourceLayout == null) {
|
|
@@ -431,17 +536,38 @@ function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope)
|
|
|
431
536
|
symbolEl.fadeOut(null, {
|
|
432
537
|
keepLabel: true
|
|
433
538
|
});
|
|
434
|
-
var
|
|
539
|
+
var sourceSymbolEl = data.getItemGraphicEl(source.dataIndex);
|
|
540
|
+
var sourceEdge = sourceSymbolEl.__edge; // 1. when expand the sub tree, delete the children node should delete the edge of
|
|
541
|
+
// the source at the same time. because the polyline edge shape is only owned by the source.
|
|
542
|
+
// 2.when the node is the only children of the source, delete the node should delete the edge of
|
|
543
|
+
// the source at the same time. the same reason as above.
|
|
544
|
+
|
|
545
|
+
var edge = symbolEl.__edge || (source.isExpand === false || source.children.length === 1 ? sourceEdge : undefined);
|
|
546
|
+
var edgeShape = seriesScope.edgeShape;
|
|
435
547
|
|
|
436
548
|
if (edge) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
549
|
+
if (edgeShape === 'curve') {
|
|
550
|
+
graphic.updateProps(edge, {
|
|
551
|
+
shape: getEdgeShape(seriesScope, sourceLayout, sourceLayout),
|
|
552
|
+
style: {
|
|
553
|
+
opacity: 0
|
|
554
|
+
}
|
|
555
|
+
}, seriesModel, function () {
|
|
556
|
+
group.remove(edge);
|
|
557
|
+
});
|
|
558
|
+
} else if (edgeShape === 'polyline' && seriesScope.layout === 'orthogonal') {
|
|
559
|
+
graphic.updateProps(edge, {
|
|
560
|
+
shape: {
|
|
561
|
+
parentPoint: [sourceLayout.x, sourceLayout.y],
|
|
562
|
+
childPoints: [[sourceLayout.x, sourceLayout.y]]
|
|
563
|
+
},
|
|
564
|
+
style: {
|
|
565
|
+
opacity: 0
|
|
566
|
+
}
|
|
567
|
+
}, seriesModel, function () {
|
|
568
|
+
group.remove(edge);
|
|
569
|
+
});
|
|
570
|
+
}
|
|
445
571
|
}
|
|
446
572
|
}
|
|
447
573
|
|
|
@@ -673,6 +673,10 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
673
673
|
|
|
674
674
|
|
|
675
675
|
var thisLayout = thisNode.getLayout();
|
|
676
|
+
var data = seriesModel.getData(); // Only for enabling highlight/downplay. Clear firstly.
|
|
677
|
+
// Because some node will not be rendered.
|
|
678
|
+
|
|
679
|
+
data.setItemGraphicEl(thisNode.dataIndex, null);
|
|
676
680
|
|
|
677
681
|
if (!thisLayout || !thisLayout.isInView) {
|
|
678
682
|
return;
|
|
@@ -706,15 +710,37 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
706
710
|
|
|
707
711
|
if (thisLayout.isAboveViewRoot) {
|
|
708
712
|
return group;
|
|
709
|
-
}
|
|
713
|
+
}
|
|
710
714
|
|
|
715
|
+
var nodeModel = thisNode.getModel(); // Background
|
|
711
716
|
|
|
712
717
|
var bg = giveGraphic('background', Rect, depth, Z_BG);
|
|
713
718
|
bg && renderBackground(group, bg, isParent && thisLayout.upperHeight); // No children, render content.
|
|
714
719
|
|
|
715
|
-
if (
|
|
720
|
+
if (isParent) {
|
|
721
|
+
// Because of the implementation about "traverse" in graphic hover style, we
|
|
722
|
+
// can not set hover listener on the "group" of non-leaf node. Otherwise the
|
|
723
|
+
// hover event from the descendents will be listenered.
|
|
724
|
+
if (graphic.isHighDownDispatcher(group)) {
|
|
725
|
+
graphic.setAsHighDownDispatcher(group, false);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
if (bg) {
|
|
729
|
+
graphic.setAsHighDownDispatcher(bg, true); // Only for enabling highlight/downplay.
|
|
730
|
+
|
|
731
|
+
data.setItemGraphicEl(thisNode.dataIndex, bg);
|
|
732
|
+
}
|
|
733
|
+
} else {
|
|
716
734
|
var content = giveGraphic('content', Rect, depth, Z_CONTENT);
|
|
717
735
|
content && renderContent(group, content);
|
|
736
|
+
|
|
737
|
+
if (bg && graphic.isHighDownDispatcher(bg)) {
|
|
738
|
+
graphic.setAsHighDownDispatcher(bg, false);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
graphic.setAsHighDownDispatcher(group, true); // Only for enabling highlight/downplay.
|
|
742
|
+
|
|
743
|
+
data.setItemGraphicEl(thisNode.dataIndex, group);
|
|
718
744
|
}
|
|
719
745
|
|
|
720
746
|
return group; // ----------------------------
|
|
@@ -731,9 +757,16 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
731
757
|
width: thisWidth,
|
|
732
758
|
height: thisHeight
|
|
733
759
|
});
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
760
|
+
|
|
761
|
+
if (thisInvisible) {
|
|
762
|
+
// If invisible, do not set visual, otherwise the element will
|
|
763
|
+
// change immediately before animation. We think it is OK to
|
|
764
|
+
// remain its origin color when moving out of the view window.
|
|
765
|
+
processInvisible(bg);
|
|
766
|
+
} else {
|
|
767
|
+
bg.invisible = false;
|
|
768
|
+
var visualBorderColor = thisNode.getVisual('borderColor', true);
|
|
769
|
+
var emphasisBorderColor = itemStyleEmphasisModel.get('borderColor');
|
|
737
770
|
var normalStyle = getItemStyleNormal(itemStyleNormalModel);
|
|
738
771
|
normalStyle.fill = visualBorderColor;
|
|
739
772
|
var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
|
|
@@ -753,8 +786,9 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
753
786
|
}
|
|
754
787
|
|
|
755
788
|
bg.setStyle(normalStyle);
|
|
756
|
-
graphic.
|
|
757
|
-
}
|
|
789
|
+
graphic.setElementHoverStyle(bg, emphasisStyle);
|
|
790
|
+
}
|
|
791
|
+
|
|
758
792
|
group.add(bg);
|
|
759
793
|
}
|
|
760
794
|
|
|
@@ -771,37 +805,33 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
771
805
|
width: contentWidth,
|
|
772
806
|
height: contentHeight
|
|
773
807
|
});
|
|
774
|
-
|
|
775
|
-
|
|
808
|
+
|
|
809
|
+
if (thisInvisible) {
|
|
810
|
+
// If invisible, do not set visual, otherwise the element will
|
|
811
|
+
// change immediately before animation. We think it is OK to
|
|
812
|
+
// remain its origin color when moving out of the view window.
|
|
813
|
+
processInvisible(content);
|
|
814
|
+
} else {
|
|
815
|
+
content.invisible = false;
|
|
816
|
+
var visualColor = thisNode.getVisual('color', true);
|
|
776
817
|
var normalStyle = getItemStyleNormal(itemStyleNormalModel);
|
|
777
818
|
normalStyle.fill = visualColor;
|
|
778
819
|
var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
|
|
779
820
|
prepareText(normalStyle, emphasisStyle, visualColor, contentWidth, contentHeight);
|
|
780
821
|
content.setStyle(normalStyle);
|
|
781
|
-
graphic.
|
|
782
|
-
}
|
|
822
|
+
graphic.setElementHoverStyle(content, emphasisStyle);
|
|
823
|
+
}
|
|
824
|
+
|
|
783
825
|
group.add(content);
|
|
784
826
|
}
|
|
785
827
|
|
|
786
|
-
function
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
// remain its origin color when moving out of the view window.
|
|
791
|
-
cb();
|
|
792
|
-
|
|
793
|
-
if (!element.__tmWillVisible) {
|
|
794
|
-
element.invisible = false;
|
|
795
|
-
}
|
|
796
|
-
} else {
|
|
797
|
-
// Delay invisible setting utill animation finished,
|
|
798
|
-
// avoid element vanish suddenly before animation.
|
|
799
|
-
!element.invisible && willInvisibleEls.push(element);
|
|
800
|
-
}
|
|
828
|
+
function processInvisible(element) {
|
|
829
|
+
// Delay invisible setting utill animation finished,
|
|
830
|
+
// avoid element vanish suddenly before animation.
|
|
831
|
+
!element.invisible && willInvisibleEls.push(element);
|
|
801
832
|
}
|
|
802
833
|
|
|
803
834
|
function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
|
|
804
|
-
var nodeModel = thisNode.getModel();
|
|
805
835
|
var text = zrUtil.retrieve(seriesModel.getFormattedLabel(thisNode.dataIndex, 'normal', null, null, upperLabelRect ? 'upperLabel' : 'label'), nodeModel.get('name'));
|
|
806
836
|
|
|
807
837
|
if (!upperLabelRect && thisLayout.isLeafRoot) {
|
|
@@ -28,6 +28,11 @@ var AxisView = require("./AxisView");
|
|
|
28
28
|
|
|
29
29
|
var cartesianAxisHelper = require("../../coord/cartesian/cartesianAxisHelper");
|
|
30
30
|
|
|
31
|
+
var _axisSplitHelper = require("./axisSplitHelper");
|
|
32
|
+
|
|
33
|
+
var rectCoordAxisBuildSplitArea = _axisSplitHelper.rectCoordAxisBuildSplitArea;
|
|
34
|
+
var rectCoordAxisHandleRemove = _axisSplitHelper.rectCoordAxisHandleRemove;
|
|
35
|
+
|
|
31
36
|
/*
|
|
32
37
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
33
38
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -81,7 +86,7 @@ var CartesianAxisView = AxisView.extend({
|
|
|
81
86
|
CartesianAxisView.superCall(this, 'render', axisModel, ecModel, api, payload);
|
|
82
87
|
},
|
|
83
88
|
remove: function () {
|
|
84
|
-
this
|
|
89
|
+
rectCoordAxisHandleRemove(this);
|
|
85
90
|
},
|
|
86
91
|
|
|
87
92
|
/**
|
|
@@ -204,89 +209,7 @@ var CartesianAxisView = AxisView.extend({
|
|
|
204
209
|
* @private
|
|
205
210
|
*/
|
|
206
211
|
_splitArea: function (axisModel, gridModel) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (axis.scale.isBlank()) {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
var splitAreaModel = axisModel.getModel('splitArea');
|
|
214
|
-
var areaStyleModel = splitAreaModel.getModel('areaStyle');
|
|
215
|
-
var areaColors = areaStyleModel.get('color');
|
|
216
|
-
var gridRect = gridModel.coordinateSystem.getRect();
|
|
217
|
-
var ticksCoords = axis.getTicksCoords({
|
|
218
|
-
tickModel: splitAreaModel,
|
|
219
|
-
clamp: true
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
if (!ticksCoords.length) {
|
|
223
|
-
return;
|
|
224
|
-
} // For Making appropriate splitArea animation, the color and anid
|
|
225
|
-
// should be corresponding to previous one if possible.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
var areaColorsLen = areaColors.length;
|
|
229
|
-
var lastSplitAreaColors = this._splitAreaColors;
|
|
230
|
-
var newSplitAreaColors = zrUtil.createHashMap();
|
|
231
|
-
var colorIndex = 0;
|
|
232
|
-
|
|
233
|
-
if (lastSplitAreaColors) {
|
|
234
|
-
for (var i = 0; i < ticksCoords.length; i++) {
|
|
235
|
-
var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
|
|
236
|
-
|
|
237
|
-
if (cIndex != null) {
|
|
238
|
-
colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
var prev = axis.toGlobalCoord(ticksCoords[0].coord);
|
|
245
|
-
var areaStyle = areaStyleModel.getAreaStyle();
|
|
246
|
-
areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors];
|
|
247
|
-
|
|
248
|
-
for (var i = 1; i < ticksCoords.length; i++) {
|
|
249
|
-
var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
|
|
250
|
-
var x;
|
|
251
|
-
var y;
|
|
252
|
-
var width;
|
|
253
|
-
var height;
|
|
254
|
-
|
|
255
|
-
if (axis.isHorizontal()) {
|
|
256
|
-
x = prev;
|
|
257
|
-
y = gridRect.y;
|
|
258
|
-
width = tickCoord - x;
|
|
259
|
-
height = gridRect.height;
|
|
260
|
-
prev = x + width;
|
|
261
|
-
} else {
|
|
262
|
-
x = gridRect.x;
|
|
263
|
-
y = prev;
|
|
264
|
-
width = gridRect.width;
|
|
265
|
-
height = tickCoord - y;
|
|
266
|
-
prev = y + height;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
var tickValue = ticksCoords[i - 1].tickValue;
|
|
270
|
-
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
|
|
271
|
-
|
|
272
|
-
this._axisGroup.add(new graphic.Rect({
|
|
273
|
-
anid: tickValue != null ? 'area_' + tickValue : null,
|
|
274
|
-
shape: {
|
|
275
|
-
x: x,
|
|
276
|
-
y: y,
|
|
277
|
-
width: width,
|
|
278
|
-
height: height
|
|
279
|
-
},
|
|
280
|
-
style: zrUtil.defaults({
|
|
281
|
-
fill: areaColors[colorIndex]
|
|
282
|
-
}, areaStyle),
|
|
283
|
-
silent: true
|
|
284
|
-
}));
|
|
285
|
-
|
|
286
|
-
colorIndex = (colorIndex + 1) % areaColorsLen;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
this._splitAreaColors = newSplitAreaColors;
|
|
212
|
+
rectCoordAxisBuildSplitArea(this, this._axisGroup, axisModel, gridModel);
|
|
290
213
|
}
|
|
291
214
|
});
|
|
292
215
|
CartesianAxisView.extend({
|