echarts 4.5.0-rc.2 → 4.8.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 +2808 -1188
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +3559 -1437
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +2453 -1002
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +2782 -1188
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +3533 -1437
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +2427 -1002
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/bmap.js +336 -2
- package/dist/extension/bmap.js.map +1 -1
- package/dist/extension/bmap.min.js +1 -1
- package/extension/bmap/BMapView.js +6 -2
- package/extension-src/bmap/BMapView.js +3 -2
- package/lib/chart/bar/BarSeries.js +14 -1
- package/lib/chart/bar/BarView.js +161 -16
- package/lib/chart/bar/BaseBarSeries.js +3 -1
- package/lib/chart/candlestick/candlestickVisual.js +1 -1
- package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
- package/lib/chart/funnel/FunnelSeries.js +13 -5
- package/lib/chart/gauge/GaugeSeries.js +0 -2
- package/lib/chart/graph/GraphSeries.js +11 -5
- package/lib/chart/graph/GraphView.js +30 -12
- package/lib/chart/heatmap/HeatmapView.js +4 -4
- package/lib/chart/helper/EffectLine.js +23 -1
- package/lib/chart/helper/EffectSymbol.js +2 -1
- package/lib/chart/helper/Line.js +94 -33
- package/lib/chart/helper/LineDraw.js +5 -1
- package/lib/chart/helper/Symbol.js +1 -2
- package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
- package/lib/chart/helper/createListFromArray.js +14 -8
- package/lib/chart/helper/createRenderPlanner.js +6 -3
- package/lib/chart/helper/whiskerBoxCommon.js +22 -16
- package/lib/chart/line/LineSeries.js +3 -1
- package/lib/chart/line/LineView.js +41 -2
- package/lib/chart/map/MapSeries.js +11 -3
- package/lib/chart/pie/PieSeries.js +27 -6
- package/lib/chart/pie/PieView.js +22 -15
- package/lib/chart/pie/labelLayout.js +102 -19
- package/lib/chart/pie/pieLayout.js +19 -7
- package/lib/chart/radar/RadarSeries.js +23 -3
- package/lib/chart/sankey/SankeySeries.js +13 -1
- package/lib/chart/sankey/SankeyView.js +70 -32
- package/lib/chart/sankey/sankeyLayout.js +22 -3
- package/lib/chart/scatter/ScatterSeries.js +3 -1
- package/lib/chart/sunburst/SunburstPiece.js +1 -0
- package/lib/chart/sunburst/SunburstSeries.js +12 -7
- package/lib/chart/sunburst/SunburstView.js +5 -1
- package/lib/chart/themeRiver/ThemeRiverSeries.js +3 -3
- package/lib/chart/tree/TreeSeries.js +20 -3
- package/lib/chart/tree/TreeView.js +151 -25
- package/lib/chart/treemap/TreemapSeries.js +15 -3
- package/lib/chart/treemap/TreemapView.js +80 -38
- package/lib/component/axis/AngleAxisView.js +64 -7
- package/lib/component/axis/AxisBuilder.js +62 -24
- package/lib/component/axis/CartesianAxisView.js +52 -85
- package/lib/component/axis/RadiusAxisView.js +36 -4
- 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/dataZoom/SliderZoomView.js +4 -10
- package/lib/component/helper/BrushController.js +33 -43
- package/lib/component/helper/MapDraw.js +30 -4
- package/lib/component/legend/LegendModel.js +3 -3
- package/lib/component/legend/LegendView.js +17 -13
- 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/title.js +6 -2
- package/lib/component/toolbox/ToolboxView.js +5 -1
- package/lib/component/toolbox/feature/MagicType.js +20 -14
- package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
- package/lib/component/tooltip/TooltipContent.js +60 -23
- package/lib/component/tooltip/TooltipView.js +7 -8
- package/lib/component/visualMap/PiecewiseModel.js +3 -6
- package/lib/coord/Axis.js +30 -2
- package/lib/coord/View.js +9 -0
- package/lib/coord/axisDefault.js +21 -2
- package/lib/coord/axisHelper.js +22 -16
- package/lib/coord/calendar/Calendar.js +8 -4
- package/lib/coord/geo/geoJSONLoader.js +3 -2
- package/lib/coord/geo/geoSourceManager.js +3 -2
- package/lib/coord/geo/parseGeoJson.js +3 -2
- package/lib/coord/radar/Radar.js +5 -5
- package/lib/data/DataDimensionInfo.js +157 -0
- package/lib/data/List.js +25 -19
- package/lib/data/Tree.js +9 -19
- package/lib/data/helper/completeDimensions.js +43 -32
- package/lib/data/helper/createDimensions.js +2 -0
- package/lib/data/helper/sourceHelper.js +214 -114
- package/lib/echarts.js +57 -34
- package/lib/langEN.js +26 -0
- package/lib/layout/barGrid.js +19 -13
- package/lib/layout/barPolar.js +0 -5
- package/lib/loading/default.js +43 -27
- package/lib/model/Series.js +4 -4
- package/lib/model/referHelper.js +40 -12
- package/lib/scale/Interval.js +87 -2
- package/lib/scale/Log.js +9 -2
- package/lib/scale/helper.js +1 -43
- package/lib/stream/Scheduler.js +9 -1
- package/lib/theme/dark.js +3 -0
- package/lib/util/format.js +19 -2
- package/lib/util/graphic.js +14 -12
- package/lib/visual/LegendVisualProvider.js +75 -0
- package/lib/visual/dataColor.js +2 -12
- package/lib/visual/seriesColor.js +15 -7
- package/lib/visual/symbol.js +12 -2
- package/map/js/china.js +1 -1
- package/map/js/province/chongqing.js +1 -1
- package/map/js/province/gansu.js +2 -2
- package/map/js/province/tianjin.js +1 -28
- package/map/json/china.json +1 -1
- package/map/json/province/chongqing.json +1 -1
- package/map/json/province/tianjin.json +1 -1
- package/package.json +11 -6
- package/src/chart/bar/BarSeries.js +15 -1
- package/src/chart/bar/BarView.js +162 -15
- package/src/chart/bar/BaseBarSeries.js +1 -1
- package/src/chart/candlestick/candlestickVisual.js +1 -1
- package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
- package/src/chart/funnel/FunnelSeries.js +10 -4
- package/src/chart/gauge/GaugeSeries.js +0 -1
- package/src/chart/graph/GraphSeries.js +10 -4
- package/src/chart/graph/GraphView.js +28 -10
- package/src/chart/heatmap/HeatmapView.js +4 -4
- package/src/chart/helper/EffectLine.js +23 -1
- package/src/chart/helper/EffectSymbol.js +2 -1
- package/src/chart/helper/Line.js +84 -26
- package/src/chart/helper/LineDraw.js +5 -1
- package/src/chart/helper/Symbol.js +2 -2
- package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
- package/src/chart/helper/createListFromArray.js +13 -8
- package/src/chart/helper/createRenderPlanner.js +5 -2
- package/src/chart/helper/whiskerBoxCommon.js +21 -16
- package/src/chart/line/LineSeries.js +1 -1
- package/src/chart/line/LineView.js +45 -1
- package/src/chart/map/MapSeries.js +8 -3
- package/src/chart/pie/PieSeries.js +26 -5
- package/src/chart/pie/PieView.js +20 -15
- package/src/chart/pie/labelLayout.js +114 -22
- package/src/chart/pie/pieLayout.js +20 -7
- package/src/chart/radar/RadarSeries.js +27 -3
- package/src/chart/sankey/SankeySeries.js +12 -1
- package/src/chart/sankey/SankeyView.js +75 -30
- package/src/chart/sankey/sankeyLayout.js +25 -5
- package/src/chart/scatter/ScatterSeries.js +1 -1
- package/src/chart/sunburst/SunburstPiece.js +2 -0
- package/src/chart/sunburst/SunburstSeries.js +12 -7
- package/src/chart/sunburst/SunburstView.js +2 -1
- package/src/chart/themeRiver/ThemeRiverSeries.js +4 -3
- package/src/chart/tree/TreeSeries.js +19 -6
- package/src/chart/tree/TreeView.js +155 -22
- package/src/chart/treemap/TreemapSeries.js +15 -5
- package/src/chart/treemap/TreemapView.js +77 -41
- package/src/component/axis/AngleAxisView.js +75 -7
- package/src/component/axis/AxisBuilder.js +77 -32
- package/src/component/axis/CartesianAxisView.js +47 -83
- package/src/component/axis/RadiusAxisView.js +37 -4
- 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/dataZoom/SliderZoomView.js +4 -9
- package/src/component/helper/BrushController.js +40 -47
- package/src/component/helper/MapDraw.js +27 -4
- package/src/component/legend/LegendModel.js +3 -3
- package/src/component/legend/LegendView.js +18 -12
- 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/title.js +3 -2
- package/src/component/toolbox/ToolboxView.js +5 -0
- package/src/component/toolbox/feature/MagicType.js +19 -13
- package/src/component/toolbox/feature/SaveAsImage.js +2 -1
- package/src/component/tooltip/TooltipContent.js +59 -22
- package/src/component/tooltip/TooltipView.js +10 -8
- package/src/component/visualMap/PiecewiseModel.js +5 -9
- package/src/coord/Axis.js +29 -2
- package/src/coord/View.js +10 -1
- package/src/coord/axisDefault.js +25 -1
- package/src/coord/axisHelper.js +26 -19
- package/src/coord/calendar/Calendar.js +12 -5
- package/src/coord/geo/geoJSONLoader.js +3 -2
- package/src/coord/geo/geoSourceManager.js +3 -2
- package/src/coord/geo/parseGeoJson.js +3 -2
- package/src/coord/radar/Radar.js +6 -8
- package/src/data/DataDimensionInfo.js +135 -0
- package/src/data/List.js +29 -16
- package/src/data/Tree.js +12 -17
- package/src/data/helper/completeDimensions.js +49 -30
- package/src/data/helper/createDimensions.js +2 -0
- package/src/data/helper/sourceHelper.js +216 -124
- package/src/echarts.js +60 -36
- package/src/langEN.js +26 -0
- package/src/layout/barGrid.js +22 -10
- package/src/layout/barPolar.js +0 -4
- package/src/loading/default.js +46 -34
- package/src/model/Series.js +4 -4
- package/src/model/referHelper.js +34 -11
- package/src/scale/Interval.js +84 -4
- package/src/scale/Log.js +9 -2
- package/src/scale/helper.js +1 -39
- package/src/stream/Scheduler.js +8 -0
- package/src/theme/dark.js +3 -0
- package/src/util/format.js +17 -1
- package/src/util/graphic.js +13 -11
- package/src/visual/LegendVisualProvider.js +55 -0
- package/src/visual/dataColor.js +0 -13
- package/src/visual/seriesColor.js +13 -7
- package/src/visual/symbol.js +11 -2
- package/theme/azul.js +163 -0
- package/theme/bee-inspired.js +178 -0
- package/theme/blue.js +178 -0
- package/theme/caravan.js +178 -0
- package/theme/carp.js +163 -0
- package/theme/cool.js +180 -0
- package/theme/dark-blue.js +168 -0
- package/theme/dark-bold.js +168 -0
- package/theme/dark-digerati.js +168 -0
- package/theme/dark-fresh-cut.js +168 -0
- package/theme/dark-mushroom.js +168 -0
- package/theme/dark.js +69 -62
- package/theme/eduardo.js +178 -0
- package/theme/forest.js +163 -0
- package/theme/fresh-cut.js +163 -0
- package/theme/fruit.js +178 -0
- package/theme/gray.js +220 -0
- package/theme/green.js +222 -0
- package/theme/helianthus.js +263 -0
- package/theme/infographic.js +72 -57
- package/theme/inspired.js +163 -0
- package/theme/jazz.js +163 -0
- package/theme/london.js +163 -0
- package/theme/macarons.js +80 -57
- package/theme/macarons2.js +251 -0
- package/theme/mint.js +155 -0
- package/theme/red-velvet.js +163 -0
- package/theme/red.js +225 -0
- package/theme/roma.js +55 -22
- package/theme/royal.js +163 -0
- package/theme/sakura.js +140 -0
- package/theme/shine.js +52 -45
- package/theme/tech-blue.js +180 -0
- package/theme/vintage.js +37 -23
|
@@ -149,6 +149,7 @@ SunburstPieceProto.updateData = function (firstCreate, node, state, seriesModel,
|
|
|
149
149
|
|
|
150
150
|
this._seriesModel = seriesModel || this._seriesModel;
|
|
151
151
|
this._ecModel = ecModel || this._ecModel;
|
|
152
|
+
graphic.setHoverStyle(this);
|
|
152
153
|
};
|
|
153
154
|
|
|
154
155
|
SunburstPieceProto.onEmphasis = function (highlightPolicy) {
|
|
@@ -113,8 +113,7 @@ var _default = SeriesModel.extend({
|
|
|
113
113
|
align: 'center',
|
|
114
114
|
position: 'inside',
|
|
115
115
|
distance: 5,
|
|
116
|
-
silent: true
|
|
117
|
-
emphasis: {}
|
|
116
|
+
silent: true
|
|
118
117
|
},
|
|
119
118
|
itemStyle: {
|
|
120
119
|
borderWidth: 1,
|
|
@@ -124,13 +123,19 @@ var _default = SeriesModel.extend({
|
|
|
124
123
|
shadowColor: 'rgba(0, 0, 0, 0.2)',
|
|
125
124
|
shadowOffsetX: 0,
|
|
126
125
|
shadowOffsetY: 0,
|
|
127
|
-
opacity: 1
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
opacity: 1
|
|
127
|
+
},
|
|
128
|
+
highlight: {
|
|
129
|
+
itemStyle: {
|
|
130
130
|
opacity: 1
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
downplay: {
|
|
134
|
+
itemStyle: {
|
|
135
|
+
opacity: 0.5
|
|
131
136
|
},
|
|
132
|
-
|
|
133
|
-
opacity: 0.
|
|
137
|
+
label: {
|
|
138
|
+
opacity: 0.6
|
|
134
139
|
}
|
|
135
140
|
},
|
|
136
141
|
// Animation type canbe expansion, scale
|
|
@@ -26,6 +26,10 @@ var SunburstPiece = require("./SunburstPiece");
|
|
|
26
26
|
|
|
27
27
|
var DataDiffer = require("../../data/DataDiffer");
|
|
28
28
|
|
|
29
|
+
var _format = require("../../util/format");
|
|
30
|
+
|
|
31
|
+
var windowOpen = _format.windowOpen;
|
|
32
|
+
|
|
29
33
|
/*
|
|
30
34
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
31
35
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -193,7 +197,7 @@ var SunburstView = ChartView.extend({
|
|
|
193
197
|
|
|
194
198
|
if (link) {
|
|
195
199
|
var linkTarget = itemModel.get('target', true) || '_blank';
|
|
196
|
-
|
|
200
|
+
windowOpen(link, linkTarget);
|
|
197
201
|
}
|
|
198
202
|
}
|
|
199
203
|
|
|
@@ -38,6 +38,8 @@ var _format = require("../../util/format");
|
|
|
38
38
|
|
|
39
39
|
var encodeHTML = _format.encodeHTML;
|
|
40
40
|
|
|
41
|
+
var LegendVisualProvider = require("../../visual/LegendVisualProvider");
|
|
42
|
+
|
|
41
43
|
/*
|
|
42
44
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
43
45
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -76,9 +78,7 @@ var ThemeRiverSeries = SeriesModel.extend({
|
|
|
76
78
|
// Enable legend selection for each data item
|
|
77
79
|
// Use a function instead of direct access because data reference may changed
|
|
78
80
|
|
|
79
|
-
this.
|
|
80
|
-
return this.getRawData();
|
|
81
|
-
};
|
|
81
|
+
this.legendVisualProvider = new LegendVisualProvider(zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this));
|
|
82
82
|
},
|
|
83
83
|
|
|
84
84
|
/**
|
|
@@ -26,6 +26,8 @@ var _format = require("../../util/format");
|
|
|
26
26
|
|
|
27
27
|
var encodeHTML = _format.encodeHTML;
|
|
28
28
|
|
|
29
|
+
var Model = require("../../model/Model");
|
|
30
|
+
|
|
29
31
|
/*
|
|
30
32
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
31
33
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -63,9 +65,21 @@ var _default = SeriesModel.extend({
|
|
|
63
65
|
children: option.data
|
|
64
66
|
};
|
|
65
67
|
var leaves = option.leaves || {};
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
var leavesModel = new Model(leaves, this, this.ecModel);
|
|
69
|
+
var tree = Tree.createTree(root, this, {}, beforeLink);
|
|
70
|
+
|
|
71
|
+
function beforeLink(nodeData) {
|
|
72
|
+
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
73
|
+
var node = tree.getNodeByDataIndex(idx);
|
|
74
|
+
|
|
75
|
+
if (!node.children.length || !node.isExpand) {
|
|
76
|
+
model.parentModel = leavesModel;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return model;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
var treeDepth = 0;
|
|
70
84
|
tree.eachNode('preorder', function (node) {
|
|
71
85
|
if (node.depth > treeDepth) {
|
|
@@ -133,6 +147,9 @@ var _default = SeriesModel.extend({
|
|
|
133
147
|
bottom: '12%',
|
|
134
148
|
// the layout of the tree, two value can be selected, 'orthogonal' or 'radial'
|
|
135
149
|
layout: 'orthogonal',
|
|
150
|
+
// value can be 'polyline'
|
|
151
|
+
edgeShape: 'curve',
|
|
152
|
+
edgeForkPosition: '50%',
|
|
136
153
|
// true | false | 'move' | 'scale', see module:component/helper/RoamController.
|
|
137
154
|
roam: false,
|
|
138
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
|
|
|
@@ -228,12 +228,24 @@ var _default = SeriesModel.extend({
|
|
|
228
228
|
completeTreeValue(root);
|
|
229
229
|
var levels = option.levels || [];
|
|
230
230
|
levels = option.levels = setDefault(levels, ecModel);
|
|
231
|
-
var
|
|
232
|
-
|
|
231
|
+
var levelModels = zrUtil.map(levels || [], function (levelDefine) {
|
|
232
|
+
return new Model(levelDefine, this, ecModel);
|
|
233
|
+
}, this); // Make sure always a new tree is created when setOption,
|
|
233
234
|
// in TreemapView, we check whether oldTree === newTree
|
|
234
235
|
// to choose mappings approach among old shapes and new shapes.
|
|
235
236
|
|
|
236
|
-
|
|
237
|
+
var tree = Tree.createTree(root, this, null, beforeLink);
|
|
238
|
+
|
|
239
|
+
function beforeLink(nodeData) {
|
|
240
|
+
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
241
|
+
var node = tree.getNodeByDataIndex(idx);
|
|
242
|
+
var levelModel = levelModels[node.depth];
|
|
243
|
+
levelModel && (model.parentModel = levelModel);
|
|
244
|
+
return model;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return tree.data;
|
|
237
249
|
},
|
|
238
250
|
optionUpdated: function () {
|
|
239
251
|
this.resetViewRoot();
|
|
@@ -40,6 +40,10 @@ var animationUtil = require("../../util/animation");
|
|
|
40
40
|
|
|
41
41
|
var makeStyleMapper = require("../../model/mixin/makeStyleMapper");
|
|
42
42
|
|
|
43
|
+
var _format = require("../../util/format");
|
|
44
|
+
|
|
45
|
+
var windowOpen = _format.windowOpen;
|
|
46
|
+
|
|
43
47
|
/*
|
|
44
48
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
45
49
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -529,7 +533,7 @@ var _default = echarts.extendChartView({
|
|
|
529
533
|
var itemModel = node.hostTree.data.getItemModel(node.dataIndex);
|
|
530
534
|
var link = itemModel.get('link', true);
|
|
531
535
|
var linkTarget = itemModel.get('target', true) || 'blank';
|
|
532
|
-
link &&
|
|
536
|
+
link && windowOpen(link, linkTarget);
|
|
533
537
|
}
|
|
534
538
|
}
|
|
535
539
|
}, this);
|
|
@@ -673,6 +677,10 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
673
677
|
|
|
674
678
|
|
|
675
679
|
var thisLayout = thisNode.getLayout();
|
|
680
|
+
var data = seriesModel.getData(); // Only for enabling highlight/downplay. Clear firstly.
|
|
681
|
+
// Because some node will not be rendered.
|
|
682
|
+
|
|
683
|
+
data.setItemGraphicEl(thisNode.dataIndex, null);
|
|
676
684
|
|
|
677
685
|
if (!thisLayout || !thisLayout.isInView) {
|
|
678
686
|
return;
|
|
@@ -706,15 +714,37 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
706
714
|
|
|
707
715
|
if (thisLayout.isAboveViewRoot) {
|
|
708
716
|
return group;
|
|
709
|
-
}
|
|
717
|
+
}
|
|
710
718
|
|
|
719
|
+
var nodeModel = thisNode.getModel(); // Background
|
|
711
720
|
|
|
712
721
|
var bg = giveGraphic('background', Rect, depth, Z_BG);
|
|
713
|
-
bg && renderBackground(group, bg, isParent && thisLayout.
|
|
722
|
+
bg && renderBackground(group, bg, isParent && thisLayout.upperLabelHeight); // No children, render content.
|
|
723
|
+
|
|
724
|
+
if (isParent) {
|
|
725
|
+
// Because of the implementation about "traverse" in graphic hover style, we
|
|
726
|
+
// can not set hover listener on the "group" of non-leaf node. Otherwise the
|
|
727
|
+
// hover event from the descendents will be listenered.
|
|
728
|
+
if (graphic.isHighDownDispatcher(group)) {
|
|
729
|
+
graphic.setAsHighDownDispatcher(group, false);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
if (bg) {
|
|
733
|
+
graphic.setAsHighDownDispatcher(bg, true); // Only for enabling highlight/downplay.
|
|
714
734
|
|
|
715
|
-
|
|
735
|
+
data.setItemGraphicEl(thisNode.dataIndex, bg);
|
|
736
|
+
}
|
|
737
|
+
} else {
|
|
716
738
|
var content = giveGraphic('content', Rect, depth, Z_CONTENT);
|
|
717
739
|
content && renderContent(group, content);
|
|
740
|
+
|
|
741
|
+
if (bg && graphic.isHighDownDispatcher(bg)) {
|
|
742
|
+
graphic.setAsHighDownDispatcher(bg, false);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
graphic.setAsHighDownDispatcher(group, true); // Only for enabling highlight/downplay.
|
|
746
|
+
|
|
747
|
+
data.setItemGraphicEl(thisNode.dataIndex, group);
|
|
718
748
|
}
|
|
719
749
|
|
|
720
750
|
return group; // ----------------------------
|
|
@@ -731,9 +761,16 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
731
761
|
width: thisWidth,
|
|
732
762
|
height: thisHeight
|
|
733
763
|
});
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
764
|
+
|
|
765
|
+
if (thisInvisible) {
|
|
766
|
+
// If invisible, do not set visual, otherwise the element will
|
|
767
|
+
// change immediately before animation. We think it is OK to
|
|
768
|
+
// remain its origin color when moving out of the view window.
|
|
769
|
+
processInvisible(bg);
|
|
770
|
+
} else {
|
|
771
|
+
bg.invisible = false;
|
|
772
|
+
var visualBorderColor = thisNode.getVisual('borderColor', true);
|
|
773
|
+
var emphasisBorderColor = itemStyleEmphasisModel.get('borderColor');
|
|
737
774
|
var normalStyle = getItemStyleNormal(itemStyleNormalModel);
|
|
738
775
|
normalStyle.fill = visualBorderColor;
|
|
739
776
|
var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
|
|
@@ -753,8 +790,9 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
753
790
|
}
|
|
754
791
|
|
|
755
792
|
bg.setStyle(normalStyle);
|
|
756
|
-
graphic.
|
|
757
|
-
}
|
|
793
|
+
graphic.setElementHoverStyle(bg, emphasisStyle);
|
|
794
|
+
}
|
|
795
|
+
|
|
758
796
|
group.add(bg);
|
|
759
797
|
}
|
|
760
798
|
|
|
@@ -771,52 +809,47 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
771
809
|
width: contentWidth,
|
|
772
810
|
height: contentHeight
|
|
773
811
|
});
|
|
774
|
-
|
|
775
|
-
|
|
812
|
+
|
|
813
|
+
if (thisInvisible) {
|
|
814
|
+
// If invisible, do not set visual, otherwise the element will
|
|
815
|
+
// change immediately before animation. We think it is OK to
|
|
816
|
+
// remain its origin color when moving out of the view window.
|
|
817
|
+
processInvisible(content);
|
|
818
|
+
} else {
|
|
819
|
+
content.invisible = false;
|
|
820
|
+
var visualColor = thisNode.getVisual('color', true);
|
|
776
821
|
var normalStyle = getItemStyleNormal(itemStyleNormalModel);
|
|
777
822
|
normalStyle.fill = visualColor;
|
|
778
823
|
var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
|
|
779
824
|
prepareText(normalStyle, emphasisStyle, visualColor, contentWidth, contentHeight);
|
|
780
825
|
content.setStyle(normalStyle);
|
|
781
|
-
graphic.
|
|
782
|
-
}
|
|
826
|
+
graphic.setElementHoverStyle(content, emphasisStyle);
|
|
827
|
+
}
|
|
828
|
+
|
|
783
829
|
group.add(content);
|
|
784
830
|
}
|
|
785
831
|
|
|
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
|
-
}
|
|
832
|
+
function processInvisible(element) {
|
|
833
|
+
// Delay invisible setting utill animation finished,
|
|
834
|
+
// avoid element vanish suddenly before animation.
|
|
835
|
+
!element.invisible && willInvisibleEls.push(element);
|
|
801
836
|
}
|
|
802
837
|
|
|
803
838
|
function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
|
|
804
|
-
var
|
|
805
|
-
var text = zrUtil.retrieve(seriesModel.getFormattedLabel(thisNode.dataIndex, 'normal', null, null, upperLabelRect ? 'upperLabel' : 'label'), nodeModel.get('name'));
|
|
806
|
-
|
|
807
|
-
if (!upperLabelRect && thisLayout.isLeafRoot) {
|
|
808
|
-
var iconChar = seriesModel.get('drillDownIcon', true);
|
|
809
|
-
text = iconChar ? iconChar + ' ' + text : text;
|
|
810
|
-
}
|
|
811
|
-
|
|
839
|
+
var defaultText = nodeModel.get('name');
|
|
812
840
|
var normalLabelModel = nodeModel.getModel(upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL);
|
|
813
841
|
var emphasisLabelModel = nodeModel.getModel(upperLabelRect ? PATH_UPPERLABEL_EMPHASIS : PATH_LABEL_EMPHASIS);
|
|
814
842
|
var isShow = normalLabelModel.getShallow('show');
|
|
815
843
|
graphic.setLabelStyle(normalStyle, emphasisStyle, normalLabelModel, emphasisLabelModel, {
|
|
816
|
-
defaultText: isShow ?
|
|
844
|
+
defaultText: isShow ? defaultText : null,
|
|
817
845
|
autoColor: visualColor,
|
|
818
|
-
isRectText: true
|
|
846
|
+
isRectText: true,
|
|
847
|
+
labelFetcher: seriesModel,
|
|
848
|
+
labelDataIndex: thisNode.dataIndex,
|
|
849
|
+
labelProp: upperLabelRect ? 'upperLabel' : 'label'
|
|
819
850
|
});
|
|
851
|
+
addDrillDownIcon(normalStyle, upperLabelRect, thisLayout);
|
|
852
|
+
addDrillDownIcon(emphasisStyle, upperLabelRect, thisLayout);
|
|
820
853
|
upperLabelRect && (normalStyle.textRect = zrUtil.clone(upperLabelRect));
|
|
821
854
|
normalStyle.truncate = isShow && normalLabelModel.get('ellipsis') ? {
|
|
822
855
|
outerWidth: width,
|
|
@@ -825,6 +858,15 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
825
858
|
} : null;
|
|
826
859
|
}
|
|
827
860
|
|
|
861
|
+
function addDrillDownIcon(style, upperLabelRect, thisLayout) {
|
|
862
|
+
var text = style.text;
|
|
863
|
+
|
|
864
|
+
if (!upperLabelRect && thisLayout.isLeafRoot && text != null) {
|
|
865
|
+
var iconChar = seriesModel.get('drillDownIcon', true);
|
|
866
|
+
style.text = iconChar ? iconChar + ' ' + text : text;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
828
870
|
function giveGraphic(storageName, Ctor, depth, z) {
|
|
829
871
|
var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex];
|
|
830
872
|
var lasts = lastsForAnimation[storageName];
|