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/dist/echarts-en.js
CHANGED
|
@@ -11595,7 +11595,7 @@ var instances$1 = {}; // ZRender实例map索引
|
|
|
11595
11595
|
/**
|
|
11596
11596
|
* @type {string}
|
|
11597
11597
|
*/
|
|
11598
|
-
var version$1 = '4.3.
|
|
11598
|
+
var version$1 = '4.3.2';
|
|
11599
11599
|
|
|
11600
11600
|
/**
|
|
11601
11601
|
* Initializing a zrender instance
|
|
@@ -26231,7 +26231,7 @@ var proto = Scheduler.prototype;
|
|
|
26231
26231
|
* @param {Object} payload
|
|
26232
26232
|
*/
|
|
26233
26233
|
proto.restoreData = function (ecModel, payload) {
|
|
26234
|
-
// TODO: Only
|
|
26234
|
+
// TODO: Only restore needed series and components, but not all components.
|
|
26235
26235
|
// Currently `restoreData` of all of the series and component will be called.
|
|
26236
26236
|
// But some independent components like `title`, `legend`, `graphic`, `toolbox`,
|
|
26237
26237
|
// `tooltip`, `axisPointer`, etc, do not need series refresh when `setOption`,
|
|
@@ -27812,10 +27812,10 @@ var isFunction = isFunction$1;
|
|
|
27812
27812
|
var isObject = isObject$1;
|
|
27813
27813
|
var parseClassType = ComponentModel.parseClassType;
|
|
27814
27814
|
|
|
27815
|
-
var version = '4.
|
|
27815
|
+
var version = '4.9.0';
|
|
27816
27816
|
|
|
27817
27817
|
var dependencies = {
|
|
27818
|
-
zrender: '4.3.
|
|
27818
|
+
zrender: '4.3.2'
|
|
27819
27819
|
};
|
|
27820
27820
|
|
|
27821
27821
|
var TEST_FRAME_REMAIN_TIME = 1;
|
|
@@ -31058,7 +31058,7 @@ listProto.mapDimension = function (coordDim, idx) {
|
|
|
31058
31058
|
* Initialize from data
|
|
31059
31059
|
* @param {Array.<Object|number|Array>} data source or data or data provider.
|
|
31060
31060
|
* @param {Array.<string>} [nameLIst] The name of a datum is used on data diff and
|
|
31061
|
-
*
|
|
31061
|
+
* default label/tooltip.
|
|
31062
31062
|
* A name can be specified in encode.itemName,
|
|
31063
31063
|
* or dataItem.name (only for series option data),
|
|
31064
31064
|
* or provided in nameList from outside.
|
|
@@ -35677,8 +35677,8 @@ function rotateTextRect(textRect, rotate) {
|
|
|
35677
35677
|
var boundingBox = textRect.plain();
|
|
35678
35678
|
var beforeWidth = boundingBox.width;
|
|
35679
35679
|
var beforeHeight = boundingBox.height;
|
|
35680
|
-
var afterWidth = beforeWidth * Math.cos(rotateRadians) + beforeHeight * Math.sin(rotateRadians);
|
|
35681
|
-
var afterHeight = beforeWidth * Math.sin(rotateRadians) + beforeHeight * Math.cos(rotateRadians);
|
|
35680
|
+
var afterWidth = beforeWidth * Math.abs(Math.cos(rotateRadians)) + Math.abs(beforeHeight * Math.sin(rotateRadians));
|
|
35681
|
+
var afterHeight = beforeWidth * Math.abs(Math.sin(rotateRadians)) + Math.abs(beforeHeight * Math.cos(rotateRadians));
|
|
35682
35682
|
var rotatedRect = new BoundingRect(boundingBox.x, boundingBox.y, afterWidth, afterHeight);
|
|
35683
35683
|
|
|
35684
35684
|
return rotatedRect;
|
|
@@ -37779,7 +37779,7 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
|
|
|
37779
37779
|
}
|
|
37780
37780
|
else {
|
|
37781
37781
|
symbolPath.setStyle({
|
|
37782
|
-
opacity:
|
|
37782
|
+
opacity: 1,
|
|
37783
37783
|
shadowBlur: null,
|
|
37784
37784
|
shadowOffsetX: null,
|
|
37785
37785
|
shadowOffsetY: null,
|
|
@@ -39964,7 +39964,7 @@ var dataSample = function (seriesType) {
|
|
|
39964
39964
|
var valueAxis = coordSys.getOtherAxis(baseAxis);
|
|
39965
39965
|
var extent = baseAxis.getExtent();
|
|
39966
39966
|
// Coordinste system has been resized
|
|
39967
|
-
var size = extent[1] - extent[0];
|
|
39967
|
+
var size = Math.abs(extent[1] - extent[0]);
|
|
39968
39968
|
var rate = Math.round(data.count() / size);
|
|
39969
39969
|
if (rate > 1) {
|
|
39970
39970
|
var sampler;
|
|
@@ -40420,7 +40420,7 @@ var defaultOption = {
|
|
|
40420
40420
|
name: '',
|
|
40421
40421
|
// 'start' | 'middle' | 'end'
|
|
40422
40422
|
nameLocation: 'end',
|
|
40423
|
-
// By degree. By
|
|
40423
|
+
// By degree. By default auto rotate by nameLocation.
|
|
40424
40424
|
nameRotate: null,
|
|
40425
40425
|
nameTruncate: {
|
|
40426
40426
|
maxWidth: null,
|
|
@@ -43663,20 +43663,25 @@ extendChartView({
|
|
|
43663
43663
|
var bgEls = [];
|
|
43664
43664
|
var oldBgEls = this._backgroundEls || [];
|
|
43665
43665
|
|
|
43666
|
+
var createBackground = function (dataIndex) {
|
|
43667
|
+
var bgLayout = getLayout[coord.type](data, dataIndex);
|
|
43668
|
+
var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
|
|
43669
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
43670
|
+
// Only cartesian2d support borderRadius.
|
|
43671
|
+
if (coord.type === 'cartesian2d') {
|
|
43672
|
+
bgEl.setShape('r', barBorderRadius);
|
|
43673
|
+
}
|
|
43674
|
+
bgEls[dataIndex] = bgEl;
|
|
43675
|
+
return bgEl;
|
|
43676
|
+
};
|
|
43677
|
+
|
|
43666
43678
|
data.diff(oldData)
|
|
43667
43679
|
.add(function (dataIndex) {
|
|
43668
43680
|
var itemModel = data.getItemModel(dataIndex);
|
|
43669
43681
|
var layout = getLayout[coord.type](data, dataIndex, itemModel);
|
|
43670
43682
|
|
|
43671
43683
|
if (drawBackground) {
|
|
43672
|
-
|
|
43673
|
-
var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
|
|
43674
|
-
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
43675
|
-
// Only cartesian2d support borderRadius.
|
|
43676
|
-
if (coord.type === 'cartesian2d') {
|
|
43677
|
-
bgEl.setShape('r', barBorderRadius);
|
|
43678
|
-
}
|
|
43679
|
-
bgEls[dataIndex] = bgEl;
|
|
43684
|
+
createBackground(dataIndex);
|
|
43680
43685
|
}
|
|
43681
43686
|
|
|
43682
43687
|
// If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
|
|
@@ -43710,13 +43715,19 @@ extendChartView({
|
|
|
43710
43715
|
var layout = getLayout[coord.type](data, newIndex, itemModel);
|
|
43711
43716
|
|
|
43712
43717
|
if (drawBackground) {
|
|
43713
|
-
var bgEl
|
|
43714
|
-
|
|
43715
|
-
|
|
43716
|
-
|
|
43717
|
-
|
|
43718
|
+
var bgEl;
|
|
43719
|
+
if (oldBgEls.length === 0) {
|
|
43720
|
+
bgEl = createBackground(oldIndex);
|
|
43721
|
+
}
|
|
43722
|
+
else {
|
|
43723
|
+
bgEl = oldBgEls[oldIndex];
|
|
43724
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
43725
|
+
// Only cartesian2d support borderRadius.
|
|
43726
|
+
if (coord.type === 'cartesian2d') {
|
|
43727
|
+
bgEl.setShape('r', barBorderRadius);
|
|
43728
|
+
}
|
|
43729
|
+
bgEls[newIndex] = bgEl;
|
|
43718
43730
|
}
|
|
43719
|
-
bgEls[newIndex] = bgEl;
|
|
43720
43731
|
|
|
43721
43732
|
var bgLayout = getLayout[coord.type](data, newIndex);
|
|
43722
43733
|
var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
|
|
@@ -43876,8 +43887,31 @@ var clip = {
|
|
|
43876
43887
|
return clipped;
|
|
43877
43888
|
},
|
|
43878
43889
|
|
|
43879
|
-
polar: function (coordSysClipArea) {
|
|
43880
|
-
|
|
43890
|
+
polar: function (coordSysClipArea, layout) {
|
|
43891
|
+
var signR = layout.r0 <= layout.r ? 1 : -1;
|
|
43892
|
+
// Make sure r is larger than r0
|
|
43893
|
+
if (signR < 0) {
|
|
43894
|
+
var r = layout.r;
|
|
43895
|
+
layout.r = layout.r0;
|
|
43896
|
+
layout.r0 = r;
|
|
43897
|
+
}
|
|
43898
|
+
|
|
43899
|
+
var r = mathMin$4(layout.r, coordSysClipArea.r);
|
|
43900
|
+
var r0 = mathMax$4(layout.r0, coordSysClipArea.r0);
|
|
43901
|
+
|
|
43902
|
+
layout.r = r;
|
|
43903
|
+
layout.r0 = r0;
|
|
43904
|
+
|
|
43905
|
+
var clipped = r - r0 < 0;
|
|
43906
|
+
|
|
43907
|
+
// Reverse back
|
|
43908
|
+
if (signR < 0) {
|
|
43909
|
+
var r = layout.r;
|
|
43910
|
+
layout.r = layout.r0;
|
|
43911
|
+
layout.r0 = r;
|
|
43912
|
+
}
|
|
43913
|
+
|
|
43914
|
+
return clipped;
|
|
43881
43915
|
}
|
|
43882
43916
|
};
|
|
43883
43917
|
|
|
@@ -47113,16 +47147,17 @@ var RadarSeries = SeriesModel.extend({
|
|
|
47113
47147
|
});
|
|
47114
47148
|
},
|
|
47115
47149
|
|
|
47116
|
-
formatTooltip: function (dataIndex) {
|
|
47150
|
+
formatTooltip: function (dataIndex, multipleSeries, dataType, renderMode) {
|
|
47117
47151
|
var data = this.getData();
|
|
47118
47152
|
var coordSys = this.coordinateSystem;
|
|
47119
47153
|
var indicatorAxes = coordSys.getIndicatorAxes();
|
|
47120
47154
|
var name = this.getData().getName(dataIndex);
|
|
47121
|
-
|
|
47155
|
+
var newLine = renderMode === 'html' ? '<br/>' : '\n';
|
|
47156
|
+
return encodeHTML(name === '' ? this.name : name) + newLine
|
|
47122
47157
|
+ map(indicatorAxes, function (axis, idx) {
|
|
47123
47158
|
var val = data.get(data.mapDimension(axis.dim), dataIndex);
|
|
47124
47159
|
return encodeHTML(axis.name + ' : ' + val);
|
|
47125
|
-
}).join(
|
|
47160
|
+
}).join(newLine);
|
|
47126
47161
|
},
|
|
47127
47162
|
|
|
47128
47163
|
/**
|
|
@@ -47218,12 +47253,14 @@ extendChartView({
|
|
|
47218
47253
|
var symbolPath = createSymbol(
|
|
47219
47254
|
symbolType, -1, -1, 2, 2, color
|
|
47220
47255
|
);
|
|
47256
|
+
var symbolRotate = data.getItemVisual(idx, 'symbolRotate') || 0;
|
|
47221
47257
|
symbolPath.attr({
|
|
47222
47258
|
style: {
|
|
47223
47259
|
strokeNoScale: true
|
|
47224
47260
|
},
|
|
47225
47261
|
z2: 100,
|
|
47226
|
-
scale: [symbolSize[0] / 2, symbolSize[1] / 2]
|
|
47262
|
+
scale: [symbolSize[0] / 2, symbolSize[1] / 2],
|
|
47263
|
+
rotation: symbolRotate * Math.PI / 180 || 0
|
|
47227
47264
|
});
|
|
47228
47265
|
return symbolPath;
|
|
47229
47266
|
}
|
|
@@ -48189,7 +48226,7 @@ var MapSeries = SeriesModel.extend({
|
|
|
48189
48226
|
*
|
|
48190
48227
|
* @param {number} dataIndex
|
|
48191
48228
|
*/
|
|
48192
|
-
formatTooltip: function (dataIndex) {
|
|
48229
|
+
formatTooltip: function (dataIndex, multipleSeries, dataType, renderMode) {
|
|
48193
48230
|
// FIXME orignalData and data is a bit confusing
|
|
48194
48231
|
var data = this.getData();
|
|
48195
48232
|
var formattedValue = addCommas(this.getRawValue(dataIndex));
|
|
@@ -48207,7 +48244,8 @@ var MapSeries = SeriesModel.extend({
|
|
|
48207
48244
|
}
|
|
48208
48245
|
}
|
|
48209
48246
|
|
|
48210
|
-
|
|
48247
|
+
var newLine = renderMode === 'html' ? '<br/>' : '\n';
|
|
48248
|
+
return seriesNames.join(', ') + newLine
|
|
48211
48249
|
+ encodeHTML(name + ' : ' + formattedValue);
|
|
48212
48250
|
},
|
|
48213
48251
|
|
|
@@ -50997,22 +51035,7 @@ TreeNode.prototype = {
|
|
|
50997
51035
|
}
|
|
50998
51036
|
var hostTree = this.hostTree;
|
|
50999
51037
|
var itemModel = hostTree.data.getItemModel(this.dataIndex);
|
|
51000
|
-
|
|
51001
|
-
|
|
51002
|
-
// FIXME: refactor levelModel to "beforeLink", and remove levelModel here.
|
|
51003
|
-
if (levelModel) {
|
|
51004
|
-
return itemModel.getModel(path, levelModel.getModel(path));
|
|
51005
|
-
}
|
|
51006
|
-
else {
|
|
51007
|
-
return itemModel.getModel(path);
|
|
51008
|
-
}
|
|
51009
|
-
},
|
|
51010
|
-
|
|
51011
|
-
/**
|
|
51012
|
-
* @return {module:echarts/model/Model}
|
|
51013
|
-
*/
|
|
51014
|
-
getLevelModel: function () {
|
|
51015
|
-
return (this.hostTree.levelModels || [])[this.depth];
|
|
51038
|
+
return itemModel.getModel(path);
|
|
51016
51039
|
},
|
|
51017
51040
|
|
|
51018
51041
|
/**
|
|
@@ -51084,9 +51107,8 @@ TreeNode.prototype = {
|
|
|
51084
51107
|
* @constructor
|
|
51085
51108
|
* @alias module:echarts/data/Tree
|
|
51086
51109
|
* @param {module:echarts/model/Model} hostModel
|
|
51087
|
-
* @param {Array.<Object>} levelOptions
|
|
51088
51110
|
*/
|
|
51089
|
-
function Tree(hostModel
|
|
51111
|
+
function Tree(hostModel) {
|
|
51090
51112
|
/**
|
|
51091
51113
|
* @type {module:echarts/data/Tree~TreeNode}
|
|
51092
51114
|
* @readOnly
|
|
@@ -51113,15 +51135,6 @@ function Tree(hostModel, levelOptions) {
|
|
|
51113
51135
|
*/
|
|
51114
51136
|
this.hostModel = hostModel;
|
|
51115
51137
|
|
|
51116
|
-
/**
|
|
51117
|
-
* @private
|
|
51118
|
-
* @readOnly
|
|
51119
|
-
* @type {Array.<module:echarts/model/Model}
|
|
51120
|
-
*/
|
|
51121
|
-
this.levelModels = map(levelOptions || [], function (levelDefine) {
|
|
51122
|
-
return new Model(levelDefine, hostModel, hostModel.ecModel);
|
|
51123
|
-
});
|
|
51124
|
-
|
|
51125
51138
|
}
|
|
51126
51139
|
|
|
51127
51140
|
Tree.prototype = {
|
|
@@ -51211,13 +51224,11 @@ Tree.prototype = {
|
|
|
51211
51224
|
* @static
|
|
51212
51225
|
* @param {Object} dataRoot Root node.
|
|
51213
51226
|
* @param {module:echarts/model/Model} hostModel
|
|
51214
|
-
* @param {Object} treeOptions
|
|
51215
|
-
* @param {Array.<Object>} treeOptions.levels
|
|
51216
51227
|
* @return module:echarts/data/Tree
|
|
51217
51228
|
*/
|
|
51218
|
-
Tree.createTree = function (dataRoot, hostModel,
|
|
51229
|
+
Tree.createTree = function (dataRoot, hostModel, beforeLink) {
|
|
51219
51230
|
|
|
51220
|
-
var tree = new Tree(hostModel
|
|
51231
|
+
var tree = new Tree(hostModel);
|
|
51221
51232
|
var listData = [];
|
|
51222
51233
|
var dimMax = 1;
|
|
51223
51234
|
|
|
@@ -51325,7 +51336,7 @@ SeriesModel.extend({
|
|
|
51325
51336
|
var leaves = option.leaves || {};
|
|
51326
51337
|
var leavesModel = new Model(leaves, this, this.ecModel);
|
|
51327
51338
|
|
|
51328
|
-
var tree = Tree.createTree(root, this,
|
|
51339
|
+
var tree = Tree.createTree(root, this, beforeLink);
|
|
51329
51340
|
|
|
51330
51341
|
function beforeLink(nodeData) {
|
|
51331
51342
|
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
@@ -52264,7 +52275,7 @@ function drawEdge(
|
|
|
52264
52275
|
|
|
52265
52276
|
updateProps(edge, {
|
|
52266
52277
|
shape: getEdgeShape(seriesScope, sourceLayout, targetLayout),
|
|
52267
|
-
style: {opacity: 1}
|
|
52278
|
+
style: defaults({opacity: 1}, seriesScope.lineStyle)
|
|
52268
52279
|
}, seriesModel);
|
|
52269
52280
|
}
|
|
52270
52281
|
}
|
|
@@ -52294,7 +52305,7 @@ function drawEdge(
|
|
|
52294
52305
|
parentPoint: [targetLayout.x, targetLayout.y],
|
|
52295
52306
|
childPoints: childPoints
|
|
52296
52307
|
},
|
|
52297
|
-
style: {opacity: 1}
|
|
52308
|
+
style: defaults({opacity: 1}, seriesScope.lineStyle)
|
|
52298
52309
|
}, seriesModel);
|
|
52299
52310
|
}
|
|
52300
52311
|
}
|
|
@@ -52943,21 +52954,29 @@ SeriesModel.extend({
|
|
|
52943
52954
|
|
|
52944
52955
|
var levels = option.levels || [];
|
|
52945
52956
|
|
|
52957
|
+
// Used in "visual priority" in `treemapVisual.js`.
|
|
52958
|
+
// This way is a little tricky, must satisfy the precondition:
|
|
52959
|
+
// 1. There is no `treeNode.getModel('itemStyle.xxx')` used.
|
|
52960
|
+
// 2. The `Model.prototype.getModel()` will not use any clone-like way.
|
|
52961
|
+
var designatedVisualItemStyle = this.designatedVisualItemStyle = {};
|
|
52962
|
+
var designatedVisualModel = new Model({itemStyle: designatedVisualItemStyle}, this, ecModel);
|
|
52963
|
+
|
|
52946
52964
|
levels = option.levels = setDefault(levels, ecModel);
|
|
52947
52965
|
var levelModels = map(levels || [], function (levelDefine) {
|
|
52948
|
-
return new Model(levelDefine,
|
|
52966
|
+
return new Model(levelDefine, designatedVisualModel, ecModel);
|
|
52949
52967
|
}, this);
|
|
52950
52968
|
|
|
52951
52969
|
// Make sure always a new tree is created when setOption,
|
|
52952
52970
|
// in TreemapView, we check whether oldTree === newTree
|
|
52953
52971
|
// to choose mappings approach among old shapes and new shapes.
|
|
52954
|
-
var tree = Tree.createTree(root, this,
|
|
52972
|
+
var tree = Tree.createTree(root, this, beforeLink);
|
|
52955
52973
|
|
|
52956
52974
|
function beforeLink(nodeData) {
|
|
52957
52975
|
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
52958
52976
|
var node = tree.getNodeByDataIndex(idx);
|
|
52959
52977
|
var levelModel = levelModels[node.depth];
|
|
52960
|
-
levelModel
|
|
52978
|
+
// If no levelModel, we also need `designatedVisualModel`.
|
|
52979
|
+
model.parentModel = levelModel || designatedVisualModel;
|
|
52961
52980
|
return model;
|
|
52962
52981
|
});
|
|
52963
52982
|
}
|
|
@@ -54506,7 +54525,7 @@ var CATEGORY_DEFAULT_VISUAL_INDEX = -1;
|
|
|
54506
54525
|
* visual data can be array or object
|
|
54507
54526
|
* (like: {cate1: '#222', none: '#fff'})
|
|
54508
54527
|
* or primary types (which represents
|
|
54509
|
-
*
|
|
54528
|
+
* default category visual), otherwise visual
|
|
54510
54529
|
* can be array or primary (which will be
|
|
54511
54530
|
* normalized to array).
|
|
54512
54531
|
*
|
|
@@ -55124,21 +55143,14 @@ var treemapVisual = {
|
|
|
55124
55143
|
reset: function (seriesModel, ecModel, api, payload) {
|
|
55125
55144
|
var tree = seriesModel.getData().tree;
|
|
55126
55145
|
var root = tree.root;
|
|
55127
|
-
var seriesItemStyleModel = seriesModel.getModel(ITEM_STYLE_NORMAL);
|
|
55128
55146
|
|
|
55129
55147
|
if (root.isRemoved()) {
|
|
55130
55148
|
return;
|
|
55131
55149
|
}
|
|
55132
55150
|
|
|
55133
|
-
var levelItemStyles = map(tree.levelModels, function (levelModel) {
|
|
55134
|
-
return levelModel ? levelModel.get(ITEM_STYLE_NORMAL) : null;
|
|
55135
|
-
});
|
|
55136
|
-
|
|
55137
55151
|
travelTree(
|
|
55138
55152
|
root, // Visual should calculate from tree root but not view root.
|
|
55139
55153
|
{},
|
|
55140
|
-
levelItemStyles,
|
|
55141
|
-
seriesItemStyleModel,
|
|
55142
55154
|
seriesModel.getViewRoot().getAncestors(),
|
|
55143
55155
|
seriesModel
|
|
55144
55156
|
);
|
|
@@ -55146,8 +55158,7 @@ var treemapVisual = {
|
|
|
55146
55158
|
};
|
|
55147
55159
|
|
|
55148
55160
|
function travelTree(
|
|
55149
|
-
node, designatedVisual,
|
|
55150
|
-
viewRootAncestors, seriesModel
|
|
55161
|
+
node, designatedVisual, viewRootAncestors, seriesModel
|
|
55151
55162
|
) {
|
|
55152
55163
|
var nodeModel = node.getModel();
|
|
55153
55164
|
var nodeLayout = node.getLayout();
|
|
@@ -55158,10 +55169,7 @@ function travelTree(
|
|
|
55158
55169
|
}
|
|
55159
55170
|
|
|
55160
55171
|
var nodeItemStyleModel = node.getModel(ITEM_STYLE_NORMAL);
|
|
55161
|
-
var
|
|
55162
|
-
var visuals = buildVisuals(
|
|
55163
|
-
nodeItemStyleModel, designatedVisual, levelItemStyle, seriesItemStyleModel
|
|
55164
|
-
);
|
|
55172
|
+
var visuals = buildVisuals(nodeItemStyleModel, designatedVisual, seriesModel);
|
|
55165
55173
|
|
|
55166
55174
|
// calculate border color
|
|
55167
55175
|
var borderColor = nodeItemStyleModel.get('borderColor');
|
|
@@ -55194,27 +55202,21 @@ function travelTree(
|
|
|
55194
55202
|
var childVisual = mapVisual$1(
|
|
55195
55203
|
nodeModel, visuals, child, index, mapping, seriesModel
|
|
55196
55204
|
);
|
|
55197
|
-
travelTree(
|
|
55198
|
-
child, childVisual, levelItemStyles, seriesItemStyleModel,
|
|
55199
|
-
viewRootAncestors, seriesModel
|
|
55200
|
-
);
|
|
55205
|
+
travelTree(child, childVisual, viewRootAncestors, seriesModel);
|
|
55201
55206
|
}
|
|
55202
55207
|
});
|
|
55203
55208
|
}
|
|
55204
55209
|
}
|
|
55205
55210
|
|
|
55206
|
-
function buildVisuals(
|
|
55207
|
-
nodeItemStyleModel, designatedVisual, levelItemStyle, seriesItemStyleModel
|
|
55208
|
-
) {
|
|
55211
|
+
function buildVisuals(nodeItemStyleModel, designatedVisual, seriesModel) {
|
|
55209
55212
|
var visuals = extend({}, designatedVisual);
|
|
55213
|
+
var designatedVisualItemStyle = seriesModel.designatedVisualItemStyle;
|
|
55210
55214
|
|
|
55211
55215
|
each$1(['color', 'colorAlpha', 'colorSaturation'], function (visualName) {
|
|
55212
55216
|
// Priority: thisNode > thisLevel > parentNodeDesignated > seriesModel
|
|
55213
|
-
|
|
55214
|
-
|
|
55215
|
-
|
|
55216
|
-
val == null && (val = seriesItemStyleModel.get(visualName));
|
|
55217
|
-
|
|
55217
|
+
designatedVisualItemStyle[visualName] = designatedVisual[visualName];
|
|
55218
|
+
var val = nodeItemStyleModel.get(visualName);
|
|
55219
|
+
designatedVisualItemStyle[visualName] = null;
|
|
55218
55220
|
val != null && (visuals[visualName] = val);
|
|
55219
55221
|
});
|
|
55220
55222
|
|
|
@@ -55802,7 +55804,7 @@ function position(row, rowFixedLength, rect, halfGapWidth, flush) {
|
|
|
55802
55804
|
rect[wh[idx1WhenH]] -= rowOtherLength;
|
|
55803
55805
|
}
|
|
55804
55806
|
|
|
55805
|
-
// Return [containerWidth, containerHeight] as
|
|
55807
|
+
// Return [containerWidth, containerHeight] as default.
|
|
55806
55808
|
function estimateRootSize(seriesModel, targetInfo, viewRoot, containerWidth, containerHeight) {
|
|
55807
55809
|
// If targetInfo.node exists, we zoom to the node,
|
|
55808
55810
|
// so estimate whold width and heigth by target node.
|
|
@@ -56108,11 +56110,6 @@ graphProto.addEdge = function (n1, n2, dataIndex) {
|
|
|
56108
56110
|
}
|
|
56109
56111
|
|
|
56110
56112
|
var key = n1.id + '-' + n2.id;
|
|
56111
|
-
// PENDING
|
|
56112
|
-
if (edgesMap[key]) {
|
|
56113
|
-
return;
|
|
56114
|
-
}
|
|
56115
|
-
|
|
56116
56113
|
var edge = new Edge(n1, n2, dataIndex);
|
|
56117
56114
|
edge.hostGraph = this;
|
|
56118
56115
|
|
|
@@ -56512,10 +56509,12 @@ var createGraphFromNodeEdge = function (nodes, edges, seriesModel, directed, bef
|
|
|
56512
56509
|
var linkNameList = [];
|
|
56513
56510
|
var validEdges = [];
|
|
56514
56511
|
var linkCount = 0;
|
|
56512
|
+
|
|
56515
56513
|
for (var i = 0; i < edges.length; i++) {
|
|
56516
56514
|
var link = edges[i];
|
|
56517
56515
|
var source = link.source;
|
|
56518
56516
|
var target = link.target;
|
|
56517
|
+
|
|
56519
56518
|
// addEdge may fail when source or target not exists
|
|
56520
56519
|
if (graph.addEdge(source, target, linkCount)) {
|
|
56521
56520
|
validEdges.push(link);
|
|
@@ -56562,7 +56561,6 @@ var createGraphFromNodeEdge = function (nodes, edges, seriesModel, directed, bef
|
|
|
56562
56561
|
|
|
56563
56562
|
// Update dataIndex of nodes and edges because invalid edge may be removed
|
|
56564
56563
|
graph.update();
|
|
56565
|
-
|
|
56566
56564
|
return graph;
|
|
56567
56565
|
};
|
|
56568
56566
|
|
|
@@ -56585,6 +56583,234 @@ var createGraphFromNodeEdge = function (nodes, edges, seriesModel, directed, bef
|
|
|
56585
56583
|
* under the License.
|
|
56586
56584
|
*/
|
|
56587
56585
|
|
|
56586
|
+
var KEY_DELIMITER = '-->';
|
|
56587
|
+
/**
|
|
56588
|
+
* params handler
|
|
56589
|
+
* @param {module:echarts/model/SeriesModel} seriesModel
|
|
56590
|
+
* @returns {*}
|
|
56591
|
+
*/
|
|
56592
|
+
var getAutoCurvenessParams = function (seriesModel) {
|
|
56593
|
+
return seriesModel.get('autoCurveness') || null;
|
|
56594
|
+
};
|
|
56595
|
+
|
|
56596
|
+
/**
|
|
56597
|
+
* Generate a list of edge curvatures, 20 is the default
|
|
56598
|
+
* @param {module:echarts/model/SeriesModel} seriesModel
|
|
56599
|
+
* @param {number} appendLength
|
|
56600
|
+
* @return 20 => [0, -0.2, 0.2, -0.4, 0.4, -0.6, 0.6, -0.8, 0.8, -1, 1, -1.2, 1.2, -1.4, 1.4, -1.6, 1.6, -1.8, 1.8, -2]
|
|
56601
|
+
*/
|
|
56602
|
+
var createCurveness = function (seriesModel, appendLength) {
|
|
56603
|
+
var autoCurvenessParmas = getAutoCurvenessParams(seriesModel);
|
|
56604
|
+
var length = 20;
|
|
56605
|
+
var curvenessList = [];
|
|
56606
|
+
|
|
56607
|
+
// handler the function set
|
|
56608
|
+
if (typeof autoCurvenessParmas === 'number') {
|
|
56609
|
+
length = autoCurvenessParmas;
|
|
56610
|
+
}
|
|
56611
|
+
else if (isArray(autoCurvenessParmas)) {
|
|
56612
|
+
seriesModel.__curvenessList = autoCurvenessParmas;
|
|
56613
|
+
return;
|
|
56614
|
+
}
|
|
56615
|
+
|
|
56616
|
+
// append length
|
|
56617
|
+
if (appendLength > length) {
|
|
56618
|
+
length = appendLength;
|
|
56619
|
+
}
|
|
56620
|
+
|
|
56621
|
+
// make sure the length is even
|
|
56622
|
+
var len = length % 2 ? length + 2 : length + 3;
|
|
56623
|
+
curvenessList = [];
|
|
56624
|
+
|
|
56625
|
+
for (var i = 0; i < len; i++) {
|
|
56626
|
+
curvenessList.push((i % 2 ? i + 1 : i) / 10 * (i % 2 ? -1 : 1));
|
|
56627
|
+
}
|
|
56628
|
+
seriesModel.__curvenessList = curvenessList;
|
|
56629
|
+
};
|
|
56630
|
+
|
|
56631
|
+
/**
|
|
56632
|
+
* Create different cache key data in the positive and negative directions, in order to set the curvature later
|
|
56633
|
+
* @param {number|string|module:echarts/data/Graph.Node} n1
|
|
56634
|
+
* @param {number|string|module:echarts/data/Graph.Node} n2
|
|
56635
|
+
* @param {module:echarts/model/SeriesModel} seriesModel
|
|
56636
|
+
* @returns {string} key
|
|
56637
|
+
*/
|
|
56638
|
+
var getKeyOfEdges = function (n1, n2, seriesModel) {
|
|
56639
|
+
var source = [n1.id, n1.dataIndex].join('.');
|
|
56640
|
+
var target = [n2.id, n2.dataIndex].join('.');
|
|
56641
|
+
return [seriesModel.uid, source, target].join(KEY_DELIMITER);
|
|
56642
|
+
};
|
|
56643
|
+
|
|
56644
|
+
/**
|
|
56645
|
+
* get opposite key
|
|
56646
|
+
* @param {string} key
|
|
56647
|
+
* @returns {string}
|
|
56648
|
+
*/
|
|
56649
|
+
var getOppositeKey = function (key) {
|
|
56650
|
+
var keys = key.split(KEY_DELIMITER);
|
|
56651
|
+
return [keys[0], keys[2], keys[1]].join(KEY_DELIMITER);
|
|
56652
|
+
};
|
|
56653
|
+
|
|
56654
|
+
/**
|
|
56655
|
+
* get edgeMap with key
|
|
56656
|
+
* @param edge
|
|
56657
|
+
* @param {module:echarts/model/SeriesModel} seriesModel
|
|
56658
|
+
*/
|
|
56659
|
+
var getEdgeFromMap = function (edge, seriesModel) {
|
|
56660
|
+
var key = getKeyOfEdges(edge.node1, edge.node2, seriesModel);
|
|
56661
|
+
return seriesModel.__edgeMap[key];
|
|
56662
|
+
};
|
|
56663
|
+
|
|
56664
|
+
/**
|
|
56665
|
+
* calculate all cases total length
|
|
56666
|
+
* @param edge
|
|
56667
|
+
* @param seriesModel
|
|
56668
|
+
* @returns {number}
|
|
56669
|
+
*/
|
|
56670
|
+
var getTotalLengthBetweenNodes = function (edge, seriesModel) {
|
|
56671
|
+
var len = getEdgeMapLengthWithKey(getKeyOfEdges(edge.node1, edge.node2, seriesModel), seriesModel);
|
|
56672
|
+
var lenV = getEdgeMapLengthWithKey(getKeyOfEdges(edge.node2, edge.node1, seriesModel), seriesModel);
|
|
56673
|
+
|
|
56674
|
+
return len + lenV;
|
|
56675
|
+
};
|
|
56676
|
+
|
|
56677
|
+
/**
|
|
56678
|
+
*
|
|
56679
|
+
* @param key
|
|
56680
|
+
*/
|
|
56681
|
+
var getEdgeMapLengthWithKey = function (key, seriesModel) {
|
|
56682
|
+
var edgeMap = seriesModel.__edgeMap;
|
|
56683
|
+
return edgeMap[key] ? edgeMap[key].length : 0;
|
|
56684
|
+
};
|
|
56685
|
+
|
|
56686
|
+
/**
|
|
56687
|
+
* Count the number of edges between the same two points, used to obtain the curvature table and the parity of the edge
|
|
56688
|
+
* @see /graph/GraphSeries.js@getInitialData
|
|
56689
|
+
* @param {module:echarts/model/SeriesModel} seriesModel
|
|
56690
|
+
*/
|
|
56691
|
+
function initCurvenessList(seriesModel) {
|
|
56692
|
+
if (!getAutoCurvenessParams(seriesModel)) {
|
|
56693
|
+
return;
|
|
56694
|
+
}
|
|
56695
|
+
|
|
56696
|
+
seriesModel.__curvenessList = [];
|
|
56697
|
+
seriesModel.__edgeMap = {};
|
|
56698
|
+
// calc the array of curveness List
|
|
56699
|
+
createCurveness(seriesModel);
|
|
56700
|
+
}
|
|
56701
|
+
|
|
56702
|
+
/**
|
|
56703
|
+
* set edgeMap with key
|
|
56704
|
+
* @param {number|string|module:echarts/data/Graph.Node} n1
|
|
56705
|
+
* @param {number|string|module:echarts/data/Graph.Node} n2
|
|
56706
|
+
* @param {module:echarts/model/SeriesModel} seriesModel
|
|
56707
|
+
* @param {number} index
|
|
56708
|
+
*/
|
|
56709
|
+
function createEdgeMapForCurveness(n1, n2, seriesModel, index) {
|
|
56710
|
+
if (!getAutoCurvenessParams(seriesModel)) {
|
|
56711
|
+
return;
|
|
56712
|
+
}
|
|
56713
|
+
|
|
56714
|
+
var key = getKeyOfEdges(n1, n2, seriesModel);
|
|
56715
|
+
var edgeMap = seriesModel.__edgeMap;
|
|
56716
|
+
var oppositeEdges = edgeMap[getOppositeKey(key)];
|
|
56717
|
+
// set direction
|
|
56718
|
+
if (edgeMap[key] && !oppositeEdges) {
|
|
56719
|
+
edgeMap[key].isForward = true;
|
|
56720
|
+
}
|
|
56721
|
+
else if (oppositeEdges && edgeMap[key]) {
|
|
56722
|
+
oppositeEdges.isForward = true;
|
|
56723
|
+
edgeMap[key].isForward = false;
|
|
56724
|
+
}
|
|
56725
|
+
|
|
56726
|
+
edgeMap[key] = edgeMap[key] || [];
|
|
56727
|
+
edgeMap[key].push(index);
|
|
56728
|
+
}
|
|
56729
|
+
|
|
56730
|
+
/**
|
|
56731
|
+
* get curvature for edge
|
|
56732
|
+
* @param edge
|
|
56733
|
+
* @param {module:echarts/model/SeriesModel} seriesModel
|
|
56734
|
+
* @param index
|
|
56735
|
+
*/
|
|
56736
|
+
function getCurvenessForEdge(edge, seriesModel, index, needReverse) {
|
|
56737
|
+
var autoCurvenessParams = getAutoCurvenessParams(seriesModel);
|
|
56738
|
+
var isArrayParam = isArray(autoCurvenessParams);
|
|
56739
|
+
if (!autoCurvenessParams) {
|
|
56740
|
+
return null;
|
|
56741
|
+
}
|
|
56742
|
+
|
|
56743
|
+
var edgeArray = getEdgeFromMap(edge, seriesModel);
|
|
56744
|
+
if (!edgeArray) {
|
|
56745
|
+
return null;
|
|
56746
|
+
}
|
|
56747
|
+
|
|
56748
|
+
var edgeIndex = -1;
|
|
56749
|
+
for (var i = 0; i < edgeArray.length; i++) {
|
|
56750
|
+
if (edgeArray[i] === index) {
|
|
56751
|
+
edgeIndex = i;
|
|
56752
|
+
break;
|
|
56753
|
+
}
|
|
56754
|
+
}
|
|
56755
|
+
// if totalLen is Longer createCurveness
|
|
56756
|
+
var totalLen = getTotalLengthBetweenNodes(edge, seriesModel);
|
|
56757
|
+
createCurveness(seriesModel, totalLen);
|
|
56758
|
+
|
|
56759
|
+
edge.lineStyle = edge.lineStyle || {};
|
|
56760
|
+
// if is opposite edge, must set curvenss to opposite number
|
|
56761
|
+
var curKey = getKeyOfEdges(edge.node1, edge.node2, seriesModel);
|
|
56762
|
+
var curvenessList = seriesModel.__curvenessList;
|
|
56763
|
+
// if pass array no need parity
|
|
56764
|
+
var parityCorrection = isArrayParam ? 0 : totalLen % 2 ? 0 : 1;
|
|
56765
|
+
|
|
56766
|
+
if (!edgeArray.isForward) {
|
|
56767
|
+
// the opposite edge show outside
|
|
56768
|
+
var oppositeKey = getOppositeKey(curKey);
|
|
56769
|
+
var len = getEdgeMapLengthWithKey(oppositeKey, seriesModel);
|
|
56770
|
+
var resValue = curvenessList[edgeIndex + len + parityCorrection];
|
|
56771
|
+
// isNeedReverse, simple, force type need reverse the curveness in the junction of the forword and the opposite
|
|
56772
|
+
if (needReverse) {
|
|
56773
|
+
// set as array may make the parity handle with the len of opposite
|
|
56774
|
+
if (isArrayParam) {
|
|
56775
|
+
if (autoCurvenessParams && autoCurvenessParams[0] === 0) {
|
|
56776
|
+
return (len + parityCorrection) % 2 ? resValue : -resValue;
|
|
56777
|
+
}
|
|
56778
|
+
else {
|
|
56779
|
+
return ((len % 2 ? 0 : 1) + parityCorrection) % 2 ? resValue : -resValue;
|
|
56780
|
+
}
|
|
56781
|
+
}
|
|
56782
|
+
else {
|
|
56783
|
+
return (len + parityCorrection) % 2 ? resValue : -resValue;
|
|
56784
|
+
}
|
|
56785
|
+
}
|
|
56786
|
+
else {
|
|
56787
|
+
return curvenessList[edgeIndex + len + parityCorrection];
|
|
56788
|
+
}
|
|
56789
|
+
}
|
|
56790
|
+
else {
|
|
56791
|
+
return curvenessList[parityCorrection + edgeIndex];
|
|
56792
|
+
}
|
|
56793
|
+
}
|
|
56794
|
+
|
|
56795
|
+
/*
|
|
56796
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
56797
|
+
* or more contributor license agreements. See the NOTICE file
|
|
56798
|
+
* distributed with this work for additional information
|
|
56799
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
56800
|
+
* to you under the Apache License, Version 2.0 (the
|
|
56801
|
+
* "License"); you may not use this file except in compliance
|
|
56802
|
+
* with the License. You may obtain a copy of the License at
|
|
56803
|
+
*
|
|
56804
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
56805
|
+
*
|
|
56806
|
+
* Unless required by applicable law or agreed to in writing,
|
|
56807
|
+
* software distributed under the License is distributed on an
|
|
56808
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
56809
|
+
* KIND, either express or implied. See the License for the
|
|
56810
|
+
* specific language governing permissions and limitations
|
|
56811
|
+
* under the License.
|
|
56812
|
+
*/
|
|
56813
|
+
|
|
56588
56814
|
var GraphSeries = extendSeriesModel({
|
|
56589
56815
|
|
|
56590
56816
|
type: 'series.graph',
|
|
@@ -56625,7 +56851,13 @@ var GraphSeries = extendSeriesModel({
|
|
|
56625
56851
|
var self = this;
|
|
56626
56852
|
|
|
56627
56853
|
if (nodes && edges) {
|
|
56628
|
-
|
|
56854
|
+
// auto curveness
|
|
56855
|
+
initCurvenessList(this);
|
|
56856
|
+
var graph = createGraphFromNodeEdge(nodes, edges, this, true, beforeLink);
|
|
56857
|
+
each$1(graph.edges, function (edge) {
|
|
56858
|
+
createEdgeMapForCurveness(edge.node1, edge.node2, this, edge.dataIndex);
|
|
56859
|
+
}, this);
|
|
56860
|
+
return graph.data;
|
|
56629
56861
|
}
|
|
56630
56862
|
|
|
56631
56863
|
function beforeLink(nodeData, edgeData) {
|
|
@@ -56837,7 +57069,6 @@ var GraphSeries = extendSeriesModel({
|
|
|
56837
57069
|
lineStyle: {
|
|
56838
57070
|
color: '#aaa',
|
|
56839
57071
|
width: 1,
|
|
56840
|
-
curveness: 0,
|
|
56841
57072
|
opacity: 0.5
|
|
56842
57073
|
},
|
|
56843
57074
|
emphasis: {
|
|
@@ -56952,22 +57183,29 @@ function makeSymbolTypeKey(symbolCategory) {
|
|
|
56952
57183
|
* @inner
|
|
56953
57184
|
*/
|
|
56954
57185
|
function createSymbol$1(name, lineData, idx) {
|
|
56955
|
-
var color = lineData.getItemVisual(idx, 'color');
|
|
56956
57186
|
var symbolType = lineData.getItemVisual(idx, name);
|
|
56957
|
-
var symbolSize = lineData.getItemVisual(idx, name + 'Size');
|
|
56958
57187
|
|
|
56959
57188
|
if (!symbolType || symbolType === 'none') {
|
|
56960
57189
|
return;
|
|
56961
57190
|
}
|
|
56962
57191
|
|
|
57192
|
+
var color = lineData.getItemVisual(idx, 'color');
|
|
57193
|
+
var symbolSize = lineData.getItemVisual(idx, name + 'Size');
|
|
57194
|
+
var symbolRotate = lineData.getItemVisual(idx, name + 'Rotate');
|
|
57195
|
+
|
|
56963
57196
|
if (!isArray(symbolSize)) {
|
|
56964
57197
|
symbolSize = [symbolSize, symbolSize];
|
|
56965
57198
|
}
|
|
57199
|
+
|
|
56966
57200
|
var symbolPath = createSymbol(
|
|
56967
57201
|
symbolType, -symbolSize[0] / 2, -symbolSize[1] / 2,
|
|
56968
57202
|
symbolSize[0], symbolSize[1], color
|
|
56969
57203
|
);
|
|
56970
57204
|
|
|
57205
|
+
// rotate by default if symbolRotate is not specified or NaN
|
|
57206
|
+
symbolPath.__specifiedRotation = symbolRotate == null || isNaN(symbolRotate)
|
|
57207
|
+
? void 0
|
|
57208
|
+
: +symbolRotate * Math.PI / 180 || 0;
|
|
56971
57209
|
symbolPath.name = name;
|
|
56972
57210
|
|
|
56973
57211
|
return symbolPath;
|
|
@@ -57035,18 +57273,38 @@ function updateSymbolAndLabelBeforeLineUpdate() {
|
|
|
57035
57273
|
|
|
57036
57274
|
if (symbolFrom) {
|
|
57037
57275
|
symbolFrom.attr('position', fromPos);
|
|
57038
|
-
|
|
57039
|
-
|
|
57040
|
-
|
|
57041
|
-
|
|
57276
|
+
// Fix #12388
|
|
57277
|
+
// when symbol is set to be 'arrow' in markLine,
|
|
57278
|
+
// symbolRotate value will be ignored, and compulsively use tangent angle.
|
|
57279
|
+
// rotate by default if symbol rotation is not specified
|
|
57280
|
+
var specifiedRotation = symbolFrom.__specifiedRotation;
|
|
57281
|
+
if (specifiedRotation == null) {
|
|
57282
|
+
var tangent = line.tangentAt(0);
|
|
57283
|
+
symbolFrom.attr('rotation', Math.PI / 2 - Math.atan2(
|
|
57284
|
+
tangent[1], tangent[0]
|
|
57285
|
+
));
|
|
57286
|
+
}
|
|
57287
|
+
else {
|
|
57288
|
+
symbolFrom.attr('rotation', specifiedRotation);
|
|
57289
|
+
}
|
|
57042
57290
|
symbolFrom.attr('scale', [invScale * percent, invScale * percent]);
|
|
57043
57291
|
}
|
|
57044
57292
|
if (symbolTo) {
|
|
57045
57293
|
symbolTo.attr('position', toPos);
|
|
57046
|
-
|
|
57047
|
-
|
|
57048
|
-
|
|
57049
|
-
|
|
57294
|
+
// Fix #12388
|
|
57295
|
+
// when symbol is set to be 'arrow' in markLine,
|
|
57296
|
+
// symbolRotate value will be ignored, and compulsively use tangent angle.
|
|
57297
|
+
// rotate by default if symbol rotation is not specified
|
|
57298
|
+
var specifiedRotation = symbolTo.__specifiedRotation;
|
|
57299
|
+
if (specifiedRotation == null) {
|
|
57300
|
+
var tangent = line.tangentAt(1);
|
|
57301
|
+
symbolTo.attr('rotation', -Math.PI / 2 - Math.atan2(
|
|
57302
|
+
tangent[1], tangent[0]
|
|
57303
|
+
));
|
|
57304
|
+
}
|
|
57305
|
+
else {
|
|
57306
|
+
symbolTo.attr('rotation', specifiedRotation);
|
|
57307
|
+
}
|
|
57050
57308
|
symbolTo.attr('scale', [invScale * percent, invScale * percent]);
|
|
57051
57309
|
}
|
|
57052
57310
|
|
|
@@ -58484,12 +58742,16 @@ function simpleLayout$1(seriesModel) {
|
|
|
58484
58742
|
node.setLayout([+model.get('x'), +model.get('y')]);
|
|
58485
58743
|
});
|
|
58486
58744
|
|
|
58487
|
-
simpleLayoutEdge(graph);
|
|
58745
|
+
simpleLayoutEdge(graph, seriesModel);
|
|
58488
58746
|
}
|
|
58489
58747
|
|
|
58490
|
-
function simpleLayoutEdge(graph) {
|
|
58491
|
-
graph.eachEdge(function (edge) {
|
|
58492
|
-
var curveness =
|
|
58748
|
+
function simpleLayoutEdge(graph, seriesModel) {
|
|
58749
|
+
graph.eachEdge(function (edge, index) {
|
|
58750
|
+
var curveness = retrieve3(
|
|
58751
|
+
edge.getModel().get('lineStyle.curveness'),
|
|
58752
|
+
-getCurvenessForEdge(edge, seriesModel, index, true),
|
|
58753
|
+
0
|
|
58754
|
+
);
|
|
58493
58755
|
var p1 = clone$1(edge.node1.getLayout());
|
|
58494
58756
|
var p2 = clone$1(edge.node2.getLayout());
|
|
58495
58757
|
var points = [p1, p2];
|
|
@@ -58553,7 +58815,7 @@ var simpleLayout = function (ecModel, api) {
|
|
|
58553
58815
|
}
|
|
58554
58816
|
}
|
|
58555
58817
|
|
|
58556
|
-
simpleLayoutEdge(data.graph);
|
|
58818
|
+
simpleLayoutEdge(data.graph, seriesModel);
|
|
58557
58819
|
}
|
|
58558
58820
|
else if (!layout || layout === 'none') {
|
|
58559
58821
|
simpleLayout$1(seriesModel);
|
|
@@ -58633,8 +58895,12 @@ function circularLayout$1(seriesModel, basedOn) {
|
|
|
58633
58895
|
|
|
58634
58896
|
_layoutNodesBasedOn[basedOn](seriesModel, coordSys, graph, nodeData, r, cx, cy, count);
|
|
58635
58897
|
|
|
58636
|
-
graph.eachEdge(function (edge) {
|
|
58637
|
-
var curveness =
|
|
58898
|
+
graph.eachEdge(function (edge, index) {
|
|
58899
|
+
var curveness = retrieve3(
|
|
58900
|
+
edge.getModel().get('lineStyle.curveness'),
|
|
58901
|
+
getCurvenessForEdge(edge, seriesModel, index),
|
|
58902
|
+
0
|
|
58903
|
+
);
|
|
58638
58904
|
var p1 = clone$1(edge.node1.getLayout());
|
|
58639
58905
|
var p2 = clone$1(edge.node2.getLayout());
|
|
58640
58906
|
var cp1;
|
|
@@ -58978,11 +59244,16 @@ var forceLayout = function (ecModel) {
|
|
|
58978
59244
|
d = (edgeLength[0] + edgeLength[1]) / 2;
|
|
58979
59245
|
}
|
|
58980
59246
|
var edgeModel = edge.getModel();
|
|
59247
|
+
var curveness = retrieve3(
|
|
59248
|
+
edgeModel.get('lineStyle.curveness'),
|
|
59249
|
+
-getCurvenessForEdge(edge, graphSeries, idx, true),
|
|
59250
|
+
0
|
|
59251
|
+
);
|
|
58981
59252
|
return {
|
|
58982
59253
|
n1: nodes[edge.node1.dataIndex],
|
|
58983
59254
|
n2: nodes[edge.node2.dataIndex],
|
|
58984
59255
|
d: d,
|
|
58985
|
-
curveness:
|
|
59256
|
+
curveness: curveness,
|
|
58986
59257
|
ignoreForceLayout: edgeModel.get('ignoreForceLayout')
|
|
58987
59258
|
};
|
|
58988
59259
|
});
|
|
@@ -59881,6 +60152,7 @@ var FunnelSeries = extendSeriesModel({
|
|
|
59881
60152
|
minSize: '0%',
|
|
59882
60153
|
maxSize: '100%',
|
|
59883
60154
|
sort: 'descending', // 'ascending', 'descending'
|
|
60155
|
+
orient: 'vertical',
|
|
59884
60156
|
gap: 0,
|
|
59885
60157
|
funnelAlign: 'center',
|
|
59886
60158
|
label: {
|
|
@@ -60184,6 +60456,7 @@ function labelLayout$1(data) {
|
|
|
60184
60456
|
var itemModel = data.getItemModel(idx);
|
|
60185
60457
|
var labelModel = itemModel.getModel('label');
|
|
60186
60458
|
var labelPosition = labelModel.get('position');
|
|
60459
|
+
var orient = itemModel.get('orient');
|
|
60187
60460
|
|
|
60188
60461
|
var labelLineModel = itemModel.getModel('labelLine');
|
|
60189
60462
|
|
|
@@ -60223,7 +60496,18 @@ function labelLayout$1(data) {
|
|
|
60223
60496
|
var x1;
|
|
60224
60497
|
var y1;
|
|
60225
60498
|
var x2;
|
|
60499
|
+
var y2;
|
|
60226
60500
|
var labelLineLen = labelLineModel.get('length');
|
|
60501
|
+
if (__DEV__) {
|
|
60502
|
+
if (orient === 'vertical' && ['top', 'bottom'].indexOf(labelPosition) > -1) {
|
|
60503
|
+
labelPosition = 'left';
|
|
60504
|
+
console.warn('Position error: Funnel chart on vertical orient dose not support top and bottom.');
|
|
60505
|
+
}
|
|
60506
|
+
if (orient === 'horizontal' && ['left', 'right'].indexOf(labelPosition) > -1) {
|
|
60507
|
+
labelPosition = 'bottom';
|
|
60508
|
+
console.warn('Position error: Funnel chart on horizontal orient dose not support left and right.');
|
|
60509
|
+
}
|
|
60510
|
+
}
|
|
60227
60511
|
if (labelPosition === 'left') {
|
|
60228
60512
|
// Left side
|
|
60229
60513
|
x1 = (points[3][0] + points[0][0]) / 2;
|
|
@@ -60240,50 +60524,106 @@ function labelLayout$1(data) {
|
|
|
60240
60524
|
textX = x2 + 5;
|
|
60241
60525
|
textAlign = 'left';
|
|
60242
60526
|
}
|
|
60527
|
+
else if (labelPosition === 'top') {
|
|
60528
|
+
// Top side
|
|
60529
|
+
x1 = (points[3][0] + points[0][0]) / 2;
|
|
60530
|
+
y1 = (points[3][1] + points[0][1]) / 2;
|
|
60531
|
+
y2 = y1 - labelLineLen;
|
|
60532
|
+
textY = y2 - 5;
|
|
60533
|
+
textAlign = 'center';
|
|
60534
|
+
}
|
|
60535
|
+
else if (labelPosition === 'bottom') {
|
|
60536
|
+
// Bottom side
|
|
60537
|
+
x1 = (points[1][0] + points[2][0]) / 2;
|
|
60538
|
+
y1 = (points[1][1] + points[2][1]) / 2;
|
|
60539
|
+
y2 = y1 + labelLineLen;
|
|
60540
|
+
textY = y2 + 5;
|
|
60541
|
+
textAlign = 'center';
|
|
60542
|
+
}
|
|
60243
60543
|
else if (labelPosition === 'rightTop') {
|
|
60244
60544
|
// RightTop side
|
|
60245
|
-
x1 = points[1][0];
|
|
60246
|
-
y1 = points[1][1];
|
|
60247
|
-
|
|
60248
|
-
|
|
60249
|
-
|
|
60545
|
+
x1 = orient === 'horizontal' ? points[3][0] : points[1][0];
|
|
60546
|
+
y1 = orient === 'horizontal' ? points[3][1] : points[1][1];
|
|
60547
|
+
if (orient === 'horizontal') {
|
|
60548
|
+
y2 = y1 - labelLineLen;
|
|
60549
|
+
textY = y2 - 5;
|
|
60550
|
+
textAlign = 'center';
|
|
60551
|
+
}
|
|
60552
|
+
else {
|
|
60553
|
+
x2 = x1 + labelLineLen;
|
|
60554
|
+
textX = x2 + 5;
|
|
60555
|
+
textAlign = 'top';
|
|
60556
|
+
}
|
|
60250
60557
|
}
|
|
60251
60558
|
else if (labelPosition === 'rightBottom') {
|
|
60252
60559
|
// RightBottom side
|
|
60253
60560
|
x1 = points[2][0];
|
|
60254
60561
|
y1 = points[2][1];
|
|
60255
|
-
|
|
60256
|
-
|
|
60257
|
-
|
|
60562
|
+
if (orient === 'horizontal') {
|
|
60563
|
+
y2 = y1 + labelLineLen;
|
|
60564
|
+
textY = y2 + 5;
|
|
60565
|
+
textAlign = 'center';
|
|
60566
|
+
}
|
|
60567
|
+
else {
|
|
60568
|
+
x2 = x1 + labelLineLen;
|
|
60569
|
+
textX = x2 + 5;
|
|
60570
|
+
textAlign = 'bottom';
|
|
60571
|
+
}
|
|
60258
60572
|
}
|
|
60259
60573
|
else if (labelPosition === 'leftTop') {
|
|
60260
60574
|
// LeftTop side
|
|
60261
60575
|
x1 = points[0][0];
|
|
60262
|
-
y1 = points[1][1];
|
|
60263
|
-
|
|
60264
|
-
|
|
60265
|
-
|
|
60576
|
+
y1 = orient === 'horizontal' ? points[0][1] : points[1][1];
|
|
60577
|
+
if (orient === 'horizontal') {
|
|
60578
|
+
y2 = y1 - labelLineLen;
|
|
60579
|
+
textY = y2 - 5;
|
|
60580
|
+
textAlign = 'center';
|
|
60581
|
+
}
|
|
60582
|
+
else {
|
|
60583
|
+
x2 = x1 - labelLineLen;
|
|
60584
|
+
textX = x2 - 5;
|
|
60585
|
+
textAlign = 'right';
|
|
60586
|
+
}
|
|
60266
60587
|
}
|
|
60267
60588
|
else if (labelPosition === 'leftBottom') {
|
|
60268
60589
|
// LeftBottom side
|
|
60269
|
-
x1 = points[3][0];
|
|
60270
|
-
y1 = points[2][1];
|
|
60271
|
-
|
|
60272
|
-
|
|
60273
|
-
|
|
60590
|
+
x1 = orient === 'horizontal' ? points[1][0] : points[3][0];
|
|
60591
|
+
y1 = orient === 'horizontal' ? points[1][1] : points[2][1];
|
|
60592
|
+
if (orient === 'horizontal') {
|
|
60593
|
+
y2 = y1 + labelLineLen;
|
|
60594
|
+
textY = y2 + 5;
|
|
60595
|
+
textAlign = 'center';
|
|
60596
|
+
}
|
|
60597
|
+
else {
|
|
60598
|
+
x2 = x1 - labelLineLen;
|
|
60599
|
+
textX = x2 - 5;
|
|
60600
|
+
textAlign = 'right';
|
|
60601
|
+
}
|
|
60274
60602
|
}
|
|
60275
60603
|
else {
|
|
60276
|
-
// Right side
|
|
60604
|
+
// Right side or Bottom side
|
|
60277
60605
|
x1 = (points[1][0] + points[2][0]) / 2;
|
|
60278
60606
|
y1 = (points[1][1] + points[2][1]) / 2;
|
|
60279
|
-
|
|
60280
|
-
|
|
60281
|
-
|
|
60607
|
+
if (orient === 'horizontal') {
|
|
60608
|
+
y2 = y1 + labelLineLen;
|
|
60609
|
+
textY = y2 + 5;
|
|
60610
|
+
textAlign = 'center';
|
|
60611
|
+
}
|
|
60612
|
+
else {
|
|
60613
|
+
x2 = x1 + labelLineLen;
|
|
60614
|
+
textX = x2 + 5;
|
|
60615
|
+
textAlign = 'left';
|
|
60616
|
+
}
|
|
60617
|
+
}
|
|
60618
|
+
if (orient === 'horizontal') {
|
|
60619
|
+
x2 = x1;
|
|
60620
|
+
textX = x2;
|
|
60621
|
+
}
|
|
60622
|
+
else {
|
|
60623
|
+
y2 = y1;
|
|
60624
|
+
textY = y2;
|
|
60282
60625
|
}
|
|
60283
|
-
var y2 = y1;
|
|
60284
|
-
|
|
60285
60626
|
linePoints = [[x1, y1], [x2, y2]];
|
|
60286
|
-
textY = y2;
|
|
60287
60627
|
}
|
|
60288
60628
|
|
|
60289
60629
|
layout.label = {
|
|
@@ -60304,11 +60644,19 @@ var funnelLayout = function (ecModel, api, payload) {
|
|
|
60304
60644
|
var sort = seriesModel.get('sort');
|
|
60305
60645
|
var viewRect = getViewRect$3(seriesModel, api);
|
|
60306
60646
|
var indices = getSortedIndices(data, sort);
|
|
60647
|
+
var orient = seriesModel.get('orient');
|
|
60648
|
+
var viewWidth = viewRect.width;
|
|
60649
|
+
var viewHeight = viewRect.height;
|
|
60650
|
+
var x = viewRect.x;
|
|
60651
|
+
var y = viewRect.y;
|
|
60307
60652
|
|
|
60308
|
-
var sizeExtent = [
|
|
60309
|
-
parsePercent$1(seriesModel.get('minSize'),
|
|
60310
|
-
parsePercent$1(seriesModel.get('maxSize'),
|
|
60311
|
-
]
|
|
60653
|
+
var sizeExtent = orient === 'horizontal' ? [
|
|
60654
|
+
parsePercent$1(seriesModel.get('minSize'), viewHeight),
|
|
60655
|
+
parsePercent$1(seriesModel.get('maxSize'), viewHeight)
|
|
60656
|
+
] : [
|
|
60657
|
+
parsePercent$1(seriesModel.get('minSize'), viewWidth),
|
|
60658
|
+
parsePercent$1(seriesModel.get('maxSize'), viewWidth)
|
|
60659
|
+
];
|
|
60312
60660
|
var dataExtent = data.getDataExtent(valueDim);
|
|
60313
60661
|
var min = seriesModel.get('min');
|
|
60314
60662
|
var max = seriesModel.get('max');
|
|
@@ -60321,64 +60669,113 @@ var funnelLayout = function (ecModel, api, payload) {
|
|
|
60321
60669
|
|
|
60322
60670
|
var funnelAlign = seriesModel.get('funnelAlign');
|
|
60323
60671
|
var gap = seriesModel.get('gap');
|
|
60324
|
-
var
|
|
60325
|
-
|
|
60326
|
-
var y = viewRect.y;
|
|
60672
|
+
var viewSize = orient === 'horizontal' ? viewWidth : viewHeight;
|
|
60673
|
+
var itemSize = (viewSize - gap * (data.count() - 1)) / data.count();
|
|
60327
60674
|
|
|
60328
|
-
var getLinePoints = function (idx,
|
|
60675
|
+
var getLinePoints = function (idx, offset) {
|
|
60329
60676
|
// End point index is data.count() and we assign it 0
|
|
60677
|
+
if (orient === 'horizontal') {
|
|
60678
|
+
var val = data.get(valueDim, idx) || 0;
|
|
60679
|
+
var itemHeight = linearMap(val, [min, max], sizeExtent, true);
|
|
60680
|
+
var y0;
|
|
60681
|
+
switch (funnelAlign) {
|
|
60682
|
+
case 'top':
|
|
60683
|
+
y0 = y;
|
|
60684
|
+
break;
|
|
60685
|
+
case 'center':
|
|
60686
|
+
y0 = y + (viewHeight - itemHeight) / 2;
|
|
60687
|
+
break;
|
|
60688
|
+
case 'bottom':
|
|
60689
|
+
y0 = y + (viewHeight - itemHeight);
|
|
60690
|
+
break;
|
|
60691
|
+
}
|
|
60692
|
+
|
|
60693
|
+
return [
|
|
60694
|
+
[offset, y0],
|
|
60695
|
+
[offset, y0 + itemHeight]
|
|
60696
|
+
];
|
|
60697
|
+
}
|
|
60330
60698
|
var val = data.get(valueDim, idx) || 0;
|
|
60331
60699
|
var itemWidth = linearMap(val, [min, max], sizeExtent, true);
|
|
60332
60700
|
var x0;
|
|
60333
60701
|
switch (funnelAlign) {
|
|
60334
60702
|
case 'left':
|
|
60335
|
-
x0 =
|
|
60703
|
+
x0 = x;
|
|
60336
60704
|
break;
|
|
60337
60705
|
case 'center':
|
|
60338
|
-
x0 =
|
|
60706
|
+
x0 = x + (viewWidth - itemWidth) / 2;
|
|
60339
60707
|
break;
|
|
60340
60708
|
case 'right':
|
|
60341
|
-
x0 =
|
|
60709
|
+
x0 = x + viewWidth - itemWidth;
|
|
60342
60710
|
break;
|
|
60343
60711
|
}
|
|
60344
60712
|
return [
|
|
60345
|
-
[x0,
|
|
60346
|
-
[x0 + itemWidth,
|
|
60713
|
+
[x0, offset],
|
|
60714
|
+
[x0 + itemWidth, offset]
|
|
60347
60715
|
];
|
|
60348
60716
|
};
|
|
60349
60717
|
|
|
60350
60718
|
if (sort === 'ascending') {
|
|
60351
60719
|
// From bottom to top
|
|
60352
|
-
|
|
60720
|
+
itemSize = -itemSize;
|
|
60353
60721
|
gap = -gap;
|
|
60354
|
-
|
|
60722
|
+
if (orient === 'horizontal') {
|
|
60723
|
+
x += viewWidth;
|
|
60724
|
+
}
|
|
60725
|
+
else {
|
|
60726
|
+
y += viewHeight;
|
|
60727
|
+
}
|
|
60355
60728
|
indices = indices.reverse();
|
|
60356
60729
|
}
|
|
60357
60730
|
|
|
60358
60731
|
for (var i = 0; i < indices.length; i++) {
|
|
60359
60732
|
var idx = indices[i];
|
|
60360
60733
|
var nextIdx = indices[i + 1];
|
|
60361
|
-
|
|
60362
60734
|
var itemModel = data.getItemModel(idx);
|
|
60363
|
-
|
|
60364
|
-
if (
|
|
60365
|
-
|
|
60735
|
+
|
|
60736
|
+
if (orient === 'horizontal') {
|
|
60737
|
+
var width = itemModel.get('itemStyle.width');
|
|
60738
|
+
if (width == null) {
|
|
60739
|
+
width = itemSize;
|
|
60740
|
+
}
|
|
60741
|
+
else {
|
|
60742
|
+
width = parsePercent$1(width, viewWidth);
|
|
60743
|
+
if (sort === 'ascending') {
|
|
60744
|
+
width = -width;
|
|
60745
|
+
}
|
|
60746
|
+
}
|
|
60747
|
+
|
|
60748
|
+
var start = getLinePoints(idx, x);
|
|
60749
|
+
var end = getLinePoints(nextIdx, x + width);
|
|
60750
|
+
|
|
60751
|
+
x += width + gap;
|
|
60752
|
+
|
|
60753
|
+
data.setItemLayout(idx, {
|
|
60754
|
+
points: start.concat(end.slice().reverse())
|
|
60755
|
+
});
|
|
60366
60756
|
}
|
|
60367
60757
|
else {
|
|
60368
|
-
height =
|
|
60369
|
-
if (
|
|
60370
|
-
height =
|
|
60758
|
+
var height = itemModel.get('itemStyle.height');
|
|
60759
|
+
if (height == null) {
|
|
60760
|
+
height = itemSize;
|
|
60761
|
+
}
|
|
60762
|
+
else {
|
|
60763
|
+
height = parsePercent$1(height, viewHeight);
|
|
60764
|
+
if (sort === 'ascending') {
|
|
60765
|
+
height = -height;
|
|
60766
|
+
}
|
|
60371
60767
|
}
|
|
60372
|
-
}
|
|
60373
60768
|
|
|
60374
|
-
|
|
60375
|
-
|
|
60769
|
+
var start = orient === 'horizontal' ? getLinePoints(idx, x) : getLinePoints(idx, y);
|
|
60770
|
+
var end = orient === 'horizontal'
|
|
60771
|
+
? getLinePoints(nextIdx, x + width) : getLinePoints(nextIdx, y + height);
|
|
60376
60772
|
|
|
60377
|
-
|
|
60773
|
+
y += height + gap;
|
|
60378
60774
|
|
|
60379
|
-
|
|
60380
|
-
|
|
60381
|
-
|
|
60775
|
+
data.setItemLayout(idx, {
|
|
60776
|
+
points: start.concat(end.slice().reverse())
|
|
60777
|
+
});
|
|
60778
|
+
}
|
|
60382
60779
|
}
|
|
60383
60780
|
|
|
60384
60781
|
labelLayout$1(data);
|
|
@@ -66689,8 +67086,6 @@ var LinesSeries = SeriesModel.extend({
|
|
|
66689
67086
|
},
|
|
66690
67087
|
|
|
66691
67088
|
mergeOption: function (option) {
|
|
66692
|
-
// The input data may be null/undefined.
|
|
66693
|
-
option.data = option.data || [];
|
|
66694
67089
|
|
|
66695
67090
|
compatEc2(option);
|
|
66696
67091
|
|
|
@@ -68582,7 +68977,7 @@ var PictorialBarSeries = BaseBarSeries.extend({
|
|
|
68582
68977
|
symbolPosition: null, // 'start' or 'end' or 'center', null means auto.
|
|
68583
68978
|
symbolOffset: null,
|
|
68584
68979
|
symbolMargin: null, // start margin and end margin. Can be a number or a percent string.
|
|
68585
|
-
// Auto margin by
|
|
68980
|
+
// Auto margin by default.
|
|
68586
68981
|
symbolRepeat: false, // false/null/undefined, means no repeat.
|
|
68587
68982
|
// Can be true, means auto calculate repeat times and cut by data.
|
|
68588
68983
|
// Can be a number, specifies repeat times, and do not cut by data.
|
|
@@ -70418,7 +70813,7 @@ function processOnAxis(axisInfo, newValue, updaters, dontSnap, outputFinder) {
|
|
|
70418
70813
|
var snapToValue = payloadInfo.snapToValue;
|
|
70419
70814
|
|
|
70420
70815
|
// Fill content of event obj for echarts.connect.
|
|
70421
|
-
// By
|
|
70816
|
+
// By default use the first involved series data as a sample to connect.
|
|
70422
70817
|
if (payloadBatch[0] && outputFinder.seriesIndex == null) {
|
|
70423
70818
|
extend(outputFinder, payloadBatch[0]);
|
|
70424
70819
|
}
|
|
@@ -72136,52 +72531,46 @@ var ThemeRiverSeries = SeriesModel.extend({
|
|
|
72136
72531
|
*/
|
|
72137
72532
|
fixData: function (data) {
|
|
72138
72533
|
var rawDataLength = data.length;
|
|
72534
|
+
/**
|
|
72535
|
+
* Make sure every layer data get the same keys.
|
|
72536
|
+
* The value index tells which layer has visited.
|
|
72537
|
+
* {
|
|
72538
|
+
* 2014/01/01: -1
|
|
72539
|
+
* }
|
|
72540
|
+
*/
|
|
72541
|
+
var timeValueKeys = {};
|
|
72139
72542
|
|
|
72140
72543
|
// grouped data by name
|
|
72141
72544
|
var groupResult = groupData(data, function (item) {
|
|
72545
|
+
if (!timeValueKeys.hasOwnProperty(item[0])) {
|
|
72546
|
+
timeValueKeys[item[0]] = -1;
|
|
72547
|
+
}
|
|
72142
72548
|
return item[2];
|
|
72143
72549
|
});
|
|
72144
72550
|
var layData = [];
|
|
72145
72551
|
groupResult.buckets.each(function (items, key) {
|
|
72146
72552
|
layData.push({name: key, dataList: items});
|
|
72147
72553
|
});
|
|
72148
|
-
|
|
72149
72554
|
var layerNum = layData.length;
|
|
72150
|
-
var largestLayer = -1;
|
|
72151
|
-
var index = -1;
|
|
72152
|
-
for (var i = 0; i < layerNum; ++i) {
|
|
72153
|
-
var len = layData[i].dataList.length;
|
|
72154
|
-
if (len > largestLayer) {
|
|
72155
|
-
largestLayer = len;
|
|
72156
|
-
index = i;
|
|
72157
|
-
}
|
|
72158
|
-
}
|
|
72159
72555
|
|
|
72160
72556
|
for (var k = 0; k < layerNum; ++k) {
|
|
72161
|
-
if (k === index) {
|
|
72162
|
-
continue;
|
|
72163
|
-
}
|
|
72164
72557
|
var name = layData[k].name;
|
|
72165
|
-
for (var j = 0; j <
|
|
72166
|
-
var timeValue = layData[
|
|
72167
|
-
|
|
72168
|
-
|
|
72169
|
-
|
|
72170
|
-
|
|
72171
|
-
|
|
72172
|
-
|
|
72173
|
-
break;
|
|
72174
|
-
}
|
|
72175
|
-
}
|
|
72176
|
-
if (keyIndex === -1) {
|
|
72558
|
+
for (var j = 0; j < layData[k].dataList.length; ++j) {
|
|
72559
|
+
var timeValue = layData[k].dataList[j][0];
|
|
72560
|
+
timeValueKeys[timeValue] = k;
|
|
72561
|
+
}
|
|
72562
|
+
|
|
72563
|
+
for (var timeValue in timeValueKeys) {
|
|
72564
|
+
if (timeValueKeys.hasOwnProperty(timeValue) && timeValueKeys[timeValue] !== k) {
|
|
72565
|
+
timeValueKeys[timeValue] = k;
|
|
72177
72566
|
data[rawDataLength] = [];
|
|
72178
72567
|
data[rawDataLength][0] = timeValue;
|
|
72179
72568
|
data[rawDataLength][1] = 0;
|
|
72180
72569
|
data[rawDataLength][2] = name;
|
|
72181
72570
|
rawDataLength++;
|
|
72182
|
-
|
|
72183
72571
|
}
|
|
72184
72572
|
}
|
|
72573
|
+
|
|
72185
72574
|
}
|
|
72186
72575
|
return data;
|
|
72187
72576
|
},
|
|
@@ -72800,18 +73189,25 @@ SeriesModel.extend({
|
|
|
72800
73189
|
|
|
72801
73190
|
completeTreeValue$1(root);
|
|
72802
73191
|
|
|
72803
|
-
var
|
|
72804
|
-
|
|
72805
|
-
|
|
72806
|
-
|
|
72807
|
-
var treeOption = {};
|
|
72808
|
-
|
|
72809
|
-
treeOption.levels = levels;
|
|
73192
|
+
var levelModels = map(option.levels || [], function (levelDefine) {
|
|
73193
|
+
return new Model(levelDefine, this, ecModel);
|
|
73194
|
+
}, this);
|
|
72810
73195
|
|
|
72811
73196
|
// Make sure always a new tree is created when setOption,
|
|
72812
73197
|
// in TreemapView, we check whether oldTree === newTree
|
|
72813
73198
|
// to choose mappings approach among old shapes and new shapes.
|
|
72814
|
-
|
|
73199
|
+
var tree = Tree.createTree(root, this, beforeLink);
|
|
73200
|
+
|
|
73201
|
+
function beforeLink(nodeData) {
|
|
73202
|
+
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
73203
|
+
var node = tree.getNodeByDataIndex(idx);
|
|
73204
|
+
var levelModel = levelModels[node.depth];
|
|
73205
|
+
levelModel && (model.parentModel = levelModel);
|
|
73206
|
+
return model;
|
|
73207
|
+
});
|
|
73208
|
+
}
|
|
73209
|
+
|
|
73210
|
+
return tree.data;
|
|
72815
73211
|
},
|
|
72816
73212
|
|
|
72817
73213
|
optionUpdated: function () {
|
|
@@ -73181,9 +73577,13 @@ SunburstPieceProto._updateLabel = function (seriesModel, visualColor, state) {
|
|
|
73181
73577
|
: itemModel.getModel(state + '.label');
|
|
73182
73578
|
var labelHoverModel = itemModel.getModel('emphasis.label');
|
|
73183
73579
|
|
|
73580
|
+
var labelFormatter = labelModel.get('formatter');
|
|
73581
|
+
// Use normal formatter if no state formatter is defined
|
|
73582
|
+
var labelState = labelFormatter ? state : 'normal';
|
|
73583
|
+
|
|
73184
73584
|
var text = retrieve(
|
|
73185
73585
|
seriesModel.getFormattedLabel(
|
|
73186
|
-
this.node.dataIndex,
|
|
73586
|
+
this.node.dataIndex, labelState, null, null, 'label'
|
|
73187
73587
|
),
|
|
73188
73588
|
this.node.name
|
|
73189
73589
|
);
|
|
@@ -75112,8 +75512,9 @@ function barLayoutPolar(seriesType, ecModel, api) {
|
|
|
75112
75512
|
var clampLayout = baseAxis.dim !== 'radius'
|
|
75113
75513
|
|| !seriesModel.get('roundCap', true);
|
|
75114
75514
|
|
|
75115
|
-
var valueAxisStart = valueAxis.
|
|
75116
|
-
|
|
75515
|
+
var valueAxisStart = valueAxis.dim === 'radius'
|
|
75516
|
+
? valueAxis.dataToRadius(0)
|
|
75517
|
+
: valueAxis.dataToAngle(0);
|
|
75117
75518
|
for (var idx = 0, len = data.count(); idx < len; idx++) {
|
|
75118
75519
|
var value = data.get(valueDim, idx);
|
|
75119
75520
|
var baseValue = data.get(baseDim, idx);
|
|
@@ -75125,6 +75526,7 @@ function barLayoutPolar(seriesType, ecModel, api) {
|
|
|
75125
75526
|
// stackResultDimension directly.
|
|
75126
75527
|
// Only ordinal axis can be stacked.
|
|
75127
75528
|
if (stacked) {
|
|
75529
|
+
|
|
75128
75530
|
if (!lastStackCoords[stackId][baseValue]) {
|
|
75129
75531
|
lastStackCoords[stackId][baseValue] = {
|
|
75130
75532
|
p: valueAxisStart, // Positive stack
|
|
@@ -77014,12 +77416,9 @@ var GeoModel = ComponentModel.extend({
|
|
|
77014
77416
|
* @return {string}
|
|
77015
77417
|
*/
|
|
77016
77418
|
getFormattedLabel: function (name, status) {
|
|
77419
|
+
status = status || 'normal';
|
|
77017
77420
|
var regionModel = this.getRegionModel(name);
|
|
77018
|
-
var formatter = regionModel.get(
|
|
77019
|
-
'label'
|
|
77020
|
-
+ (status === 'normal' ? '.' : status + '.')
|
|
77021
|
-
+ 'formatter'
|
|
77022
|
-
);
|
|
77421
|
+
var formatter = regionModel.get((status === 'normal' ? '' : status + '.') + 'label.formatter');
|
|
77023
77422
|
var params = {
|
|
77024
77423
|
name: name
|
|
77025
77424
|
};
|
|
@@ -79426,7 +79825,8 @@ proto$2.onclick = function (ecModel, api) {
|
|
|
79426
79825
|
$a.target = '_blank';
|
|
79427
79826
|
$a.href = url;
|
|
79428
79827
|
var evt = new MouseEvent('click', {
|
|
79429
|
-
|
|
79828
|
+
// some micro front-end framework, window maybe is a Proxy
|
|
79829
|
+
view: document.defaultView,
|
|
79430
79830
|
bubbles: true,
|
|
79431
79831
|
cancelable: false
|
|
79432
79832
|
});
|
|
@@ -79741,7 +80141,8 @@ function assembleSeriesWithCategoryAxis(series) {
|
|
|
79741
80141
|
}));
|
|
79742
80142
|
var columns = [categoryAxis.model.getCategories()];
|
|
79743
80143
|
each$1(group.series, function (series) {
|
|
79744
|
-
|
|
80144
|
+
var rawData = series.getRawData();
|
|
80145
|
+
columns.push(series.getRawData().mapArray(rawData.mapDimension(valueAxisDim), function (val) {
|
|
79745
80146
|
return val;
|
|
79746
80147
|
}));
|
|
79747
80148
|
});
|
|
@@ -79859,7 +80260,13 @@ function parseListContents(str) {
|
|
|
79859
80260
|
|
|
79860
80261
|
var data = [];
|
|
79861
80262
|
for (var i = 0; i < lines.length; i++) {
|
|
79862
|
-
|
|
80263
|
+
// if line is empty, ignore it.
|
|
80264
|
+
// there is a case that a user forgot to delete `\n`.
|
|
80265
|
+
var line = trim$1(lines[i]);
|
|
80266
|
+
if (!line) {
|
|
80267
|
+
continue;
|
|
80268
|
+
}
|
|
80269
|
+
var items = line.split(itemSplitRegex);
|
|
79863
80270
|
var name = '';
|
|
79864
80271
|
var value;
|
|
79865
80272
|
var hasName = false;
|
|
@@ -80074,13 +80481,18 @@ function tryMergeDataOption(newData, originalData) {
|
|
|
80074
80481
|
return map(newData, function (newVal, idx) {
|
|
80075
80482
|
var original = originalData && originalData[idx];
|
|
80076
80483
|
if (isObject$1(original) && !isArray(original)) {
|
|
80077
|
-
|
|
80078
|
-
|
|
80484
|
+
var newValIsObject = isObject$1(newVal) && !isArray(newVal);
|
|
80485
|
+
if (!newValIsObject) {
|
|
80486
|
+
newVal = {
|
|
80487
|
+
value: newVal
|
|
80488
|
+
};
|
|
80079
80489
|
}
|
|
80490
|
+
// original data has name but new data has no name
|
|
80491
|
+
var shouldDeleteName = original.name != null && newVal.name == null;
|
|
80080
80492
|
// Original data has option
|
|
80081
|
-
|
|
80082
|
-
|
|
80083
|
-
|
|
80493
|
+
newVal = defaults(newVal, original);
|
|
80494
|
+
shouldDeleteName && (delete newVal.name);
|
|
80495
|
+
return newVal;
|
|
80084
80496
|
}
|
|
80085
80497
|
else {
|
|
80086
80498
|
return newVal;
|
|
@@ -82367,7 +82779,11 @@ DataZoom.defaultOption = {
|
|
|
82367
82779
|
back: 'M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26'
|
|
82368
82780
|
},
|
|
82369
82781
|
// `zoom`, `back`
|
|
82370
|
-
title: clone(dataZoomLang.title)
|
|
82782
|
+
title: clone(dataZoomLang.title),
|
|
82783
|
+
brushStyle: {
|
|
82784
|
+
borderWidth: 0,
|
|
82785
|
+
color: 'rgba(0,0,0,0.2)'
|
|
82786
|
+
}
|
|
82371
82787
|
};
|
|
82372
82788
|
|
|
82373
82789
|
var proto$4 = DataZoom.prototype;
|
|
@@ -82542,11 +82958,7 @@ function updateZoomBtnStatus(featureModel, ecModel, view, payload, api) {
|
|
|
82542
82958
|
zoomActive
|
|
82543
82959
|
? {
|
|
82544
82960
|
brushType: 'auto',
|
|
82545
|
-
brushStyle:
|
|
82546
|
-
// FIXME user customized?
|
|
82547
|
-
lineWidth: 0,
|
|
82548
|
-
fill: 'rgba(0,0,0,0.2)'
|
|
82549
|
-
}
|
|
82961
|
+
brushStyle: featureModel.getModel('brushStyle').getItemStyle()
|
|
82550
82962
|
}
|
|
82551
82963
|
: false
|
|
82552
82964
|
);
|
|
@@ -82884,8 +83296,21 @@ function assembleFont(textStyleModel) {
|
|
|
82884
83296
|
|
|
82885
83297
|
cssText.push('font:' + textStyleModel.getFont());
|
|
82886
83298
|
|
|
83299
|
+
var lineHeight = textStyleModel.get('lineHeight');
|
|
83300
|
+
if (lineHeight == null) {
|
|
83301
|
+
lineHeight = Math.round(fontSize * 3 / 2);
|
|
83302
|
+
}
|
|
83303
|
+
|
|
82887
83304
|
fontSize
|
|
82888
|
-
&& cssText.push('line-height:' +
|
|
83305
|
+
&& cssText.push('line-height:' + lineHeight + 'px');
|
|
83306
|
+
|
|
83307
|
+
var shadowColor = textStyleModel.get('textShadowColor');
|
|
83308
|
+
var shadowBlur = textStyleModel.get('textShadowBlur') || 0;
|
|
83309
|
+
var shadowOffsetX = textStyleModel.get('textShadowOffsetX') || 0;
|
|
83310
|
+
var shadowOffsetY = textStyleModel.get('textShadowOffsetY') || 0;
|
|
83311
|
+
shadowBlur
|
|
83312
|
+
&& cssText.push('text-shadow:' + shadowOffsetX + 'px ' + shadowOffsetY + 'px '
|
|
83313
|
+
+ shadowBlur + 'px ' + shadowColor);
|
|
82889
83314
|
|
|
82890
83315
|
each$22(['decoration', 'align'], function (name) {
|
|
82891
83316
|
var val = textStyleModel.get(name);
|
|
@@ -82969,6 +83394,8 @@ function makeStyleCoord(out, zr, appendToBody, zrX, zrY) {
|
|
|
82969
83394
|
out[1] += viewportRootOffset.offsetTop;
|
|
82970
83395
|
}
|
|
82971
83396
|
}
|
|
83397
|
+
out[2] = out[0] / zr.getWidth(); // The ratio of left to width
|
|
83398
|
+
out[3] = out[1] / zr.getHeight(); // The ratio of top to height
|
|
82972
83399
|
}
|
|
82973
83400
|
|
|
82974
83401
|
/**
|
|
@@ -82993,7 +83420,7 @@ function TooltipContent(container, api, opt) {
|
|
|
82993
83420
|
var zr = this._zr = api.getZr();
|
|
82994
83421
|
var appendToBody = this._appendToBody = opt && opt.appendToBody;
|
|
82995
83422
|
|
|
82996
|
-
this._styleCoord = [0, 0];
|
|
83423
|
+
this._styleCoord = [0, 0, 0, 0]; // [left, top, left/width, top/height]
|
|
82997
83424
|
|
|
82998
83425
|
makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
|
|
82999
83426
|
|
|
@@ -83064,7 +83491,7 @@ TooltipContent.prototype = {
|
|
|
83064
83491
|
/**
|
|
83065
83492
|
* Update when tooltip is rendered
|
|
83066
83493
|
*/
|
|
83067
|
-
update: function () {
|
|
83494
|
+
update: function (tooltipModel) {
|
|
83068
83495
|
// FIXME
|
|
83069
83496
|
// Move this logic to ec main?
|
|
83070
83497
|
var container = this._container;
|
|
@@ -83074,11 +83501,25 @@ TooltipContent.prototype = {
|
|
|
83074
83501
|
if (domStyle.position !== 'absolute' && stl.position !== 'absolute') {
|
|
83075
83502
|
domStyle.position = 'relative';
|
|
83076
83503
|
}
|
|
83504
|
+
var alwaysShowContent = tooltipModel.get('alwaysShowContent');
|
|
83505
|
+
alwaysShowContent && this._moveTooltipIfResized();
|
|
83077
83506
|
// Hide the tooltip
|
|
83078
83507
|
// PENDING
|
|
83079
83508
|
// this.hide();
|
|
83080
83509
|
},
|
|
83081
83510
|
|
|
83511
|
+
/**
|
|
83512
|
+
* when `alwaysShowContent` is true,
|
|
83513
|
+
* we should move the tooltip after chart resized
|
|
83514
|
+
*/
|
|
83515
|
+
_moveTooltipIfResized: function () {
|
|
83516
|
+
var ratioX = this._styleCoord[2]; // The ratio of left to width
|
|
83517
|
+
var ratioY = this._styleCoord[3]; // The ratio of top to height
|
|
83518
|
+
var realX = ratioX * this._zr.getWidth();
|
|
83519
|
+
var realY = ratioY * this._zr.getHeight();
|
|
83520
|
+
this.moveTo(realX, realY);
|
|
83521
|
+
},
|
|
83522
|
+
|
|
83082
83523
|
show: function (tooltipModel) {
|
|
83083
83524
|
clearTimeout(this._hideTimeout);
|
|
83084
83525
|
var el = this.el;
|
|
@@ -83093,10 +83534,10 @@ TooltipContent.prototype = {
|
|
|
83093
83534
|
|
|
83094
83535
|
el.style.display = el.innerHTML ? 'block' : 'none';
|
|
83095
83536
|
|
|
83096
|
-
// If mouse
|
|
83097
|
-
// triggered by canvas, and
|
|
83537
|
+
// If mouse occasionally move over the tooltip, a mouseout event will be
|
|
83538
|
+
// triggered by canvas, and cause some unexpectable result like dragging
|
|
83098
83539
|
// stop, "unfocusAdjacency". Here `pointer-events: none` is used to solve
|
|
83099
|
-
// it. Although it is not
|
|
83540
|
+
// it. Although it is not supported by IE8~IE10, fortunately it is a rare
|
|
83100
83541
|
// scenario.
|
|
83101
83542
|
el.style.pointerEvents = this._enterable ? 'auto' : 'none';
|
|
83102
83543
|
|
|
@@ -83134,7 +83575,7 @@ TooltipContent.prototype = {
|
|
|
83134
83575
|
if (this._show && !(this._inContent && this._enterable)) {
|
|
83135
83576
|
if (time) {
|
|
83136
83577
|
this._hideDelay = time;
|
|
83137
|
-
// Set show false to avoid invoke hideLater
|
|
83578
|
+
// Set show false to avoid invoke hideLater multiple times
|
|
83138
83579
|
this._show = false;
|
|
83139
83580
|
this._hideTimeout = setTimeout(bind(this.hide, this), time);
|
|
83140
83581
|
}
|
|
@@ -83191,13 +83632,24 @@ TooltipContent.prototype = {
|
|
|
83191
83632
|
*/
|
|
83192
83633
|
|
|
83193
83634
|
// import Group from 'zrender/src/container/Group';
|
|
83635
|
+
function makeStyleCoord$1(out, zr, zrX, zrY) {
|
|
83636
|
+
out[0] = zrX;
|
|
83637
|
+
out[1] = zrY;
|
|
83638
|
+
out[2] = out[0] / zr.getWidth(); // The ratio of left to width
|
|
83639
|
+
out[3] = out[1] / zr.getHeight(); // The ratio of top to height
|
|
83640
|
+
}
|
|
83641
|
+
|
|
83194
83642
|
/**
|
|
83195
83643
|
* @alias module:echarts/component/tooltip/TooltipRichContent
|
|
83196
83644
|
* @constructor
|
|
83197
83645
|
*/
|
|
83198
83646
|
function TooltipRichContent(api) {
|
|
83199
83647
|
|
|
83200
|
-
this._zr = api.getZr();
|
|
83648
|
+
var zr = this._zr = api.getZr();
|
|
83649
|
+
|
|
83650
|
+
this._styleCoord = [0, 0, 0, 0]; // [left, top, left/width, top/height]
|
|
83651
|
+
|
|
83652
|
+
makeStyleCoord$1(this._styleCoord, zr, api.getWidth() / 2, api.getHeight() / 2);
|
|
83201
83653
|
|
|
83202
83654
|
this._show = false;
|
|
83203
83655
|
|
|
@@ -83220,8 +83672,21 @@ TooltipRichContent.prototype = {
|
|
|
83220
83672
|
/**
|
|
83221
83673
|
* Update when tooltip is rendered
|
|
83222
83674
|
*/
|
|
83223
|
-
update: function () {
|
|
83224
|
-
|
|
83675
|
+
update: function (tooltipModel) {
|
|
83676
|
+
var alwaysShowContent = tooltipModel.get('alwaysShowContent');
|
|
83677
|
+
alwaysShowContent && this._moveTooltipIfResized();
|
|
83678
|
+
},
|
|
83679
|
+
|
|
83680
|
+
/**
|
|
83681
|
+
* when `alwaysShowContent` is true,
|
|
83682
|
+
* we should move the tooltip after chart resized
|
|
83683
|
+
*/
|
|
83684
|
+
_moveTooltipIfResized: function () {
|
|
83685
|
+
var ratioX = this._styleCoord[2]; // The ratio of left to width
|
|
83686
|
+
var ratioY = this._styleCoord[3]; // The ratio of top to height
|
|
83687
|
+
var realX = ratioX * this._zr.getWidth();
|
|
83688
|
+
var realY = ratioY * this._zr.getHeight();
|
|
83689
|
+
this.moveTo(realX, realY);
|
|
83225
83690
|
},
|
|
83226
83691
|
|
|
83227
83692
|
show: function (tooltipModel) {
|
|
@@ -83276,16 +83741,23 @@ TooltipRichContent.prototype = {
|
|
|
83276
83741
|
startId = text.indexOf('{marker');
|
|
83277
83742
|
}
|
|
83278
83743
|
|
|
83744
|
+
var textStyleModel = tooltipModel.getModel('textStyle');
|
|
83745
|
+
var fontSize = textStyleModel.get('fontSize');
|
|
83746
|
+
var lineHeight = tooltipModel.get('textLineHeight');
|
|
83747
|
+
if (lineHeight == null) {
|
|
83748
|
+
lineHeight = Math.round(fontSize * 3 / 2);
|
|
83749
|
+
}
|
|
83750
|
+
|
|
83279
83751
|
this.el = new Text({
|
|
83280
|
-
style: {
|
|
83752
|
+
style: setTextStyle({}, textStyleModel, {
|
|
83281
83753
|
rich: markers,
|
|
83282
83754
|
text: content,
|
|
83283
|
-
textLineHeight: 20,
|
|
83284
83755
|
textBackgroundColor: tooltipModel.get('backgroundColor'),
|
|
83285
83756
|
textBorderRadius: tooltipModel.get('borderRadius'),
|
|
83286
83757
|
textFill: tooltipModel.get('textStyle.color'),
|
|
83287
|
-
textPadding: tooltipModel.get('padding')
|
|
83288
|
-
|
|
83758
|
+
textPadding: tooltipModel.get('padding'),
|
|
83759
|
+
textLineHeight: lineHeight
|
|
83760
|
+
}),
|
|
83289
83761
|
z: tooltipModel.get('z')
|
|
83290
83762
|
});
|
|
83291
83763
|
this._zr.add(this.el);
|
|
@@ -83320,7 +83792,9 @@ TooltipRichContent.prototype = {
|
|
|
83320
83792
|
|
|
83321
83793
|
moveTo: function (x, y) {
|
|
83322
83794
|
if (this.el) {
|
|
83323
|
-
this.
|
|
83795
|
+
var styleCoord = this._styleCoord;
|
|
83796
|
+
makeStyleCoord$1(styleCoord, this._zr, x, y);
|
|
83797
|
+
this.el.attr('position', [styleCoord[0], styleCoord[1]]);
|
|
83324
83798
|
}
|
|
83325
83799
|
},
|
|
83326
83800
|
|
|
@@ -83335,7 +83809,7 @@ TooltipRichContent.prototype = {
|
|
|
83335
83809
|
if (this._show && !(this._inContent && this._enterable)) {
|
|
83336
83810
|
if (time) {
|
|
83337
83811
|
this._hideDelay = time;
|
|
83338
|
-
// Set show false to avoid invoke hideLater
|
|
83812
|
+
// Set show false to avoid invoke hideLater multiple times
|
|
83339
83813
|
this._show = false;
|
|
83340
83814
|
this._hideTimeout = setTimeout(bind(this.hide, this), time);
|
|
83341
83815
|
}
|
|
@@ -83349,6 +83823,14 @@ TooltipRichContent.prototype = {
|
|
|
83349
83823
|
return this._show;
|
|
83350
83824
|
},
|
|
83351
83825
|
|
|
83826
|
+
dispose: function () {
|
|
83827
|
+
clearTimeout(this._hideTimeout);
|
|
83828
|
+
|
|
83829
|
+
if (this.el) {
|
|
83830
|
+
this._zr.remove(this.el);
|
|
83831
|
+
}
|
|
83832
|
+
},
|
|
83833
|
+
|
|
83352
83834
|
getOuterSize: function () {
|
|
83353
83835
|
var size = this.getSize();
|
|
83354
83836
|
return {
|
|
@@ -83453,7 +83935,7 @@ extendComponentView({
|
|
|
83453
83935
|
this._alwaysShowContent = tooltipModel.get('alwaysShowContent');
|
|
83454
83936
|
|
|
83455
83937
|
var tooltipContent = this._tooltipContent;
|
|
83456
|
-
tooltipContent.update();
|
|
83938
|
+
tooltipContent.update(tooltipModel);
|
|
83457
83939
|
tooltipContent.setEnterable(tooltipModel.get('enterable'));
|
|
83458
83940
|
|
|
83459
83941
|
this._initGlobalListener();
|
|
@@ -83683,7 +84165,7 @@ extendComponentView({
|
|
|
83683
84165
|
_showOrMove: function (tooltipModel, cb) {
|
|
83684
84166
|
// showDelay is used in this case: tooltip.enterable is set
|
|
83685
84167
|
// as true. User intent to move mouse into tooltip and click
|
|
83686
|
-
// something. `showDelay` makes it
|
|
84168
|
+
// something. `showDelay` makes it easier to enter the content
|
|
83687
84169
|
// but tooltip do not move immediately.
|
|
83688
84170
|
var delay = tooltipModel.get('showDelay');
|
|
83689
84171
|
cb = bind(cb, this);
|
|
@@ -83768,7 +84250,7 @@ extendComponentView({
|
|
|
83768
84250
|
|
|
83769
84251
|
// Default tooltip content
|
|
83770
84252
|
// FIXME
|
|
83771
|
-
// (1)
|
|
84253
|
+
// (1) should be the first data which has name?
|
|
83772
84254
|
// (2) themeRiver, firstDataIndex is array, and first line is unnecessary.
|
|
83773
84255
|
var firstLine = valueLabel;
|
|
83774
84256
|
if (renderMode !== 'html') {
|
|
@@ -83884,7 +84366,7 @@ extendComponentView({
|
|
|
83884
84366
|
var asyncTicket = Math.random();
|
|
83885
84367
|
|
|
83886
84368
|
// Do not check whether `trigger` is 'none' here, because `trigger`
|
|
83887
|
-
// only works on
|
|
84369
|
+
// only works on coordinate system. In fact, we have not found case
|
|
83888
84370
|
// that requires setting `trigger` nothing on component yet.
|
|
83889
84371
|
|
|
83890
84372
|
this._showOrMove(subTooltipModel, function () {
|
|
@@ -85625,7 +86107,7 @@ extendComponentView({
|
|
|
85625
86107
|
}
|
|
85626
86108
|
if (sublink) {
|
|
85627
86109
|
subTextEl.on('click', function () {
|
|
85628
|
-
windowOpen(
|
|
86110
|
+
windowOpen(sublink, '_' + titleModel.get('subtarget'));
|
|
85629
86111
|
});
|
|
85630
86112
|
}
|
|
85631
86113
|
|
|
@@ -86903,13 +87385,16 @@ function getViewRect$5(model, api) {
|
|
|
86903
87385
|
}
|
|
86904
87386
|
|
|
86905
87387
|
function makeIcon(timelineModel, objPath, rect, opts) {
|
|
86906
|
-
var
|
|
86907
|
-
|
|
86908
|
-
|
|
86909
|
-
|
|
86910
|
-
|
|
87388
|
+
var style = opts.style;
|
|
87389
|
+
var icon = createIcon(
|
|
87390
|
+
timelineModel.get(objPath),
|
|
87391
|
+
opts || {},
|
|
87392
|
+
new BoundingRect(rect[0], rect[1], rect[2], rect[3])
|
|
86911
87393
|
);
|
|
86912
|
-
|
|
87394
|
+
// TODO createIcon won't use style in opt.
|
|
87395
|
+
if (style) {
|
|
87396
|
+
icon.setStyle(style);
|
|
87397
|
+
}
|
|
86913
87398
|
return icon;
|
|
86914
87399
|
}
|
|
86915
87400
|
|
|
@@ -87135,15 +87620,16 @@ var MarkerModel = extendComponentModel({
|
|
|
87135
87620
|
}
|
|
87136
87621
|
},
|
|
87137
87622
|
|
|
87138
|
-
formatTooltip: function (dataIndex) {
|
|
87623
|
+
formatTooltip: function (dataIndex, multipleSeries, dataType, renderMode) {
|
|
87139
87624
|
var data = this.getData();
|
|
87140
87625
|
var value = this.getRawValue(dataIndex);
|
|
87141
87626
|
var formattedValue = isArray(value)
|
|
87142
87627
|
? map(value, addCommas$1).join(', ') : addCommas$1(value);
|
|
87143
87628
|
var name = data.getName(dataIndex);
|
|
87144
87629
|
var html = encodeHTML$1(this.name);
|
|
87630
|
+
var newLine = renderMode === 'html' ? '<br/>' : '\n';
|
|
87145
87631
|
if (value != null || name) {
|
|
87146
|
-
html +=
|
|
87632
|
+
html += newLine;
|
|
87147
87633
|
}
|
|
87148
87634
|
if (name) {
|
|
87149
87635
|
html += encodeHTML$1(name);
|
|
@@ -87608,10 +88094,12 @@ MarkerView.extend({
|
|
|
87608
88094
|
var itemModel = mpData.getItemModel(idx);
|
|
87609
88095
|
var symbol = itemModel.getShallow('symbol');
|
|
87610
88096
|
var symbolSize = itemModel.getShallow('symbolSize');
|
|
88097
|
+
var symbolRotate = itemModel.getShallow('symbolRotate');
|
|
87611
88098
|
var isFnSymbol = isFunction$1(symbol);
|
|
87612
88099
|
var isFnSymbolSize = isFunction$1(symbolSize);
|
|
88100
|
+
var isFnSymbolRotate = isFunction$1(symbolRotate);
|
|
87613
88101
|
|
|
87614
|
-
if (isFnSymbol || isFnSymbolSize) {
|
|
88102
|
+
if (isFnSymbol || isFnSymbolSize || isFnSymbolRotate) {
|
|
87615
88103
|
var rawIdx = mpModel.getRawValue(idx);
|
|
87616
88104
|
var dataParams = mpModel.getDataParams(idx);
|
|
87617
88105
|
if (isFnSymbol) {
|
|
@@ -87621,11 +88109,15 @@ MarkerView.extend({
|
|
|
87621
88109
|
// FIXME 这里不兼容 ECharts 2.x,2.x 貌似参数是整个数据?
|
|
87622
88110
|
symbolSize = symbolSize(rawIdx, dataParams);
|
|
87623
88111
|
}
|
|
88112
|
+
if (isFnSymbolRotate) {
|
|
88113
|
+
symbolRotate = symbolRotate(rawIdx, dataParams);
|
|
88114
|
+
}
|
|
87624
88115
|
}
|
|
87625
88116
|
|
|
87626
88117
|
mpData.setItemVisual(idx, {
|
|
87627
88118
|
symbol: symbol,
|
|
87628
88119
|
symbolSize: symbolSize,
|
|
88120
|
+
symbolRotate: symbolRotate,
|
|
87629
88121
|
color: itemModel.get('itemStyle.color')
|
|
87630
88122
|
|| seriesData.getVisual('color')
|
|
87631
88123
|
});
|
|
@@ -88061,8 +88553,10 @@ MarkerView.extend({
|
|
|
88061
88553
|
]);
|
|
88062
88554
|
|
|
88063
88555
|
lineData.setItemVisual(idx, {
|
|
88556
|
+
'fromSymbolRotate': fromData.getItemVisual(idx, 'symbolRotate'),
|
|
88064
88557
|
'fromSymbolSize': fromData.getItemVisual(idx, 'symbolSize'),
|
|
88065
88558
|
'fromSymbol': fromData.getItemVisual(idx, 'symbol'),
|
|
88559
|
+
'toSymbolRotate': toData.getItemVisual(idx, 'symbolRotate'),
|
|
88066
88560
|
'toSymbolSize': toData.getItemVisual(idx, 'symbolSize'),
|
|
88067
88561
|
'toSymbol': toData.getItemVisual(idx, 'symbol')
|
|
88068
88562
|
});
|
|
@@ -88084,8 +88578,8 @@ MarkerView.extend({
|
|
|
88084
88578
|
updateSingleMarkerEndLayout(
|
|
88085
88579
|
data, idx, isFrom, seriesModel, api
|
|
88086
88580
|
);
|
|
88087
|
-
|
|
88088
88581
|
data.setItemVisual(idx, {
|
|
88582
|
+
symbolRotate: itemModel.get('symbolRotate'),
|
|
88089
88583
|
symbolSize: itemModel.get('symbolSize') || symbolSize[isFrom ? 0 : 1],
|
|
88090
88584
|
symbol: itemModel.get('symbol', true) || symbolType[isFrom ? 0 : 1],
|
|
88091
88585
|
color: itemModel.get('itemStyle.color') || seriesData.getVisual('color')
|
|
@@ -88444,9 +88938,29 @@ MarkerView.extend({
|
|
|
88444
88938
|
// Update visual and layout of line
|
|
88445
88939
|
areaData.each(function (idx) {
|
|
88446
88940
|
// Layout
|
|
88447
|
-
|
|
88941
|
+
var points = map(dimPermutations, function (dim) {
|
|
88448
88942
|
return getSingleMarkerEndPoint(areaData, idx, dim, seriesModel, api);
|
|
88449
|
-
})
|
|
88943
|
+
});
|
|
88944
|
+
// If none of the area is inside coordSys, allClipped is set to be true
|
|
88945
|
+
// in layout so that label will not be displayed. See #12591
|
|
88946
|
+
var allClipped = true;
|
|
88947
|
+
each$1(dimPermutations, function (dim) {
|
|
88948
|
+
if (!allClipped) {
|
|
88949
|
+
return;
|
|
88950
|
+
}
|
|
88951
|
+
var xValue = areaData.get(dim[0], idx);
|
|
88952
|
+
var yValue = areaData.get(dim[1], idx);
|
|
88953
|
+
// If is infinity, the axis should be considered not clipped
|
|
88954
|
+
if ((isInifinity$1(xValue) || coordSys.getAxis('x').containData(xValue))
|
|
88955
|
+
&& (isInifinity$1(yValue) || coordSys.getAxis('y').containData(yValue))
|
|
88956
|
+
) {
|
|
88957
|
+
allClipped = false;
|
|
88958
|
+
}
|
|
88959
|
+
});
|
|
88960
|
+
areaData.setItemLayout(idx, {
|
|
88961
|
+
points: points,
|
|
88962
|
+
allClipped: allClipped
|
|
88963
|
+
});
|
|
88450
88964
|
|
|
88451
88965
|
// Visual
|
|
88452
88966
|
areaData.setItemVisual(idx, {
|
|
@@ -88457,23 +88971,41 @@ MarkerView.extend({
|
|
|
88457
88971
|
|
|
88458
88972
|
areaData.diff(polygonGroup.__data)
|
|
88459
88973
|
.add(function (idx) {
|
|
88460
|
-
var
|
|
88461
|
-
|
|
88462
|
-
|
|
88463
|
-
|
|
88464
|
-
|
|
88465
|
-
|
|
88466
|
-
|
|
88974
|
+
var layout = areaData.getItemLayout(idx);
|
|
88975
|
+
if (!layout.allClipped) {
|
|
88976
|
+
var polygon = new Polygon({
|
|
88977
|
+
shape: {
|
|
88978
|
+
points: layout.points
|
|
88979
|
+
}
|
|
88980
|
+
});
|
|
88981
|
+
areaData.setItemGraphicEl(idx, polygon);
|
|
88982
|
+
polygonGroup.group.add(polygon);
|
|
88983
|
+
}
|
|
88467
88984
|
})
|
|
88468
88985
|
.update(function (newIdx, oldIdx) {
|
|
88469
88986
|
var polygon = polygonGroup.__data.getItemGraphicEl(oldIdx);
|
|
88470
|
-
|
|
88471
|
-
|
|
88472
|
-
|
|
88987
|
+
var layout = areaData.getItemLayout(newIdx);
|
|
88988
|
+
if (!layout.allClipped) {
|
|
88989
|
+
if (polygon) {
|
|
88990
|
+
updateProps(polygon, {
|
|
88991
|
+
shape: {
|
|
88992
|
+
points: layout.points
|
|
88993
|
+
}
|
|
88994
|
+
}, maModel, newIdx);
|
|
88995
|
+
}
|
|
88996
|
+
else {
|
|
88997
|
+
polygon = new Polygon({
|
|
88998
|
+
shape: {
|
|
88999
|
+
points: layout.points
|
|
89000
|
+
}
|
|
89001
|
+
});
|
|
88473
89002
|
}
|
|
88474
|
-
|
|
88475
|
-
|
|
88476
|
-
|
|
89003
|
+
areaData.setItemGraphicEl(newIdx, polygon);
|
|
89004
|
+
polygonGroup.group.add(polygon);
|
|
89005
|
+
}
|
|
89006
|
+
else if (polygon) {
|
|
89007
|
+
polygonGroup.group.remove(polygon);
|
|
89008
|
+
}
|
|
88477
89009
|
})
|
|
88478
89010
|
.remove(function (idx) {
|
|
88479
89011
|
var polygon = polygonGroup.__data.getItemGraphicEl(idx);
|
|
@@ -90218,7 +90750,7 @@ var ScrollableLegendView = LegendView.extend({
|
|
|
90218
90750
|
var legendDataIdx = child.__legendDataIndex;
|
|
90219
90751
|
// FIXME
|
|
90220
90752
|
// If the given targetDataIndex (from model) is illegal,
|
|
90221
|
-
// we use
|
|
90753
|
+
// we use defaultIndex. But the index on the legend model and
|
|
90222
90754
|
// action payload is still illegal. That case will not be
|
|
90223
90755
|
// changed until some scenario requires.
|
|
90224
90756
|
if (defaultIndex == null && legendDataIdx != null) {
|
|
@@ -92435,7 +92967,7 @@ var VisualMapModel = extendComponentModel({
|
|
|
92435
92967
|
// Originally we use visualMap.color as the default color, but setOption at
|
|
92436
92968
|
// the second time the default color will be erased. So we change to use
|
|
92437
92969
|
// constant DEFAULT_COLOR.
|
|
92438
|
-
// If user do not want the
|
|
92970
|
+
// If user do not want the default color, set inRange: {color: null}.
|
|
92439
92971
|
base.inRange = base.inRange || {color: ecModel.get('gradientColor')};
|
|
92440
92972
|
|
|
92441
92973
|
// If using shortcut like: {inRange: 'symbol'}, complete default value.
|
|
@@ -97234,7 +97766,7 @@ GradientManager.prototype.updateDom = function (gradient, dom) {
|
|
|
97234
97766
|
stop.setAttribute('offset', colors[i].offset * 100 + '%');
|
|
97235
97767
|
|
|
97236
97768
|
var color = colors[i].color;
|
|
97237
|
-
if (color.indexOf('rgba' > -1)
|
|
97769
|
+
if (color.indexOf('rgba') > -1) {
|
|
97238
97770
|
// Fix Safari bug that stop-color not recognizing alpha #9014
|
|
97239
97771
|
var opacity = parse(color)[3];
|
|
97240
97772
|
var hex = toHex(color);
|