echarts 4.8.0 → 4.9.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/.DS_Store +0 -0
- package/.gitattributes +3 -0
- package/.github/workflows/nodejs.yml +3 -1
- package/.huskyrc +5 -0
- package/README.md +1 -1
- package/asset/.DS_Store +0 -0
- package/build/.DS_Store +0 -0
- package/dist/echarts-en.common.js +284 -93
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +816 -284
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +60 -26
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +284 -93
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +816 -284
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +60 -26
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/bmap.js +33 -345
- package/dist/extension/bmap.js.map +1 -1
- package/dist/extension/bmap.min.js +1 -1
- package/dist/extension/dataTool.js.map +1 -1
- package/extension/.DS_Store +0 -0
- package/extension/bmap/BMapCoordSys.js +14 -4
- package/extension/bmap/BMapModel.js +4 -0
- package/extension/bmap/BMapView.js +18 -14
- package/extension-src/bmap/BMapCoordSys.js +14 -4
- package/extension-src/bmap/BMapModel.js +6 -1
- package/extension-src/bmap/BMapView.js +16 -10
- package/lib/chart/bar/BarView.js +49 -16
- package/lib/chart/bar/PictorialBarSeries.js +1 -1
- package/lib/chart/funnel/FunnelSeries.js +1 -0
- package/lib/chart/funnel/funnelLayout.js +162 -46
- package/lib/chart/graph/GraphSeries.js +12 -2
- package/lib/chart/graph/circularLayoutHelper.js +8 -2
- package/lib/chart/graph/forceLayout.js +6 -1
- package/lib/chart/graph/simpleLayout.js +1 -1
- package/lib/chart/graph/simpleLayoutHelper.js +10 -4
- package/lib/chart/helper/Line.js +35 -9
- package/lib/chart/helper/Symbol.js +1 -1
- package/lib/chart/helper/multipleGraphEdgeHelper.js +258 -0
- package/lib/chart/lines/LinesSeries.js +0 -2
- package/lib/chart/map/MapSeries.js +3 -2
- package/lib/chart/radar/RadarSeries.js +4 -3
- package/lib/chart/radar/RadarView.js +3 -1
- package/lib/chart/sunburst/SunburstPiece.js +4 -1
- package/lib/chart/sunburst/SunburstSeries.js +17 -5
- package/lib/chart/themeRiver/ThemeRiverSeries.js +21 -30
- package/lib/chart/tree/TreeSeries.js +1 -1
- package/lib/chart/tree/TreeView.js +4 -4
- package/lib/chart/treemap/TreemapSeries.js +14 -5
- package/lib/chart/treemap/treemapLayout.js +1 -1
- package/lib/chart/treemap/treemapVisual.js +9 -15
- package/lib/component/axisPointer/axisTrigger.js +1 -1
- package/lib/component/legend/ScrollableLegendView.js +1 -1
- package/lib/component/marker/MarkAreaView.js +53 -15
- package/lib/component/marker/MarkLineView.js +3 -0
- package/lib/component/marker/MarkPointView.js +8 -1
- package/lib/component/marker/MarkerModel.js +3 -2
- package/lib/component/timeline/SliderTimelineView.js +7 -1
- package/lib/component/title.js +1 -1
- package/lib/component/toolbox/feature/DataView.js +23 -8
- package/lib/component/toolbox/feature/DataZoom.js +6 -6
- package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
- package/lib/component/tooltip/TooltipContent.js +42 -8
- package/lib/component/tooltip/TooltipRichContent.js +56 -8
- package/lib/component/tooltip/TooltipView.js +4 -4
- package/lib/component/visualMap/VisualMapModel.js +1 -1
- package/lib/coord/axisDefault.js +1 -1
- package/lib/coord/axisHelper.js +2 -2
- package/lib/coord/geo/GeoModel.js +2 -1
- package/lib/data/Graph.js +1 -6
- package/lib/data/List.js +1 -1
- package/lib/data/Tree.js +4 -31
- package/lib/echarts.js +2 -2
- package/lib/layout/barPolar.js +1 -1
- package/lib/processor/dataSample.js +1 -1
- package/lib/stream/Scheduler.js +1 -1
- package/lib/visual/VisualMapping.js +1 -1
- package/map/.DS_Store +0 -0
- package/map/js/.DS_Store +0 -0
- package/map/js/province/.DS_Store +0 -0
- package/map/json/.DS_Store +0 -0
- package/package.json +3 -2
- package/src/.DS_Store +0 -0
- package/src/chart/.DS_Store +0 -0
- package/src/chart/bar/BarView.js +50 -16
- package/src/chart/bar/PictorialBarSeries.js +2 -2
- package/src/chart/funnel/FunnelSeries.js +1 -0
- package/src/chart/funnel/funnelLayout.js +179 -53
- package/src/chart/graph/GraphSeries.js +9 -3
- package/src/chart/graph/circularLayoutHelper.js +8 -2
- package/src/chart/graph/forceLayout.js +7 -1
- package/src/chart/graph/simpleLayout.js +1 -1
- package/src/chart/graph/simpleLayoutHelper.js +12 -5
- package/src/chart/helper/Line.js +38 -11
- package/src/chart/helper/Symbol.js +2 -2
- package/src/chart/helper/createGraphFromNodeEdge.js +2 -1
- package/src/chart/helper/multipleGraphEdgeHelper.js +229 -0
- package/src/chart/lines/LinesSeries.js +1 -3
- package/src/chart/map/MapSeries.js +3 -2
- package/src/chart/radar/RadarSeries.js +4 -3
- package/src/chart/radar/RadarView.js +4 -2
- package/src/chart/sunburst/SunburstPiece.js +5 -1
- package/src/chart/sunburst/SunburstSeries.js +16 -8
- package/src/chart/themeRiver/ThemeRiverSeries.js +21 -27
- package/src/chart/tree/TreeSeries.js +1 -1
- package/src/chart/tree/TreeView.js +3 -3
- package/src/chart/treemap/TreemapSeries.js +11 -3
- package/src/chart/treemap/treemapLayout.js +2 -2
- package/src/chart/treemap/treemapVisual.js +8 -25
- package/src/component/axisPointer/axisTrigger.js +1 -1
- package/src/component/legend/ScrollableLegendView.js +1 -1
- package/src/component/marker/MarkAreaView.js +53 -15
- package/src/component/marker/MarkLineView.js +3 -1
- package/src/component/marker/MarkPointView.js +7 -1
- package/src/component/marker/MarkerModel.js +3 -2
- package/src/component/timeline/SliderTimelineView.js +9 -6
- package/src/component/title.js +2 -2
- package/src/component/toolbox/.DS_Store +0 -0
- package/src/component/toolbox/feature/DataView.js +20 -8
- package/src/component/toolbox/feature/DataZoom.js +6 -6
- package/src/component/toolbox/feature/SaveAsImage.js +2 -1
- package/src/component/tooltip/TooltipContent.js +36 -7
- package/src/component/tooltip/TooltipRichContent.js +52 -9
- package/src/component/tooltip/TooltipView.js +4 -4
- package/src/component/visualMap/VisualMapModel.js +1 -1
- package/src/coord/axisDefault.js +1 -1
- package/src/coord/axisHelper.js +4 -2
- package/src/coord/geo/GeoModel.js +3 -6
- package/src/data/Graph.js +0 -5
- package/src/data/List.js +1 -1
- package/src/data/Tree.js +4 -32
- package/src/echarts.js +2 -2
- package/src/layout/barPolar.js +4 -2
- package/src/model/.DS_Store +0 -0
- package/src/preprocessor/.DS_Store +0 -0
- package/src/processor/dataSample.js +1 -1
- package/src/stream/Scheduler.js +1 -1
- package/src/util/.DS_Store +0 -0
- package/src/visual/VisualMapping.js +1 -1
- package/theme/.DS_Store +0 -0
package/lib/data/Tree.js
CHANGED
|
@@ -20,8 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
var zrUtil = require("zrender/lib/core/util");
|
|
22
22
|
|
|
23
|
-
var Model = require("../model/Model");
|
|
24
|
-
|
|
25
23
|
var linkList = require("./helper/linkList");
|
|
26
24
|
|
|
27
25
|
var List = require("./List");
|
|
@@ -281,20 +279,7 @@ TreeNode.prototype = {
|
|
|
281
279
|
|
|
282
280
|
var hostTree = this.hostTree;
|
|
283
281
|
var itemModel = hostTree.data.getItemModel(this.dataIndex);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (levelModel) {
|
|
287
|
-
return itemModel.getModel(path, levelModel.getModel(path));
|
|
288
|
-
} else {
|
|
289
|
-
return itemModel.getModel(path);
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* @return {module:echarts/model/Model}
|
|
295
|
-
*/
|
|
296
|
-
getLevelModel: function () {
|
|
297
|
-
return (this.hostTree.levelModels || [])[this.depth];
|
|
282
|
+
return itemModel.getModel(path);
|
|
298
283
|
},
|
|
299
284
|
|
|
300
285
|
/**
|
|
@@ -367,10 +352,9 @@ TreeNode.prototype = {
|
|
|
367
352
|
* @constructor
|
|
368
353
|
* @alias module:echarts/data/Tree
|
|
369
354
|
* @param {module:echarts/model/Model} hostModel
|
|
370
|
-
* @param {Array.<Object>} levelOptions
|
|
371
355
|
*/
|
|
372
356
|
|
|
373
|
-
function Tree(hostModel
|
|
357
|
+
function Tree(hostModel) {
|
|
374
358
|
/**
|
|
375
359
|
* @type {module:echarts/data/Tree~TreeNode}
|
|
376
360
|
* @readOnly
|
|
@@ -396,15 +380,6 @@ function Tree(hostModel, levelOptions) {
|
|
|
396
380
|
*/
|
|
397
381
|
|
|
398
382
|
this.hostModel = hostModel;
|
|
399
|
-
/**
|
|
400
|
-
* @private
|
|
401
|
-
* @readOnly
|
|
402
|
-
* @type {Array.<module:echarts/model/Model}
|
|
403
|
-
*/
|
|
404
|
-
|
|
405
|
-
this.levelModels = zrUtil.map(levelOptions || [], function (levelDefine) {
|
|
406
|
-
return new Model(levelDefine, hostModel, hostModel.ecModel);
|
|
407
|
-
});
|
|
408
383
|
}
|
|
409
384
|
|
|
410
385
|
Tree.prototype = {
|
|
@@ -491,13 +466,11 @@ Tree.prototype = {
|
|
|
491
466
|
* @static
|
|
492
467
|
* @param {Object} dataRoot Root node.
|
|
493
468
|
* @param {module:echarts/model/Model} hostModel
|
|
494
|
-
* @param {Object} treeOptions
|
|
495
|
-
* @param {Array.<Object>} treeOptions.levels
|
|
496
469
|
* @return module:echarts/data/Tree
|
|
497
470
|
*/
|
|
498
471
|
|
|
499
|
-
Tree.createTree = function (dataRoot, hostModel,
|
|
500
|
-
var tree = new Tree(hostModel
|
|
472
|
+
Tree.createTree = function (dataRoot, hostModel, beforeLink) {
|
|
473
|
+
var tree = new Tree(hostModel);
|
|
501
474
|
var listData = [];
|
|
502
475
|
var dimMax = 1;
|
|
503
476
|
buildHierarchy(dataRoot);
|
package/lib/echarts.js
CHANGED
|
@@ -101,9 +101,9 @@ var each = zrUtil.each;
|
|
|
101
101
|
var isFunction = zrUtil.isFunction;
|
|
102
102
|
var isObject = zrUtil.isObject;
|
|
103
103
|
var parseClassType = ComponentModel.parseClassType;
|
|
104
|
-
var version = '4.
|
|
104
|
+
var version = '4.9.0';
|
|
105
105
|
var dependencies = {
|
|
106
|
-
zrender: '4.3.
|
|
106
|
+
zrender: '4.3.2'
|
|
107
107
|
};
|
|
108
108
|
var TEST_FRAME_REMAIN_TIME = 1;
|
|
109
109
|
var PRIORITY_PROCESSOR_FILTER = 1000;
|
package/lib/layout/barPolar.js
CHANGED
|
@@ -91,7 +91,7 @@ function barLayoutPolar(seriesType, ecModel, api) {
|
|
|
91
91
|
/*, baseDim*/
|
|
92
92
|
);
|
|
93
93
|
var clampLayout = baseAxis.dim !== 'radius' || !seriesModel.get('roundCap', true);
|
|
94
|
-
var valueAxisStart = valueAxis.
|
|
94
|
+
var valueAxisStart = valueAxis.dim === 'radius' ? valueAxis.dataToRadius(0) : valueAxis.dataToAngle(0);
|
|
95
95
|
|
|
96
96
|
for (var idx = 0, len = data.count(); idx < len; idx++) {
|
|
97
97
|
var value = data.get(valueDim, idx);
|
|
@@ -106,7 +106,7 @@ function _default(seriesType) {
|
|
|
106
106
|
var valueAxis = coordSys.getOtherAxis(baseAxis);
|
|
107
107
|
var extent = baseAxis.getExtent(); // Coordinste system has been resized
|
|
108
108
|
|
|
109
|
-
var size = extent[1] - extent[0];
|
|
109
|
+
var size = Math.abs(extent[1] - extent[0]);
|
|
110
110
|
var rate = Math.round(data.count() / size);
|
|
111
111
|
|
|
112
112
|
if (rate > 1) {
|
package/lib/stream/Scheduler.js
CHANGED
|
@@ -101,7 +101,7 @@ var proto = Scheduler.prototype;
|
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
103
|
proto.restoreData = function (ecModel, payload) {
|
|
104
|
-
// TODO: Only
|
|
104
|
+
// TODO: Only restore needed series and components, but not all components.
|
|
105
105
|
// Currently `restoreData` of all of the series and component will be called.
|
|
106
106
|
// But some independent components like `title`, `legend`, `graphic`, `toolbox`,
|
|
107
107
|
// `tooltip`, `axisPointer`, etc, do not need series refresh when `setOption`,
|
|
@@ -70,7 +70,7 @@ var CATEGORY_DEFAULT_VISUAL_INDEX = -1;
|
|
|
70
70
|
* visual data can be array or object
|
|
71
71
|
* (like: {cate1: '#222', none: '#fff'})
|
|
72
72
|
* or primary types (which represents
|
|
73
|
-
*
|
|
73
|
+
* default category visual), otherwise visual
|
|
74
74
|
* can be array or primary (which will be
|
|
75
75
|
* normalized to array).
|
|
76
76
|
*
|
package/map/.DS_Store
ADDED
|
Binary file
|
package/map/js/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echarts",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "A powerful charting and visualization library for browser",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"lint:dist": "echo 'It might take a while. Please wait ...' && ./node_modules/.bin/jshint --config .jshintrc-dist dist/echarts.js"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"zrender": "4.3.
|
|
30
|
+
"zrender": "4.3.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/core": "7.3.4",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"estraverse": "4.1.1",
|
|
46
46
|
"fs-extra": "0.26.7",
|
|
47
47
|
"glob": "7.0.0",
|
|
48
|
+
"husky": "^4.2.5",
|
|
48
49
|
"jest": "^24.9.0",
|
|
49
50
|
"jest-canvas-mock": "^2.2.0",
|
|
50
51
|
"jsdom": "^15.2.1",
|
package/src/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
package/src/chart/bar/BarView.js
CHANGED
|
@@ -135,20 +135,25 @@ export default echarts.extendChartView({
|
|
|
135
135
|
var bgEls = [];
|
|
136
136
|
var oldBgEls = this._backgroundEls || [];
|
|
137
137
|
|
|
138
|
+
var createBackground = function (dataIndex) {
|
|
139
|
+
var bgLayout = getLayout[coord.type](data, dataIndex);
|
|
140
|
+
var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
|
|
141
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
142
|
+
// Only cartesian2d support borderRadius.
|
|
143
|
+
if (coord.type === 'cartesian2d') {
|
|
144
|
+
bgEl.setShape('r', barBorderRadius);
|
|
145
|
+
}
|
|
146
|
+
bgEls[dataIndex] = bgEl;
|
|
147
|
+
return bgEl;
|
|
148
|
+
};
|
|
149
|
+
|
|
138
150
|
data.diff(oldData)
|
|
139
151
|
.add(function (dataIndex) {
|
|
140
152
|
var itemModel = data.getItemModel(dataIndex);
|
|
141
153
|
var layout = getLayout[coord.type](data, dataIndex, itemModel);
|
|
142
154
|
|
|
143
155
|
if (drawBackground) {
|
|
144
|
-
|
|
145
|
-
var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
|
|
146
|
-
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
147
|
-
// Only cartesian2d support borderRadius.
|
|
148
|
-
if (coord.type === 'cartesian2d') {
|
|
149
|
-
bgEl.setShape('r', barBorderRadius);
|
|
150
|
-
}
|
|
151
|
-
bgEls[dataIndex] = bgEl;
|
|
156
|
+
createBackground(dataIndex);
|
|
152
157
|
}
|
|
153
158
|
|
|
154
159
|
// If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
|
|
@@ -182,13 +187,19 @@ export default echarts.extendChartView({
|
|
|
182
187
|
var layout = getLayout[coord.type](data, newIndex, itemModel);
|
|
183
188
|
|
|
184
189
|
if (drawBackground) {
|
|
185
|
-
var bgEl
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
var bgEl;
|
|
191
|
+
if (oldBgEls.length === 0) {
|
|
192
|
+
bgEl = createBackground(oldIndex);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
bgEl = oldBgEls[oldIndex];
|
|
196
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
197
|
+
// Only cartesian2d support borderRadius.
|
|
198
|
+
if (coord.type === 'cartesian2d') {
|
|
199
|
+
bgEl.setShape('r', barBorderRadius);
|
|
200
|
+
}
|
|
201
|
+
bgEls[newIndex] = bgEl;
|
|
190
202
|
}
|
|
191
|
-
bgEls[newIndex] = bgEl;
|
|
192
203
|
|
|
193
204
|
var bgLayout = getLayout[coord.type](data, newIndex);
|
|
194
205
|
var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
|
|
@@ -348,8 +359,31 @@ var clip = {
|
|
|
348
359
|
return clipped;
|
|
349
360
|
},
|
|
350
361
|
|
|
351
|
-
polar: function (coordSysClipArea) {
|
|
352
|
-
|
|
362
|
+
polar: function (coordSysClipArea, layout) {
|
|
363
|
+
var signR = layout.r0 <= layout.r ? 1 : -1;
|
|
364
|
+
// Make sure r is larger than r0
|
|
365
|
+
if (signR < 0) {
|
|
366
|
+
var r = layout.r;
|
|
367
|
+
layout.r = layout.r0;
|
|
368
|
+
layout.r0 = r;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
var r = mathMin(layout.r, coordSysClipArea.r);
|
|
372
|
+
var r0 = mathMax(layout.r0, coordSysClipArea.r0);
|
|
373
|
+
|
|
374
|
+
layout.r = r;
|
|
375
|
+
layout.r0 = r0;
|
|
376
|
+
|
|
377
|
+
var clipped = r - r0 < 0;
|
|
378
|
+
|
|
379
|
+
// Reverse back
|
|
380
|
+
if (signR < 0) {
|
|
381
|
+
var r = layout.r;
|
|
382
|
+
layout.r = layout.r0;
|
|
383
|
+
layout.r0 = r;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return clipped;
|
|
353
387
|
}
|
|
354
388
|
};
|
|
355
389
|
|
|
@@ -33,7 +33,7 @@ var PictorialBarSeries = BaseBarSeries.extend({
|
|
|
33
33
|
symbolPosition: null, // 'start' or 'end' or 'center', null means auto.
|
|
34
34
|
symbolOffset: null,
|
|
35
35
|
symbolMargin: null, // start margin and end margin. Can be a number or a percent string.
|
|
36
|
-
// Auto margin by
|
|
36
|
+
// Auto margin by default.
|
|
37
37
|
symbolRepeat: false, // false/null/undefined, means no repeat.
|
|
38
38
|
// Can be true, means auto calculate repeat times and cut by data.
|
|
39
39
|
// Can be a number, specifies repeat times, and do not cut by data.
|
|
@@ -60,4 +60,4 @@ var PictorialBarSeries = BaseBarSeries.extend({
|
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
export default PictorialBarSeries;
|
|
63
|
+
export default PictorialBarSeries;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
import {__DEV__} from '../../config';
|
|
20
21
|
import * as layout from '../../util/layout';
|
|
21
22
|
import {parsePercent, linearMap} from '../../util/number';
|
|
22
23
|
|
|
@@ -57,6 +58,7 @@ function labelLayout(data) {
|
|
|
57
58
|
var itemModel = data.getItemModel(idx);
|
|
58
59
|
var labelModel = itemModel.getModel('label');
|
|
59
60
|
var labelPosition = labelModel.get('position');
|
|
61
|
+
var orient = itemModel.get('orient');
|
|
60
62
|
|
|
61
63
|
var labelLineModel = itemModel.getModel('labelLine');
|
|
62
64
|
|
|
@@ -96,7 +98,18 @@ function labelLayout(data) {
|
|
|
96
98
|
var x1;
|
|
97
99
|
var y1;
|
|
98
100
|
var x2;
|
|
101
|
+
var y2;
|
|
99
102
|
var labelLineLen = labelLineModel.get('length');
|
|
103
|
+
if (__DEV__) {
|
|
104
|
+
if (orient === 'vertical' && ['top', 'bottom'].indexOf(labelPosition) > -1) {
|
|
105
|
+
labelPosition = 'left';
|
|
106
|
+
console.warn('Position error: Funnel chart on vertical orient dose not support top and bottom.');
|
|
107
|
+
}
|
|
108
|
+
if (orient === 'horizontal' && ['left', 'right'].indexOf(labelPosition) > -1) {
|
|
109
|
+
labelPosition = 'bottom';
|
|
110
|
+
console.warn('Position error: Funnel chart on horizontal orient dose not support left and right.');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
100
113
|
if (labelPosition === 'left') {
|
|
101
114
|
// Left side
|
|
102
115
|
x1 = (points[3][0] + points[0][0]) / 2;
|
|
@@ -113,50 +126,106 @@ function labelLayout(data) {
|
|
|
113
126
|
textX = x2 + 5;
|
|
114
127
|
textAlign = 'left';
|
|
115
128
|
}
|
|
129
|
+
else if (labelPosition === 'top') {
|
|
130
|
+
// Top side
|
|
131
|
+
x1 = (points[3][0] + points[0][0]) / 2;
|
|
132
|
+
y1 = (points[3][1] + points[0][1]) / 2;
|
|
133
|
+
y2 = y1 - labelLineLen;
|
|
134
|
+
textY = y2 - 5;
|
|
135
|
+
textAlign = 'center';
|
|
136
|
+
}
|
|
137
|
+
else if (labelPosition === 'bottom') {
|
|
138
|
+
// Bottom side
|
|
139
|
+
x1 = (points[1][0] + points[2][0]) / 2;
|
|
140
|
+
y1 = (points[1][1] + points[2][1]) / 2;
|
|
141
|
+
y2 = y1 + labelLineLen;
|
|
142
|
+
textY = y2 + 5;
|
|
143
|
+
textAlign = 'center';
|
|
144
|
+
}
|
|
116
145
|
else if (labelPosition === 'rightTop') {
|
|
117
146
|
// RightTop side
|
|
118
|
-
x1 = points[1][0];
|
|
119
|
-
y1 = points[1][1];
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
147
|
+
x1 = orient === 'horizontal' ? points[3][0] : points[1][0];
|
|
148
|
+
y1 = orient === 'horizontal' ? points[3][1] : points[1][1];
|
|
149
|
+
if (orient === 'horizontal') {
|
|
150
|
+
y2 = y1 - labelLineLen;
|
|
151
|
+
textY = y2 - 5;
|
|
152
|
+
textAlign = 'center';
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
x2 = x1 + labelLineLen;
|
|
156
|
+
textX = x2 + 5;
|
|
157
|
+
textAlign = 'top';
|
|
158
|
+
}
|
|
123
159
|
}
|
|
124
160
|
else if (labelPosition === 'rightBottom') {
|
|
125
161
|
// RightBottom side
|
|
126
162
|
x1 = points[2][0];
|
|
127
163
|
y1 = points[2][1];
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
164
|
+
if (orient === 'horizontal') {
|
|
165
|
+
y2 = y1 + labelLineLen;
|
|
166
|
+
textY = y2 + 5;
|
|
167
|
+
textAlign = 'center';
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
x2 = x1 + labelLineLen;
|
|
171
|
+
textX = x2 + 5;
|
|
172
|
+
textAlign = 'bottom';
|
|
173
|
+
}
|
|
131
174
|
}
|
|
132
175
|
else if (labelPosition === 'leftTop') {
|
|
133
176
|
// LeftTop side
|
|
134
177
|
x1 = points[0][0];
|
|
135
|
-
y1 = points[1][1];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
178
|
+
y1 = orient === 'horizontal' ? points[0][1] : points[1][1];
|
|
179
|
+
if (orient === 'horizontal') {
|
|
180
|
+
y2 = y1 - labelLineLen;
|
|
181
|
+
textY = y2 - 5;
|
|
182
|
+
textAlign = 'center';
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
x2 = x1 - labelLineLen;
|
|
186
|
+
textX = x2 - 5;
|
|
187
|
+
textAlign = 'right';
|
|
188
|
+
}
|
|
139
189
|
}
|
|
140
190
|
else if (labelPosition === 'leftBottom') {
|
|
141
191
|
// LeftBottom side
|
|
142
|
-
x1 = points[3][0];
|
|
143
|
-
y1 = points[2][1];
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
192
|
+
x1 = orient === 'horizontal' ? points[1][0] : points[3][0];
|
|
193
|
+
y1 = orient === 'horizontal' ? points[1][1] : points[2][1];
|
|
194
|
+
if (orient === 'horizontal') {
|
|
195
|
+
y2 = y1 + labelLineLen;
|
|
196
|
+
textY = y2 + 5;
|
|
197
|
+
textAlign = 'center';
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
x2 = x1 - labelLineLen;
|
|
201
|
+
textX = x2 - 5;
|
|
202
|
+
textAlign = 'right';
|
|
203
|
+
}
|
|
147
204
|
}
|
|
148
205
|
else {
|
|
149
|
-
// Right side
|
|
206
|
+
// Right side or Bottom side
|
|
150
207
|
x1 = (points[1][0] + points[2][0]) / 2;
|
|
151
208
|
y1 = (points[1][1] + points[2][1]) / 2;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
209
|
+
if (orient === 'horizontal') {
|
|
210
|
+
y2 = y1 + labelLineLen;
|
|
211
|
+
textY = y2 + 5;
|
|
212
|
+
textAlign = 'center';
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
x2 = x1 + labelLineLen;
|
|
216
|
+
textX = x2 + 5;
|
|
217
|
+
textAlign = 'left';
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (orient === 'horizontal') {
|
|
221
|
+
x2 = x1;
|
|
222
|
+
textX = x2;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
y2 = y1;
|
|
226
|
+
textY = y2;
|
|
155
227
|
}
|
|
156
|
-
var y2 = y1;
|
|
157
|
-
|
|
158
228
|
linePoints = [[x1, y1], [x2, y2]];
|
|
159
|
-
textY = y2;
|
|
160
229
|
}
|
|
161
230
|
|
|
162
231
|
layout.label = {
|
|
@@ -177,11 +246,19 @@ export default function (ecModel, api, payload) {
|
|
|
177
246
|
var sort = seriesModel.get('sort');
|
|
178
247
|
var viewRect = getViewRect(seriesModel, api);
|
|
179
248
|
var indices = getSortedIndices(data, sort);
|
|
249
|
+
var orient = seriesModel.get('orient');
|
|
250
|
+
var viewWidth = viewRect.width;
|
|
251
|
+
var viewHeight = viewRect.height;
|
|
252
|
+
var x = viewRect.x;
|
|
253
|
+
var y = viewRect.y;
|
|
180
254
|
|
|
181
|
-
var sizeExtent = [
|
|
182
|
-
parsePercent(seriesModel.get('minSize'),
|
|
183
|
-
parsePercent(seriesModel.get('maxSize'),
|
|
184
|
-
]
|
|
255
|
+
var sizeExtent = orient === 'horizontal' ? [
|
|
256
|
+
parsePercent(seriesModel.get('minSize'), viewHeight),
|
|
257
|
+
parsePercent(seriesModel.get('maxSize'), viewHeight)
|
|
258
|
+
] : [
|
|
259
|
+
parsePercent(seriesModel.get('minSize'), viewWidth),
|
|
260
|
+
parsePercent(seriesModel.get('maxSize'), viewWidth)
|
|
261
|
+
];
|
|
185
262
|
var dataExtent = data.getDataExtent(valueDim);
|
|
186
263
|
var min = seriesModel.get('min');
|
|
187
264
|
var max = seriesModel.get('max');
|
|
@@ -194,64 +271,113 @@ export default function (ecModel, api, payload) {
|
|
|
194
271
|
|
|
195
272
|
var funnelAlign = seriesModel.get('funnelAlign');
|
|
196
273
|
var gap = seriesModel.get('gap');
|
|
197
|
-
var
|
|
274
|
+
var viewSize = orient === 'horizontal' ? viewWidth : viewHeight;
|
|
275
|
+
var itemSize = (viewSize - gap * (data.count() - 1)) / data.count();
|
|
198
276
|
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
var getLinePoints = function (idx, offY) {
|
|
277
|
+
var getLinePoints = function (idx, offset) {
|
|
202
278
|
// End point index is data.count() and we assign it 0
|
|
279
|
+
if (orient === 'horizontal') {
|
|
280
|
+
var val = data.get(valueDim, idx) || 0;
|
|
281
|
+
var itemHeight = linearMap(val, [min, max], sizeExtent, true);
|
|
282
|
+
var y0;
|
|
283
|
+
switch (funnelAlign) {
|
|
284
|
+
case 'top':
|
|
285
|
+
y0 = y;
|
|
286
|
+
break;
|
|
287
|
+
case 'center':
|
|
288
|
+
y0 = y + (viewHeight - itemHeight) / 2;
|
|
289
|
+
break;
|
|
290
|
+
case 'bottom':
|
|
291
|
+
y0 = y + (viewHeight - itemHeight);
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return [
|
|
296
|
+
[offset, y0],
|
|
297
|
+
[offset, y0 + itemHeight]
|
|
298
|
+
];
|
|
299
|
+
}
|
|
203
300
|
var val = data.get(valueDim, idx) || 0;
|
|
204
301
|
var itemWidth = linearMap(val, [min, max], sizeExtent, true);
|
|
205
302
|
var x0;
|
|
206
303
|
switch (funnelAlign) {
|
|
207
304
|
case 'left':
|
|
208
|
-
x0 =
|
|
305
|
+
x0 = x;
|
|
209
306
|
break;
|
|
210
307
|
case 'center':
|
|
211
|
-
x0 =
|
|
308
|
+
x0 = x + (viewWidth - itemWidth) / 2;
|
|
212
309
|
break;
|
|
213
310
|
case 'right':
|
|
214
|
-
x0 =
|
|
311
|
+
x0 = x + viewWidth - itemWidth;
|
|
215
312
|
break;
|
|
216
313
|
}
|
|
217
314
|
return [
|
|
218
|
-
[x0,
|
|
219
|
-
[x0 + itemWidth,
|
|
315
|
+
[x0, offset],
|
|
316
|
+
[x0 + itemWidth, offset]
|
|
220
317
|
];
|
|
221
318
|
};
|
|
222
319
|
|
|
223
320
|
if (sort === 'ascending') {
|
|
224
321
|
// From bottom to top
|
|
225
|
-
|
|
322
|
+
itemSize = -itemSize;
|
|
226
323
|
gap = -gap;
|
|
227
|
-
|
|
324
|
+
if (orient === 'horizontal') {
|
|
325
|
+
x += viewWidth;
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
y += viewHeight;
|
|
329
|
+
}
|
|
228
330
|
indices = indices.reverse();
|
|
229
331
|
}
|
|
230
332
|
|
|
231
333
|
for (var i = 0; i < indices.length; i++) {
|
|
232
334
|
var idx = indices[i];
|
|
233
335
|
var nextIdx = indices[i + 1];
|
|
234
|
-
|
|
235
336
|
var itemModel = data.getItemModel(idx);
|
|
236
|
-
|
|
237
|
-
if (
|
|
238
|
-
|
|
337
|
+
|
|
338
|
+
if (orient === 'horizontal') {
|
|
339
|
+
var width = itemModel.get('itemStyle.width');
|
|
340
|
+
if (width == null) {
|
|
341
|
+
width = itemSize;
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
width = parsePercent(width, viewWidth);
|
|
345
|
+
if (sort === 'ascending') {
|
|
346
|
+
width = -width;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
var start = getLinePoints(idx, x);
|
|
351
|
+
var end = getLinePoints(nextIdx, x + width);
|
|
352
|
+
|
|
353
|
+
x += width + gap;
|
|
354
|
+
|
|
355
|
+
data.setItemLayout(idx, {
|
|
356
|
+
points: start.concat(end.slice().reverse())
|
|
357
|
+
});
|
|
239
358
|
}
|
|
240
359
|
else {
|
|
241
|
-
height =
|
|
242
|
-
if (
|
|
243
|
-
height =
|
|
360
|
+
var height = itemModel.get('itemStyle.height');
|
|
361
|
+
if (height == null) {
|
|
362
|
+
height = itemSize;
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
height = parsePercent(height, viewHeight);
|
|
366
|
+
if (sort === 'ascending') {
|
|
367
|
+
height = -height;
|
|
368
|
+
}
|
|
244
369
|
}
|
|
245
|
-
}
|
|
246
370
|
|
|
247
|
-
|
|
248
|
-
|
|
371
|
+
var start = orient === 'horizontal' ? getLinePoints(idx, x) : getLinePoints(idx, y);
|
|
372
|
+
var end = orient === 'horizontal'
|
|
373
|
+
? getLinePoints(nextIdx, x + width) : getLinePoints(nextIdx, y + height);
|
|
249
374
|
|
|
250
|
-
|
|
375
|
+
y += height + gap;
|
|
251
376
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
377
|
+
data.setItemLayout(idx, {
|
|
378
|
+
points: start.concat(end.slice().reverse())
|
|
379
|
+
});
|
|
380
|
+
}
|
|
255
381
|
}
|
|
256
382
|
|
|
257
383
|
labelLayout(data);
|
|
@@ -25,6 +25,7 @@ import Model from '../../model/Model';
|
|
|
25
25
|
import {encodeHTML} from '../../util/format';
|
|
26
26
|
import createGraphFromNodeEdge from '../helper/createGraphFromNodeEdge';
|
|
27
27
|
import LegendVisualProvider from '../../visual/LegendVisualProvider';
|
|
28
|
+
import {initCurvenessList, createEdgeMapForCurveness} from '../helper/multipleGraphEdgeHelper';
|
|
28
29
|
|
|
29
30
|
var GraphSeries = echarts.extendSeriesModel({
|
|
30
31
|
|
|
@@ -66,7 +67,13 @@ var GraphSeries = echarts.extendSeriesModel({
|
|
|
66
67
|
var self = this;
|
|
67
68
|
|
|
68
69
|
if (nodes && edges) {
|
|
69
|
-
|
|
70
|
+
// auto curveness
|
|
71
|
+
initCurvenessList(this);
|
|
72
|
+
var graph = createGraphFromNodeEdge(nodes, edges, this, true, beforeLink);
|
|
73
|
+
zrUtil.each(graph.edges, function (edge) {
|
|
74
|
+
createEdgeMapForCurveness(edge.node1, edge.node2, this, edge.dataIndex);
|
|
75
|
+
}, this);
|
|
76
|
+
return graph.data;
|
|
70
77
|
}
|
|
71
78
|
|
|
72
79
|
function beforeLink(nodeData, edgeData) {
|
|
@@ -278,7 +285,6 @@ var GraphSeries = echarts.extendSeriesModel({
|
|
|
278
285
|
lineStyle: {
|
|
279
286
|
color: '#aaa',
|
|
280
287
|
width: 1,
|
|
281
|
-
curveness: 0,
|
|
282
288
|
opacity: 0.5
|
|
283
289
|
},
|
|
284
290
|
emphasis: {
|
|
@@ -289,4 +295,4 @@ var GraphSeries = echarts.extendSeriesModel({
|
|
|
289
295
|
}
|
|
290
296
|
});
|
|
291
297
|
|
|
292
|
-
export default GraphSeries;
|
|
298
|
+
export default GraphSeries;
|