echarts 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/echarts-en.common.js +370 -150
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +508 -229
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +312 -123
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +344 -150
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +482 -229
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +286 -123
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/bmap.js +336 -2
- package/dist/extension/bmap.js.map +1 -1
- package/dist/extension/bmap.min.js +1 -1
- package/extension/bmap/BMapView.js +6 -2
- package/extension-src/bmap/BMapView.js +3 -2
- package/lib/chart/bar/BarView.js +20 -5
- package/lib/chart/heatmap/HeatmapView.js +2 -2
- package/lib/chart/helper/EffectSymbol.js +2 -1
- package/lib/chart/helper/LineDraw.js +5 -1
- package/lib/chart/helper/Symbol.js +1 -2
- package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
- package/lib/chart/line/LineView.js +33 -0
- package/lib/chart/map/MapSeries.js +3 -2
- package/lib/chart/pie/PieView.js +20 -13
- package/lib/chart/sankey/sankeyLayout.js +18 -0
- package/lib/chart/sunburst/SunburstPiece.js +1 -0
- package/lib/chart/sunburst/SunburstSeries.js +12 -7
- package/lib/chart/sunburst/SunburstView.js +5 -1
- package/lib/chart/tree/TreeSeries.js +4 -4
- package/lib/chart/treemap/TreemapSeries.js +15 -3
- package/lib/chart/treemap/TreemapView.js +23 -11
- package/lib/component/helper/MapDraw.js +32 -4
- package/lib/component/title.js +6 -2
- package/lib/component/toolbox/ToolboxView.js +1 -1
- package/lib/component/toolbox/feature/MagicType.js +2 -1
- package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
- package/lib/component/tooltip/TooltipView.js +1 -1
- package/lib/component/visualMap/PiecewiseModel.js +3 -6
- package/lib/coord/axisHelper.js +22 -16
- package/lib/coord/calendar/Calendar.js +8 -4
- package/lib/coord/geo/geoJSONLoader.js +3 -2
- package/lib/coord/geo/geoSourceManager.js +3 -2
- package/lib/coord/geo/parseGeoJson.js +3 -2
- package/lib/coord/radar/Radar.js +1 -1
- package/lib/data/Tree.js +8 -19
- package/lib/echarts.js +57 -34
- package/lib/langEN.js +26 -0
- package/lib/loading/default.js +43 -27
- package/lib/model/Series.js +1 -1
- package/lib/util/format.js +19 -2
- package/lib/util/graphic.js +11 -8
- package/lib/visual/symbol.js +12 -2
- package/map/js/province/gansu.js +2 -2
- package/package.json +2 -2
- package/src/chart/bar/BarView.js +16 -3
- package/src/chart/heatmap/HeatmapView.js +2 -2
- package/src/chart/helper/EffectSymbol.js +2 -1
- package/src/chart/helper/LineDraw.js +5 -1
- package/src/chart/helper/Symbol.js +2 -2
- package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
- package/src/chart/line/LineView.js +39 -0
- package/src/chart/map/MapSeries.js +3 -2
- package/src/chart/pie/PieView.js +18 -13
- package/src/chart/sankey/sankeyLayout.js +21 -2
- package/src/chart/sunburst/SunburstPiece.js +2 -0
- package/src/chart/sunburst/SunburstSeries.js +12 -7
- package/src/chart/sunburst/SunburstView.js +2 -1
- package/src/chart/tree/TreeSeries.js +3 -6
- package/src/chart/treemap/TreemapSeries.js +15 -5
- package/src/chart/treemap/TreemapView.js +20 -14
- package/src/component/helper/MapDraw.js +26 -3
- package/src/component/title.js +3 -2
- package/src/component/toolbox/ToolboxView.js +1 -1
- package/src/component/toolbox/feature/MagicType.js +2 -1
- package/src/component/toolbox/feature/SaveAsImage.js +2 -1
- package/src/component/tooltip/TooltipView.js +1 -1
- package/src/component/visualMap/PiecewiseModel.js +5 -9
- package/src/coord/axisHelper.js +26 -19
- package/src/coord/calendar/Calendar.js +12 -5
- package/src/coord/geo/geoJSONLoader.js +3 -2
- package/src/coord/geo/geoSourceManager.js +3 -2
- package/src/coord/geo/parseGeoJson.js +3 -2
- package/src/coord/radar/Radar.js +1 -1
- package/src/data/Tree.js +11 -18
- package/src/echarts.js +60 -36
- package/src/langEN.js +26 -0
- package/src/layout/barGrid.js +4 -2
- package/src/loading/default.js +46 -34
- package/src/model/Series.js +1 -1
- package/src/util/format.js +17 -1
- package/src/util/graphic.js +10 -7
- package/src/visual/symbol.js +11 -2
|
@@ -166,8 +166,8 @@ var _default = echarts.extendChartView({
|
|
|
166
166
|
var point = coordSys.dataToPoint([data.get(dataDims[0], idx), data.get(dataDims[1], idx)]);
|
|
167
167
|
rect = new graphic.Rect({
|
|
168
168
|
shape: {
|
|
169
|
-
x: Math.floor(point[0] - width / 2),
|
|
170
|
-
y: Math.floor(point[1] - height / 2),
|
|
169
|
+
x: Math.floor(Math.round(point[0]) - width / 2),
|
|
170
|
+
y: Math.floor(Math.round(point[1]) - height / 2),
|
|
171
171
|
width: Math.ceil(width),
|
|
172
172
|
height: Math.ceil(height)
|
|
173
173
|
},
|
|
@@ -207,7 +207,8 @@ effectSymbolProto.updateData = function (data, idx) {
|
|
|
207
207
|
pos[1] = parsePercent(symbolOffset[1], symbolSize[1]);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
|
|
211
|
+
rippleGroup.rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
|
|
211
212
|
var effectCfg = {};
|
|
212
213
|
effectCfg.showEffectOn = seriesModel.get('showEffectOn');
|
|
213
214
|
effectCfg.rippleScale = itemModel.get('rippleEffect.scale');
|
|
@@ -134,9 +134,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
|
|
|
134
134
|
this.group.removeAll();
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
+
function isEffectObject(el) {
|
|
138
|
+
return el.animators && el.animators.length > 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
137
141
|
lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
|
|
138
142
|
function updateIncrementalAndHover(el) {
|
|
139
|
-
if (!el.isGroup) {
|
|
143
|
+
if (!el.isGroup && !isEffectObject(el)) {
|
|
140
144
|
el.incremental = el.useHoverLayer = true;
|
|
141
145
|
}
|
|
142
146
|
}
|
|
@@ -267,7 +267,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
|
|
|
267
267
|
|
|
268
268
|
var itemStyle = seriesScope && seriesScope.itemStyle;
|
|
269
269
|
var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
|
|
270
|
-
var symbolRotate = seriesScope && seriesScope.symbolRotate;
|
|
271
270
|
var symbolOffset = seriesScope && seriesScope.symbolOffset;
|
|
272
271
|
var labelModel = seriesScope && seriesScope.labelModel;
|
|
273
272
|
var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
|
|
@@ -280,7 +279,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
|
|
|
280
279
|
|
|
281
280
|
itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
|
|
282
281
|
hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
|
|
283
|
-
symbolRotate = itemModel.getShallow('symbolRotate');
|
|
284
282
|
symbolOffset = itemModel.getShallow('symbolOffset');
|
|
285
283
|
labelModel = itemModel.getModel(normalLabelAccessPath);
|
|
286
284
|
hoverLabelModel = itemModel.getModel(emphasisLabelAccessPath);
|
|
@@ -291,6 +289,7 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
|
|
|
291
289
|
}
|
|
292
290
|
|
|
293
291
|
var elStyle = symbolPath.style;
|
|
292
|
+
var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
|
|
294
293
|
symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
|
|
295
294
|
|
|
296
295
|
if (symbolOffset) {
|
|
@@ -54,7 +54,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
|
|
|
54
54
|
x -= lineWidth / 2;
|
|
55
55
|
y -= lineWidth / 2;
|
|
56
56
|
width += lineWidth;
|
|
57
|
-
height += lineWidth;
|
|
57
|
+
height += lineWidth; // fix: https://github.com/apache/incubator-echarts/issues/11369
|
|
58
|
+
|
|
59
|
+
x = Math.floor(x);
|
|
60
|
+
width = Math.round(width);
|
|
58
61
|
var clipPath = new graphic.Rect({
|
|
59
62
|
shape: {
|
|
60
63
|
x: x,
|
|
@@ -24,6 +24,10 @@ var __DEV__ = _config.__DEV__;
|
|
|
24
24
|
|
|
25
25
|
var zrUtil = require("zrender/lib/core/util");
|
|
26
26
|
|
|
27
|
+
var _bbox = require("zrender/lib/core/bbox");
|
|
28
|
+
|
|
29
|
+
var fromPoints = _bbox.fromPoints;
|
|
30
|
+
|
|
27
31
|
var SymbolDraw = require("../helper/SymbolDraw");
|
|
28
32
|
|
|
29
33
|
var SymbolClz = require("../helper/Symbol");
|
|
@@ -87,6 +91,17 @@ function isPointsSame(points1, points2) {
|
|
|
87
91
|
return true;
|
|
88
92
|
}
|
|
89
93
|
|
|
94
|
+
function getBoundingDiff(points1, points2) {
|
|
95
|
+
var min1 = [];
|
|
96
|
+
var max1 = [];
|
|
97
|
+
var min2 = [];
|
|
98
|
+
var max2 = [];
|
|
99
|
+
fromPoints(points1, min1, max1);
|
|
100
|
+
fromPoints(points2, min2, max2); // Get a max value from each corner of two boundings.
|
|
101
|
+
|
|
102
|
+
return Math.max(Math.abs(min1[0] - min2[0]), Math.abs(min1[1] - min2[1]), Math.abs(max1[0] - max2[0]), Math.abs(max1[1] - max2[1]));
|
|
103
|
+
}
|
|
104
|
+
|
|
90
105
|
function getSmooth(smooth) {
|
|
91
106
|
return typeof smooth === 'number' ? smooth : smooth ? 0.5 : 0;
|
|
92
107
|
}
|
|
@@ -630,6 +645,24 @@ var _default = ChartView.extend({
|
|
|
630
645
|
stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step);
|
|
631
646
|
next = turnPointsIntoStep(diff.next, coordSys, step);
|
|
632
647
|
stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
|
|
648
|
+
} // Don't apply animation if diff is large.
|
|
649
|
+
// For better result and avoid memory explosion problems like
|
|
650
|
+
// https://github.com/apache/incubator-echarts/issues/12229
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
if (getBoundingDiff(current, next) > 3000 || polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000) {
|
|
654
|
+
polyline.setShape({
|
|
655
|
+
points: next
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
if (polygon) {
|
|
659
|
+
polygon.setShape({
|
|
660
|
+
points: next,
|
|
661
|
+
stackedOnPoints: stackedOnNext
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
return;
|
|
633
666
|
} // `diff.current` is subset of `current` (which should be ensured by
|
|
634
667
|
// turnPointsIntoStep), so points in `__points` can be updated when
|
|
635
668
|
// points in `current` are update during animation.
|
|
@@ -95,7 +95,7 @@ var MapSeries = SeriesModel.extend({
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap);
|
|
98
|
+
var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty);
|
|
99
99
|
zrUtil.each(geoSource.regions, function (region) {
|
|
100
100
|
var name = region.name;
|
|
101
101
|
|
|
@@ -256,7 +256,8 @@ var MapSeries = SeriesModel.extend({
|
|
|
256
256
|
itemStyle: {
|
|
257
257
|
areaColor: 'rgba(255,215,0,0.8)'
|
|
258
258
|
}
|
|
259
|
-
}
|
|
259
|
+
},
|
|
260
|
+
nameProperty: 'name'
|
|
260
261
|
}
|
|
261
262
|
});
|
|
262
263
|
zrUtil.mixin(MapSeries, dataSelectableMixin);
|
package/lib/chart/pie/PieView.js
CHANGED
|
@@ -165,27 +165,34 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
|
|
|
165
165
|
|
|
166
166
|
this._updateLabel(data, idx, withAnimation);
|
|
167
167
|
|
|
168
|
-
this.highDownOnUpdate =
|
|
168
|
+
this.highDownOnUpdate = !seriesModel.get('silent') ? function (fromState, toState) {
|
|
169
|
+
var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
|
|
170
|
+
|
|
169
171
|
if (toState === 'emphasis') {
|
|
170
172
|
labelLine.ignore = labelLine.hoverIgnore;
|
|
171
173
|
labelText.ignore = labelText.hoverIgnore; // Sector may has animation of updating data. Force to move to the last frame
|
|
172
174
|
// Or it may stopped on the wrong shape
|
|
173
175
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
if (hasAnimation) {
|
|
177
|
+
sector.stopAnimation(true);
|
|
178
|
+
sector.animateTo({
|
|
179
|
+
shape: {
|
|
180
|
+
r: layout.r + seriesModel.get('hoverOffset')
|
|
181
|
+
}
|
|
182
|
+
}, 300, 'elasticOut');
|
|
183
|
+
}
|
|
180
184
|
} else {
|
|
181
185
|
labelLine.ignore = labelLine.normalIgnore;
|
|
182
186
|
labelText.ignore = labelText.normalIgnore;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
|
|
188
|
+
if (hasAnimation) {
|
|
189
|
+
sector.stopAnimation(true);
|
|
190
|
+
sector.animateTo({
|
|
191
|
+
shape: {
|
|
192
|
+
r: layout.r
|
|
193
|
+
}
|
|
194
|
+
}, 300, 'elasticOut');
|
|
195
|
+
}
|
|
189
196
|
}
|
|
190
197
|
} : null;
|
|
191
198
|
graphic.setHoverStyle(this);
|
|
@@ -457,6 +457,11 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
|
|
|
457
457
|
if (node.outEdges.length) {
|
|
458
458
|
var y = sum(node.outEdges, weightedTarget, orient) / sum(node.outEdges, getEdgeValue, orient);
|
|
459
459
|
|
|
460
|
+
if (isNaN(y)) {
|
|
461
|
+
var len = node.outEdges.length;
|
|
462
|
+
y = len ? sum(node.outEdges, centerTarget, orient) / len : 0;
|
|
463
|
+
}
|
|
464
|
+
|
|
460
465
|
if (orient === 'vertical') {
|
|
461
466
|
var nodeX = node.getLayout().x + (y - center(node, orient)) * alpha;
|
|
462
467
|
node.setLayout({
|
|
@@ -477,10 +482,18 @@ function weightedTarget(edge, orient) {
|
|
|
477
482
|
return center(edge.node2, orient) * edge.getValue();
|
|
478
483
|
}
|
|
479
484
|
|
|
485
|
+
function centerTarget(edge, orient) {
|
|
486
|
+
return center(edge.node2, orient);
|
|
487
|
+
}
|
|
488
|
+
|
|
480
489
|
function weightedSource(edge, orient) {
|
|
481
490
|
return center(edge.node1, orient) * edge.getValue();
|
|
482
491
|
}
|
|
483
492
|
|
|
493
|
+
function centerSource(edge, orient) {
|
|
494
|
+
return center(edge.node1, orient);
|
|
495
|
+
}
|
|
496
|
+
|
|
484
497
|
function center(node, orient) {
|
|
485
498
|
return orient === 'vertical' ? node.getLayout().x + node.getLayout().dx / 2 : node.getLayout().y + node.getLayout().dy / 2;
|
|
486
499
|
}
|
|
@@ -519,6 +532,11 @@ function relaxLeftToRight(nodesByBreadth, alpha, orient) {
|
|
|
519
532
|
if (node.inEdges.length) {
|
|
520
533
|
var y = sum(node.inEdges, weightedSource, orient) / sum(node.inEdges, getEdgeValue, orient);
|
|
521
534
|
|
|
535
|
+
if (isNaN(y)) {
|
|
536
|
+
var len = node.inEdges.length;
|
|
537
|
+
y = len ? sum(node.inEdges, centerSource, orient) / len : 0;
|
|
538
|
+
}
|
|
539
|
+
|
|
522
540
|
if (orient === 'vertical') {
|
|
523
541
|
var nodeX = node.getLayout().x + (y - center(node, orient)) * alpha;
|
|
524
542
|
node.setLayout({
|
|
@@ -149,6 +149,7 @@ SunburstPieceProto.updateData = function (firstCreate, node, state, seriesModel,
|
|
|
149
149
|
|
|
150
150
|
this._seriesModel = seriesModel || this._seriesModel;
|
|
151
151
|
this._ecModel = ecModel || this._ecModel;
|
|
152
|
+
graphic.setHoverStyle(this);
|
|
152
153
|
};
|
|
153
154
|
|
|
154
155
|
SunburstPieceProto.onEmphasis = function (highlightPolicy) {
|
|
@@ -113,8 +113,7 @@ var _default = SeriesModel.extend({
|
|
|
113
113
|
align: 'center',
|
|
114
114
|
position: 'inside',
|
|
115
115
|
distance: 5,
|
|
116
|
-
silent: true
|
|
117
|
-
emphasis: {}
|
|
116
|
+
silent: true
|
|
118
117
|
},
|
|
119
118
|
itemStyle: {
|
|
120
119
|
borderWidth: 1,
|
|
@@ -124,13 +123,19 @@ var _default = SeriesModel.extend({
|
|
|
124
123
|
shadowColor: 'rgba(0, 0, 0, 0.2)',
|
|
125
124
|
shadowOffsetX: 0,
|
|
126
125
|
shadowOffsetY: 0,
|
|
127
|
-
opacity: 1
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
opacity: 1
|
|
127
|
+
},
|
|
128
|
+
highlight: {
|
|
129
|
+
itemStyle: {
|
|
130
130
|
opacity: 1
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
downplay: {
|
|
134
|
+
itemStyle: {
|
|
135
|
+
opacity: 0.5
|
|
131
136
|
},
|
|
132
|
-
|
|
133
|
-
opacity: 0.
|
|
137
|
+
label: {
|
|
138
|
+
opacity: 0.6
|
|
134
139
|
}
|
|
135
140
|
},
|
|
136
141
|
// Animation type canbe expansion, scale
|
|
@@ -26,6 +26,10 @@ var SunburstPiece = require("./SunburstPiece");
|
|
|
26
26
|
|
|
27
27
|
var DataDiffer = require("../../data/DataDiffer");
|
|
28
28
|
|
|
29
|
+
var _format = require("../../util/format");
|
|
30
|
+
|
|
31
|
+
var windowOpen = _format.windowOpen;
|
|
32
|
+
|
|
29
33
|
/*
|
|
30
34
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
31
35
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -193,7 +197,7 @@ var SunburstView = ChartView.extend({
|
|
|
193
197
|
|
|
194
198
|
if (link) {
|
|
195
199
|
var linkTarget = itemModel.get('target', true) || '_blank';
|
|
196
|
-
|
|
200
|
+
windowOpen(link, linkTarget);
|
|
197
201
|
}
|
|
198
202
|
}
|
|
199
203
|
|
|
@@ -26,6 +26,8 @@ var _format = require("../../util/format");
|
|
|
26
26
|
|
|
27
27
|
var encodeHTML = _format.encodeHTML;
|
|
28
28
|
|
|
29
|
+
var Model = require("../../model/Model");
|
|
30
|
+
|
|
29
31
|
/*
|
|
30
32
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
31
33
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -63,14 +65,12 @@ var _default = SeriesModel.extend({
|
|
|
63
65
|
children: option.data
|
|
64
66
|
};
|
|
65
67
|
var leaves = option.leaves || {};
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
var tree = Tree.createTree(root, this, treeOption, beforeLink);
|
|
68
|
+
var leavesModel = new Model(leaves, this, this.ecModel);
|
|
69
|
+
var tree = Tree.createTree(root, this, {}, beforeLink);
|
|
69
70
|
|
|
70
71
|
function beforeLink(nodeData) {
|
|
71
72
|
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
72
73
|
var node = tree.getNodeByDataIndex(idx);
|
|
73
|
-
var leavesModel = node.getLeavesModel();
|
|
74
74
|
|
|
75
75
|
if (!node.children.length || !node.isExpand) {
|
|
76
76
|
model.parentModel = leavesModel;
|
|
@@ -228,12 +228,24 @@ var _default = SeriesModel.extend({
|
|
|
228
228
|
completeTreeValue(root);
|
|
229
229
|
var levels = option.levels || [];
|
|
230
230
|
levels = option.levels = setDefault(levels, ecModel);
|
|
231
|
-
var
|
|
232
|
-
|
|
231
|
+
var levelModels = zrUtil.map(levels || [], function (levelDefine) {
|
|
232
|
+
return new Model(levelDefine, this, ecModel);
|
|
233
|
+
}, this); // Make sure always a new tree is created when setOption,
|
|
233
234
|
// in TreemapView, we check whether oldTree === newTree
|
|
234
235
|
// to choose mappings approach among old shapes and new shapes.
|
|
235
236
|
|
|
236
|
-
|
|
237
|
+
var tree = Tree.createTree(root, this, null, beforeLink);
|
|
238
|
+
|
|
239
|
+
function beforeLink(nodeData) {
|
|
240
|
+
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
241
|
+
var node = tree.getNodeByDataIndex(idx);
|
|
242
|
+
var levelModel = levelModels[node.depth];
|
|
243
|
+
levelModel && (model.parentModel = levelModel);
|
|
244
|
+
return model;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return tree.data;
|
|
237
249
|
},
|
|
238
250
|
optionUpdated: function () {
|
|
239
251
|
this.resetViewRoot();
|
|
@@ -40,6 +40,10 @@ var animationUtil = require("../../util/animation");
|
|
|
40
40
|
|
|
41
41
|
var makeStyleMapper = require("../../model/mixin/makeStyleMapper");
|
|
42
42
|
|
|
43
|
+
var _format = require("../../util/format");
|
|
44
|
+
|
|
45
|
+
var windowOpen = _format.windowOpen;
|
|
46
|
+
|
|
43
47
|
/*
|
|
44
48
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
45
49
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -529,7 +533,7 @@ var _default = echarts.extendChartView({
|
|
|
529
533
|
var itemModel = node.hostTree.data.getItemModel(node.dataIndex);
|
|
530
534
|
var link = itemModel.get('link', true);
|
|
531
535
|
var linkTarget = itemModel.get('target', true) || 'blank';
|
|
532
|
-
link &&
|
|
536
|
+
link && windowOpen(link, linkTarget);
|
|
533
537
|
}
|
|
534
538
|
}
|
|
535
539
|
}, this);
|
|
@@ -715,7 +719,7 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
715
719
|
var nodeModel = thisNode.getModel(); // Background
|
|
716
720
|
|
|
717
721
|
var bg = giveGraphic('background', Rect, depth, Z_BG);
|
|
718
|
-
bg && renderBackground(group, bg, isParent && thisLayout.
|
|
722
|
+
bg && renderBackground(group, bg, isParent && thisLayout.upperLabelHeight); // No children, render content.
|
|
719
723
|
|
|
720
724
|
if (isParent) {
|
|
721
725
|
// Because of the implementation about "traverse" in graphic hover style, we
|
|
@@ -832,21 +836,20 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
832
836
|
}
|
|
833
837
|
|
|
834
838
|
function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
|
|
835
|
-
var
|
|
836
|
-
|
|
837
|
-
if (!upperLabelRect && thisLayout.isLeafRoot) {
|
|
838
|
-
var iconChar = seriesModel.get('drillDownIcon', true);
|
|
839
|
-
text = iconChar ? iconChar + ' ' + text : text;
|
|
840
|
-
}
|
|
841
|
-
|
|
839
|
+
var defaultText = nodeModel.get('name');
|
|
842
840
|
var normalLabelModel = nodeModel.getModel(upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL);
|
|
843
841
|
var emphasisLabelModel = nodeModel.getModel(upperLabelRect ? PATH_UPPERLABEL_EMPHASIS : PATH_LABEL_EMPHASIS);
|
|
844
842
|
var isShow = normalLabelModel.getShallow('show');
|
|
845
843
|
graphic.setLabelStyle(normalStyle, emphasisStyle, normalLabelModel, emphasisLabelModel, {
|
|
846
|
-
defaultText: isShow ?
|
|
844
|
+
defaultText: isShow ? defaultText : null,
|
|
847
845
|
autoColor: visualColor,
|
|
848
|
-
isRectText: true
|
|
846
|
+
isRectText: true,
|
|
847
|
+
labelFetcher: seriesModel,
|
|
848
|
+
labelDataIndex: thisNode.dataIndex,
|
|
849
|
+
labelProp: upperLabelRect ? 'upperLabel' : 'label'
|
|
849
850
|
});
|
|
851
|
+
addDrillDownIcon(normalStyle, upperLabelRect, thisLayout);
|
|
852
|
+
addDrillDownIcon(emphasisStyle, upperLabelRect, thisLayout);
|
|
850
853
|
upperLabelRect && (normalStyle.textRect = zrUtil.clone(upperLabelRect));
|
|
851
854
|
normalStyle.truncate = isShow && normalLabelModel.get('ellipsis') ? {
|
|
852
855
|
outerWidth: width,
|
|
@@ -855,6 +858,15 @@ function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimat
|
|
|
855
858
|
} : null;
|
|
856
859
|
}
|
|
857
860
|
|
|
861
|
+
function addDrillDownIcon(style, upperLabelRect, thisLayout) {
|
|
862
|
+
var text = style.text;
|
|
863
|
+
|
|
864
|
+
if (!upperLabelRect && thisLayout.isLeafRoot && text != null) {
|
|
865
|
+
var iconChar = seriesModel.get('drillDownIcon', true);
|
|
866
|
+
style.text = iconChar ? iconChar + ' ' + text : text;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
858
870
|
function giveGraphic(storageName, Ctor, depth, z) {
|
|
859
871
|
var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex];
|
|
860
872
|
var lasts = lastsForAnimation[storageName];
|
|
@@ -36,6 +36,8 @@ var _component = require("../../util/component");
|
|
|
36
36
|
|
|
37
37
|
var getUID = _component.getUID;
|
|
38
38
|
|
|
39
|
+
var Transformable = require("zrender/lib/mixin/Transformable");
|
|
40
|
+
|
|
39
41
|
/*
|
|
40
42
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
41
43
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -206,10 +208,27 @@ MapDraw.prototype = {
|
|
|
206
208
|
|
|
207
209
|
var regionsGroup = this._regionsGroup;
|
|
208
210
|
var group = this.group;
|
|
209
|
-
var transformInfo = geo.getTransformInfo();
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
var transformInfo = geo.getTransformInfo(); // No animation when first draw or in action
|
|
212
|
+
|
|
213
|
+
var isFirstDraw = !regionsGroup.childAt(0) || payload;
|
|
214
|
+
var targetScale;
|
|
215
|
+
|
|
216
|
+
if (isFirstDraw) {
|
|
217
|
+
group.transform = transformInfo.roamTransform;
|
|
218
|
+
group.decomposeTransform();
|
|
219
|
+
group.dirty();
|
|
220
|
+
} else {
|
|
221
|
+
var target = new Transformable();
|
|
222
|
+
target.transform = transformInfo.roamTransform;
|
|
223
|
+
target.decomposeTransform();
|
|
224
|
+
var props = {
|
|
225
|
+
scale: target.scale,
|
|
226
|
+
position: target.position
|
|
227
|
+
};
|
|
228
|
+
targetScale = target.scale;
|
|
229
|
+
graphic.updateProps(group, props, mapOrGeoModel);
|
|
230
|
+
}
|
|
231
|
+
|
|
213
232
|
var scale = transformInfo.rawScale;
|
|
214
233
|
var position = transformInfo.rawPosition;
|
|
215
234
|
regionsGroup.removeAll();
|
|
@@ -331,6 +350,15 @@ MapDraw.prototype = {
|
|
|
331
350
|
textAlign: 'center',
|
|
332
351
|
textVerticalAlign: 'middle'
|
|
333
352
|
});
|
|
353
|
+
|
|
354
|
+
if (!isFirstDraw) {
|
|
355
|
+
// Text animation
|
|
356
|
+
var textScale = [1 / targetScale[0], 1 / targetScale[1]];
|
|
357
|
+
graphic.updateProps(textEl, {
|
|
358
|
+
scale: textScale
|
|
359
|
+
}, mapOrGeoModel);
|
|
360
|
+
}
|
|
361
|
+
|
|
334
362
|
regionGroup.add(textEl);
|
|
335
363
|
} // setItemGraphicEl, setHoverStyle after all polygons and labels
|
|
336
364
|
// are added to the rigionGroup
|
package/lib/component/title.js
CHANGED
|
@@ -28,6 +28,10 @@ var _layout = require("../util/layout");
|
|
|
28
28
|
|
|
29
29
|
var getLayoutRect = _layout.getLayoutRect;
|
|
30
30
|
|
|
31
|
+
var _format = require("../util/format");
|
|
32
|
+
|
|
33
|
+
var windowOpen = _format.windowOpen;
|
|
34
|
+
|
|
31
35
|
/*
|
|
32
36
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
33
37
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -150,13 +154,13 @@ echarts.extendComponentView({
|
|
|
150
154
|
|
|
151
155
|
if (link) {
|
|
152
156
|
textEl.on('click', function () {
|
|
153
|
-
|
|
157
|
+
windowOpen(link, '_' + titleModel.get('target'));
|
|
154
158
|
});
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
if (sublink) {
|
|
158
162
|
subTextEl.on('click', function () {
|
|
159
|
-
|
|
163
|
+
windowOpen(link, '_' + titleModel.get('subtarget'));
|
|
160
164
|
});
|
|
161
165
|
}
|
|
162
166
|
|
|
@@ -80,7 +80,7 @@ var _default = echarts.extendComponentView({
|
|
|
80
80
|
var featureModel = new Model(featureOpt, toolboxModel, toolboxModel.ecModel);
|
|
81
81
|
var feature; // FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
|
|
82
82
|
|
|
83
|
-
if (payload && payload.newTitle != null) {
|
|
83
|
+
if (payload && payload.newTitle != null && payload.featureName === featureName) {
|
|
84
84
|
featureOpt.title = payload.newTitle;
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -69,7 +69,8 @@ var proto = SaveAsImage.prototype;
|
|
|
69
69
|
proto.onclick = function (ecModel, api) {
|
|
70
70
|
var model = this.model;
|
|
71
71
|
var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
|
|
72
|
-
var
|
|
72
|
+
var isSvg = api.getZr().painter.getType() === 'svg';
|
|
73
|
+
var type = isSvg ? 'svg' : model.get('type', true) || 'png';
|
|
73
74
|
var url = api.getConnectedDataURL({
|
|
74
75
|
type: type,
|
|
75
76
|
backgroundColor: model.get('backgroundColor', true) || ecModel.get('backgroundColor') || '#fff',
|
|
@@ -451,7 +451,7 @@ var _default = echarts.extendComponentView({
|
|
|
451
451
|
var dataModel = el.dataModel || seriesModel;
|
|
452
452
|
var dataIndex = el.dataIndex;
|
|
453
453
|
var dataType = el.dataType;
|
|
454
|
-
var data = dataModel.getData();
|
|
454
|
+
var data = dataModel.getData(dataType);
|
|
455
455
|
var tooltipModel = buildTooltipModel([data.getItemModel(dataIndex), dataModel, seriesModel && (seriesModel.coordinateSystem || {}).model, this._tooltipModel]);
|
|
456
456
|
var tooltipTrigger = tooltipModel.get('trigger');
|
|
457
457
|
|
|
@@ -417,20 +417,17 @@ var resetMethods = {
|
|
|
417
417
|
|
|
418
418
|
thisOption.precision = precision;
|
|
419
419
|
splitStep = +splitStep.toFixed(precision);
|
|
420
|
-
var index = 0;
|
|
421
420
|
|
|
422
421
|
if (thisOption.minOpen) {
|
|
423
422
|
pieceList.push({
|
|
424
|
-
index: index++,
|
|
425
423
|
interval: [-Infinity, dataExtent[0]],
|
|
426
424
|
close: [0, 0]
|
|
427
425
|
});
|
|
428
426
|
}
|
|
429
427
|
|
|
430
|
-
for (var
|
|
428
|
+
for (var index = 0, curr = dataExtent[0]; index < splitNumber; curr += splitStep, index++) {
|
|
431
429
|
var max = index === splitNumber - 1 ? dataExtent[1] : curr + splitStep;
|
|
432
430
|
pieceList.push({
|
|
433
|
-
index: index++,
|
|
434
431
|
interval: [curr, max],
|
|
435
432
|
close: [1, 1]
|
|
436
433
|
});
|
|
@@ -438,14 +435,14 @@ var resetMethods = {
|
|
|
438
435
|
|
|
439
436
|
if (thisOption.maxOpen) {
|
|
440
437
|
pieceList.push({
|
|
441
|
-
index: index++,
|
|
442
438
|
interval: [dataExtent[1], Infinity],
|
|
443
439
|
close: [0, 0]
|
|
444
440
|
});
|
|
445
441
|
}
|
|
446
442
|
|
|
447
443
|
reformIntervals(pieceList);
|
|
448
|
-
zrUtil.each(pieceList, function (piece) {
|
|
444
|
+
zrUtil.each(pieceList, function (piece, index) {
|
|
445
|
+
piece.index = index;
|
|
449
446
|
piece.text = this.formatValueText(piece.interval);
|
|
450
447
|
}, this);
|
|
451
448
|
},
|