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
|
@@ -105,8 +105,7 @@ export default SeriesModel.extend({
|
|
|
105
105
|
align: 'center',
|
|
106
106
|
position: 'inside',
|
|
107
107
|
distance: 5,
|
|
108
|
-
silent: true
|
|
109
|
-
emphasis: {}
|
|
108
|
+
silent: true
|
|
110
109
|
},
|
|
111
110
|
itemStyle: {
|
|
112
111
|
borderWidth: 1,
|
|
@@ -116,13 +115,19 @@ export default SeriesModel.extend({
|
|
|
116
115
|
shadowColor: 'rgba(0, 0, 0, 0.2)',
|
|
117
116
|
shadowOffsetX: 0,
|
|
118
117
|
shadowOffsetY: 0,
|
|
119
|
-
opacity: 1
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
opacity: 1
|
|
119
|
+
},
|
|
120
|
+
highlight: {
|
|
121
|
+
itemStyle: {
|
|
122
122
|
opacity: 1
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
downplay: {
|
|
126
|
+
itemStyle: {
|
|
127
|
+
opacity: 0.5
|
|
123
128
|
},
|
|
124
|
-
|
|
125
|
-
opacity: 0.
|
|
129
|
+
label: {
|
|
130
|
+
opacity: 0.6
|
|
126
131
|
}
|
|
127
132
|
},
|
|
128
133
|
|
|
@@ -21,6 +21,7 @@ import * as zrUtil from 'zrender/src/core/util';
|
|
|
21
21
|
import ChartView from '../../view/Chart';
|
|
22
22
|
import SunburstPiece from './SunburstPiece';
|
|
23
23
|
import DataDiffer from '../../data/DataDiffer';
|
|
24
|
+
import {windowOpen} from '../../util/format';
|
|
24
25
|
|
|
25
26
|
var ROOT_TO_NODE_ACTION = 'sunburstRootToNode';
|
|
26
27
|
|
|
@@ -206,7 +207,7 @@ var SunburstView = ChartView.extend({
|
|
|
206
207
|
if (link) {
|
|
207
208
|
var linkTarget = itemModel.get('target', true)
|
|
208
209
|
|| '_blank';
|
|
209
|
-
|
|
210
|
+
windowOpen(link, linkTarget);
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
targetFound = true;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import SeriesModel from '../../model/Series';
|
|
21
21
|
import Tree from '../../data/Tree';
|
|
22
22
|
import {encodeHTML} from '../../util/format';
|
|
23
|
+
import Model from '../../model/Model';
|
|
23
24
|
|
|
24
25
|
export default SeriesModel.extend({
|
|
25
26
|
|
|
@@ -42,17 +43,13 @@ export default SeriesModel.extend({
|
|
|
42
43
|
var root = {name: option.name, children: option.data};
|
|
43
44
|
|
|
44
45
|
var leaves = option.leaves || {};
|
|
46
|
+
var leavesModel = new Model(leaves, this, this.ecModel);
|
|
45
47
|
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
treeOption.leaves = leaves;
|
|
49
|
-
|
|
50
|
-
var tree = Tree.createTree(root, this, treeOption, beforeLink);
|
|
48
|
+
var tree = Tree.createTree(root, this, {}, beforeLink);
|
|
51
49
|
|
|
52
50
|
function beforeLink(nodeData) {
|
|
53
51
|
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
54
52
|
var node = tree.getNodeByDataIndex(idx);
|
|
55
|
-
var leavesModel = node.getLeavesModel();
|
|
56
53
|
if (!node.children.length || !node.isExpand) {
|
|
57
54
|
model.parentModel = leavesModel;
|
|
58
55
|
}
|
|
@@ -183,15 +183,25 @@ export default SeriesModel.extend({
|
|
|
183
183
|
var levels = option.levels || [];
|
|
184
184
|
|
|
185
185
|
levels = option.levels = setDefault(levels, ecModel);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
treeOption.levels = levels;
|
|
186
|
+
var levelModels = zrUtil.map(levels || [], function (levelDefine) {
|
|
187
|
+
return new Model(levelDefine, this, ecModel);
|
|
188
|
+
}, this);
|
|
190
189
|
|
|
191
190
|
// Make sure always a new tree is created when setOption,
|
|
192
191
|
// in TreemapView, we check whether oldTree === newTree
|
|
193
192
|
// to choose mappings approach among old shapes and new shapes.
|
|
194
|
-
|
|
193
|
+
var tree = Tree.createTree(root, this, null, beforeLink);
|
|
194
|
+
|
|
195
|
+
function beforeLink(nodeData) {
|
|
196
|
+
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
197
|
+
var node = tree.getNodeByDataIndex(idx);
|
|
198
|
+
var levelModel = levelModels[node.depth];
|
|
199
|
+
levelModel && (model.parentModel = levelModel);
|
|
200
|
+
return model;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return tree.data;
|
|
195
205
|
},
|
|
196
206
|
|
|
197
207
|
optionUpdated: function () {
|
|
@@ -28,6 +28,7 @@ import BoundingRect from 'zrender/src/core/BoundingRect';
|
|
|
28
28
|
import * as matrix from 'zrender/src/core/matrix';
|
|
29
29
|
import * as animationUtil from '../../util/animation';
|
|
30
30
|
import makeStyleMapper from '../../model/mixin/makeStyleMapper';
|
|
31
|
+
import {windowOpen} from '../../util/format';
|
|
31
32
|
|
|
32
33
|
var bind = zrUtil.bind;
|
|
33
34
|
var Group = graphic.Group;
|
|
@@ -544,7 +545,7 @@ export default echarts.extendChartView({
|
|
|
544
545
|
var itemModel = node.hostTree.data.getItemModel(node.dataIndex);
|
|
545
546
|
var link = itemModel.get('link', true);
|
|
546
547
|
var linkTarget = itemModel.get('target', true) || 'blank';
|
|
547
|
-
link &&
|
|
548
|
+
link && windowOpen(link, linkTarget);
|
|
548
549
|
}
|
|
549
550
|
}
|
|
550
551
|
|
|
@@ -734,7 +735,7 @@ function renderNode(
|
|
|
734
735
|
|
|
735
736
|
// Background
|
|
736
737
|
var bg = giveGraphic('background', Rect, depth, Z_BG);
|
|
737
|
-
bg && renderBackground(group, bg, isParent && thisLayout.
|
|
738
|
+
bg && renderBackground(group, bg, isParent && thisLayout.upperLabelHeight);
|
|
738
739
|
|
|
739
740
|
// No children, render content.
|
|
740
741
|
if (isParent) {
|
|
@@ -855,16 +856,7 @@ function renderNode(
|
|
|
855
856
|
}
|
|
856
857
|
|
|
857
858
|
function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
|
|
858
|
-
var
|
|
859
|
-
seriesModel.getFormattedLabel(
|
|
860
|
-
thisNode.dataIndex, 'normal', null, null, upperLabelRect ? 'upperLabel' : 'label'
|
|
861
|
-
),
|
|
862
|
-
nodeModel.get('name')
|
|
863
|
-
);
|
|
864
|
-
if (!upperLabelRect && thisLayout.isLeafRoot) {
|
|
865
|
-
var iconChar = seriesModel.get('drillDownIcon', true);
|
|
866
|
-
text = iconChar ? iconChar + ' ' + text : text;
|
|
867
|
-
}
|
|
859
|
+
var defaultText = nodeModel.get('name');
|
|
868
860
|
|
|
869
861
|
var normalLabelModel = nodeModel.getModel(
|
|
870
862
|
upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL
|
|
@@ -878,12 +870,18 @@ function renderNode(
|
|
|
878
870
|
graphic.setLabelStyle(
|
|
879
871
|
normalStyle, emphasisStyle, normalLabelModel, emphasisLabelModel,
|
|
880
872
|
{
|
|
881
|
-
defaultText: isShow ?
|
|
873
|
+
defaultText: isShow ? defaultText : null,
|
|
882
874
|
autoColor: visualColor,
|
|
883
|
-
isRectText: true
|
|
875
|
+
isRectText: true,
|
|
876
|
+
labelFetcher: seriesModel,
|
|
877
|
+
labelDataIndex: thisNode.dataIndex,
|
|
878
|
+
labelProp: upperLabelRect ? 'upperLabel' : 'label'
|
|
884
879
|
}
|
|
885
880
|
);
|
|
886
881
|
|
|
882
|
+
addDrillDownIcon(normalStyle, upperLabelRect, thisLayout);
|
|
883
|
+
addDrillDownIcon(emphasisStyle, upperLabelRect, thisLayout);
|
|
884
|
+
|
|
887
885
|
upperLabelRect && (normalStyle.textRect = zrUtil.clone(upperLabelRect));
|
|
888
886
|
|
|
889
887
|
normalStyle.truncate = (isShow && normalLabelModel.get('ellipsis'))
|
|
@@ -895,6 +893,14 @@ function renderNode(
|
|
|
895
893
|
: null;
|
|
896
894
|
}
|
|
897
895
|
|
|
896
|
+
function addDrillDownIcon(style, upperLabelRect, thisLayout) {
|
|
897
|
+
var text = style.text;
|
|
898
|
+
if (!upperLabelRect && thisLayout.isLeafRoot && text != null) {
|
|
899
|
+
var iconChar = seriesModel.get('drillDownIcon', true);
|
|
900
|
+
style.text = iconChar ? iconChar + ' ' + text : text;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
|
|
898
904
|
function giveGraphic(storageName, Ctor, depth, z) {
|
|
899
905
|
var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex];
|
|
900
906
|
var lasts = lastsForAnimation[storageName];
|
|
@@ -24,6 +24,7 @@ import {onIrrelevantElement} from '../../component/helper/cursorHelper';
|
|
|
24
24
|
import * as graphic from '../../util/graphic';
|
|
25
25
|
import geoSourceManager from '../../coord/geo/geoSourceManager';
|
|
26
26
|
import {getUID} from '../../util/component';
|
|
27
|
+
import Transformable from 'zrender/src/mixin/Transformable';
|
|
27
28
|
|
|
28
29
|
function getFixedItemStyle(model) {
|
|
29
30
|
var itemStyle = model.getItemStyle();
|
|
@@ -182,9 +183,25 @@ MapDraw.prototype = {
|
|
|
182
183
|
var group = this.group;
|
|
183
184
|
|
|
184
185
|
var transformInfo = geo.getTransformInfo();
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
// No animation when first draw or in action
|
|
187
|
+
var isFirstDraw = !regionsGroup.childAt(0) || payload;
|
|
188
|
+
var targetScale;
|
|
189
|
+
if (isFirstDraw) {
|
|
190
|
+
group.transform = transformInfo.roamTransform;
|
|
191
|
+
group.decomposeTransform();
|
|
192
|
+
group.dirty();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
var target = new Transformable();
|
|
196
|
+
target.transform = transformInfo.roamTransform;
|
|
197
|
+
target.decomposeTransform();
|
|
198
|
+
var props = {
|
|
199
|
+
scale: target.scale,
|
|
200
|
+
position: target.position
|
|
201
|
+
};
|
|
202
|
+
targetScale = target.scale;
|
|
203
|
+
graphic.updateProps(group, props, mapOrGeoModel);
|
|
204
|
+
}
|
|
188
205
|
|
|
189
206
|
var scale = transformInfo.rawScale;
|
|
190
207
|
var position = transformInfo.rawPosition;
|
|
@@ -326,6 +343,12 @@ MapDraw.prototype = {
|
|
|
326
343
|
}
|
|
327
344
|
);
|
|
328
345
|
|
|
346
|
+
if (!isFirstDraw) {
|
|
347
|
+
// Text animation
|
|
348
|
+
var textScale = [1 / targetScale[0], 1 / targetScale[1]];
|
|
349
|
+
graphic.updateProps(textEl, { scale: textScale }, mapOrGeoModel);
|
|
350
|
+
}
|
|
351
|
+
|
|
329
352
|
regionGroup.add(textEl);
|
|
330
353
|
}
|
|
331
354
|
|
package/src/component/title.js
CHANGED
|
@@ -21,6 +21,7 @@ import * as zrUtil from 'zrender/src/core/util';
|
|
|
21
21
|
import * as echarts from '../echarts';
|
|
22
22
|
import * as graphic from '../util/graphic';
|
|
23
23
|
import {getLayoutRect} from '../util/layout';
|
|
24
|
+
import {windowOpen} from '../util/format';
|
|
24
25
|
|
|
25
26
|
// Model
|
|
26
27
|
echarts.extendComponentModel({
|
|
@@ -143,12 +144,12 @@ echarts.extendComponentView({
|
|
|
143
144
|
|
|
144
145
|
if (link) {
|
|
145
146
|
textEl.on('click', function () {
|
|
146
|
-
|
|
147
|
+
windowOpen(link, '_' + titleModel.get('target'));
|
|
147
148
|
});
|
|
148
149
|
}
|
|
149
150
|
if (sublink) {
|
|
150
151
|
subTextEl.on('click', function () {
|
|
151
|
-
|
|
152
|
+
windowOpen(link, '_' + titleModel.get('subtarget'));
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
|
|
@@ -64,7 +64,7 @@ export default echarts.extendComponentView({
|
|
|
64
64
|
var feature;
|
|
65
65
|
|
|
66
66
|
// FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
|
|
67
|
-
if (payload && payload.newTitle != null) {
|
|
67
|
+
if (payload && payload.newTitle != null && payload.featureName === featureName) {
|
|
68
68
|
featureOpt.title = payload.newTitle;
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -50,7 +50,8 @@ var proto = SaveAsImage.prototype;
|
|
|
50
50
|
proto.onclick = function (ecModel, api) {
|
|
51
51
|
var model = this.model;
|
|
52
52
|
var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
|
|
53
|
-
var
|
|
53
|
+
var isSvg = api.getZr().painter.getType() === 'svg';
|
|
54
|
+
var type = isSvg ? 'svg' : model.get('type', true) || 'png';
|
|
54
55
|
var url = api.getConnectedDataURL({
|
|
55
56
|
type: type,
|
|
56
57
|
backgroundColor: model.get('backgroundColor', true)
|
|
@@ -478,7 +478,7 @@ export default echarts.extendComponentView({
|
|
|
478
478
|
var dataModel = el.dataModel || seriesModel;
|
|
479
479
|
var dataIndex = el.dataIndex;
|
|
480
480
|
var dataType = el.dataType;
|
|
481
|
-
var data = dataModel.getData();
|
|
481
|
+
var data = dataModel.getData(dataType);
|
|
482
482
|
|
|
483
483
|
var tooltipModel = buildTooltipModel([
|
|
484
484
|
data.getItemModel(dataIndex),
|
|
@@ -398,25 +398,21 @@ var resetMethods = {
|
|
|
398
398
|
thisOption.precision = precision;
|
|
399
399
|
splitStep = +splitStep.toFixed(precision);
|
|
400
400
|
|
|
401
|
-
var index = 0;
|
|
402
|
-
|
|
403
401
|
if (thisOption.minOpen) {
|
|
404
402
|
pieceList.push({
|
|
405
|
-
index: index++,
|
|
406
403
|
interval: [-Infinity, dataExtent[0]],
|
|
407
404
|
close: [0, 0]
|
|
408
405
|
});
|
|
409
406
|
}
|
|
410
407
|
|
|
411
408
|
for (
|
|
412
|
-
var
|
|
413
|
-
index <
|
|
414
|
-
curr += splitStep
|
|
409
|
+
var index = 0, curr = dataExtent[0];
|
|
410
|
+
index < splitNumber;
|
|
411
|
+
curr += splitStep, index++
|
|
415
412
|
) {
|
|
416
413
|
var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);
|
|
417
414
|
|
|
418
415
|
pieceList.push({
|
|
419
|
-
index: index++,
|
|
420
416
|
interval: [curr, max],
|
|
421
417
|
close: [1, 1]
|
|
422
418
|
});
|
|
@@ -424,7 +420,6 @@ var resetMethods = {
|
|
|
424
420
|
|
|
425
421
|
if (thisOption.maxOpen) {
|
|
426
422
|
pieceList.push({
|
|
427
|
-
index: index++,
|
|
428
423
|
interval: [dataExtent[1], Infinity],
|
|
429
424
|
close: [0, 0]
|
|
430
425
|
});
|
|
@@ -432,7 +427,8 @@ var resetMethods = {
|
|
|
432
427
|
|
|
433
428
|
reformIntervals(pieceList);
|
|
434
429
|
|
|
435
|
-
zrUtil.each(pieceList, function (piece) {
|
|
430
|
+
zrUtil.each(pieceList, function (piece, index) {
|
|
431
|
+
piece.index = index;
|
|
436
432
|
piece.text = this.formatValueText(piece.interval);
|
|
437
433
|
}, this);
|
|
438
434
|
},
|
package/src/coord/axisHelper.js
CHANGED
|
@@ -42,8 +42,6 @@ export function getScaleExtent(scale, model) {
|
|
|
42
42
|
|
|
43
43
|
var min = model.getMin();
|
|
44
44
|
var max = model.getMax();
|
|
45
|
-
var fixMin = min != null;
|
|
46
|
-
var fixMax = max != null;
|
|
47
45
|
var originalExtent = scale.getExtent();
|
|
48
46
|
|
|
49
47
|
var axisDataLen;
|
|
@@ -87,17 +85,6 @@ export function getScaleExtent(scale, model) {
|
|
|
87
85
|
// (2) When `needCrossZero` and all data is positive/negative, should it be ensured
|
|
88
86
|
// that the results processed by boundaryGap are positive/negative?
|
|
89
87
|
|
|
90
|
-
if (min == null) {
|
|
91
|
-
min = scaleType === 'ordinal'
|
|
92
|
-
? (axisDataLen ? 0 : NaN)
|
|
93
|
-
: originalExtent[0] - boundaryGap[0] * span;
|
|
94
|
-
}
|
|
95
|
-
if (max == null) {
|
|
96
|
-
max = scaleType === 'ordinal'
|
|
97
|
-
? (axisDataLen ? axisDataLen - 1 : NaN)
|
|
98
|
-
: originalExtent[1] + boundaryGap[1] * span;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
88
|
if (min === 'dataMin') {
|
|
102
89
|
min = originalExtent[0];
|
|
103
90
|
}
|
|
@@ -118,6 +105,20 @@ export function getScaleExtent(scale, model) {
|
|
|
118
105
|
});
|
|
119
106
|
}
|
|
120
107
|
|
|
108
|
+
var fixMin = min != null;
|
|
109
|
+
var fixMax = max != null;
|
|
110
|
+
|
|
111
|
+
if (min == null) {
|
|
112
|
+
min = scaleType === 'ordinal'
|
|
113
|
+
? (axisDataLen ? 0 : NaN)
|
|
114
|
+
: originalExtent[0] - boundaryGap[0] * span;
|
|
115
|
+
}
|
|
116
|
+
if (max == null) {
|
|
117
|
+
max = scaleType === 'ordinal'
|
|
118
|
+
? (axisDataLen ? axisDataLen - 1 : NaN)
|
|
119
|
+
: originalExtent[1] + boundaryGap[1] * span;
|
|
120
|
+
}
|
|
121
|
+
|
|
121
122
|
(min == null || !isFinite(min)) && (min = NaN);
|
|
122
123
|
(max == null || !isFinite(max)) && (max = NaN);
|
|
123
124
|
|
|
@@ -168,7 +169,13 @@ export function getScaleExtent(scale, model) {
|
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
return
|
|
172
|
+
return {
|
|
173
|
+
extent: [min, max],
|
|
174
|
+
// "fix" means "fixed", the value should not be
|
|
175
|
+
// changed in the subsequent steps.
|
|
176
|
+
fixMin: fixMin,
|
|
177
|
+
fixMax: fixMax
|
|
178
|
+
};
|
|
172
179
|
}
|
|
173
180
|
|
|
174
181
|
function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
|
|
@@ -207,9 +214,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
|
|
|
207
214
|
}
|
|
208
215
|
|
|
209
216
|
export function niceScaleExtent(scale, model) {
|
|
210
|
-
var
|
|
211
|
-
var
|
|
212
|
-
|
|
217
|
+
var extentInfo = getScaleExtent(scale, model);
|
|
218
|
+
var extent = extentInfo.extent;
|
|
219
|
+
|
|
213
220
|
var splitNumber = model.get('splitNumber');
|
|
214
221
|
|
|
215
222
|
if (scale.type === 'log') {
|
|
@@ -220,8 +227,8 @@ export function niceScaleExtent(scale, model) {
|
|
|
220
227
|
scale.setExtent(extent[0], extent[1]);
|
|
221
228
|
scale.niceExtent({
|
|
222
229
|
splitNumber: splitNumber,
|
|
223
|
-
fixMin: fixMin,
|
|
224
|
-
fixMax: fixMax,
|
|
230
|
+
fixMin: extentInfo.fixMin,
|
|
231
|
+
fixMax: extentInfo.fixMax,
|
|
225
232
|
minInterval: (scaleType === 'interval' || scaleType === 'time')
|
|
226
233
|
? model.get('minInterval') : null,
|
|
227
234
|
maxInterval: (scaleType === 'interval' || scaleType === 'time')
|
|
@@ -375,7 +375,10 @@ Calendar.prototype = {
|
|
|
375
375
|
var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY)
|
|
376
376
|
- Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1;
|
|
377
377
|
|
|
378
|
-
// Consider
|
|
378
|
+
// Consider case1 (#11677 #10430):
|
|
379
|
+
// Set the system timezone as "UK", set the range to `['2016-07-01', '2016-12-31']`
|
|
380
|
+
|
|
381
|
+
// Consider case2:
|
|
379
382
|
// Firstly set system timezone as "Time Zone: America/Toronto",
|
|
380
383
|
// ```
|
|
381
384
|
// var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
|
|
@@ -388,11 +391,15 @@ Calendar.prototype = {
|
|
|
388
391
|
var endDateNum = range[1].date.getDate();
|
|
389
392
|
date.setDate(startDateNum + allDay - 1);
|
|
390
393
|
// The bias can not over a month, so just compare date.
|
|
391
|
-
|
|
394
|
+
var dateNum = date.getDate();
|
|
395
|
+
if (dateNum !== endDateNum) {
|
|
392
396
|
var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
|
|
393
|
-
while (
|
|
397
|
+
while (
|
|
398
|
+
(dateNum = date.getDate()) !== endDateNum
|
|
399
|
+
&& (date.getTime() - range[1].time) * sign > 0
|
|
400
|
+
) {
|
|
394
401
|
allDay -= sign;
|
|
395
|
-
date.setDate(
|
|
402
|
+
date.setDate(dateNum - sign);
|
|
396
403
|
}
|
|
397
404
|
}
|
|
398
405
|
|
|
@@ -478,4 +485,4 @@ function doConvert(methodName, ecModel, finder, value) {
|
|
|
478
485
|
|
|
479
486
|
CoordinateSystem.register('calendar', Calendar);
|
|
480
487
|
|
|
481
|
-
export default Calendar;
|
|
488
|
+
export default Calendar;
|
|
@@ -34,9 +34,10 @@ export default {
|
|
|
34
34
|
/**
|
|
35
35
|
* @param {string} mapName
|
|
36
36
|
* @param {Object} mapRecord {specialAreas, geoJSON}
|
|
37
|
+
* @param {string} nameProperty
|
|
37
38
|
* @return {Object} {regions, boundingRect}
|
|
38
39
|
*/
|
|
39
|
-
load: function (mapName, mapRecord) {
|
|
40
|
+
load: function (mapName, mapRecord, nameProperty) {
|
|
40
41
|
|
|
41
42
|
var parsed = inner(mapRecord).parsed;
|
|
42
43
|
|
|
@@ -50,7 +51,7 @@ export default {
|
|
|
50
51
|
|
|
51
52
|
// https://jsperf.com/try-catch-performance-overhead
|
|
52
53
|
try {
|
|
53
|
-
regions = geoJSON ? parseGeoJson(geoJSON) : [];
|
|
54
|
+
regions = geoJSON ? parseGeoJson(geoJSON, nameProperty) : [];
|
|
54
55
|
}
|
|
55
56
|
catch (e) {
|
|
56
57
|
throw new Error('Invalid geoJson format\n' + e.message);
|
|
@@ -34,9 +34,10 @@ export default {
|
|
|
34
34
|
/**
|
|
35
35
|
* @param {string} mapName
|
|
36
36
|
* @param {Object} nameMap
|
|
37
|
+
* @param {string} nameProperty
|
|
37
38
|
* @return {Object} source {regions, regionsMap, nameCoordMap, boundingRect}
|
|
38
39
|
*/
|
|
39
|
-
load: function (mapName, nameMap) {
|
|
40
|
+
load: function (mapName, nameMap, nameProperty) {
|
|
40
41
|
var regions = [];
|
|
41
42
|
var regionsMap = createHashMap();
|
|
42
43
|
var nameCoordMap = createHashMap();
|
|
@@ -44,7 +45,7 @@ export default {
|
|
|
44
45
|
var mapRecords = retrieveMap(mapName);
|
|
45
46
|
|
|
46
47
|
each(mapRecords, function (record) {
|
|
47
|
-
var singleSource = loaders[record.type].load(mapName, record);
|
|
48
|
+
var singleSource = loaders[record.type].load(mapName, record, nameProperty);
|
|
48
49
|
|
|
49
50
|
each(singleSource.regions, function (region) {
|
|
50
51
|
var regionName = region.name;
|
|
@@ -96,9 +96,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
|
|
|
96
96
|
/**
|
|
97
97
|
* @alias module:echarts/coord/geo/parseGeoJson
|
|
98
98
|
* @param {Object} geoJson
|
|
99
|
+
* @param {string} nameProperty
|
|
99
100
|
* @return {module:zrender/container/Group}
|
|
100
101
|
*/
|
|
101
|
-
export default function (geoJson) {
|
|
102
|
+
export default function (geoJson, nameProperty) {
|
|
102
103
|
|
|
103
104
|
decode(geoJson);
|
|
104
105
|
|
|
@@ -136,7 +137,7 @@ export default function (geoJson) {
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
var region = new Region(
|
|
139
|
-
properties
|
|
140
|
+
properties[nameProperty || 'name'],
|
|
140
141
|
geometries,
|
|
141
142
|
properties.cp
|
|
142
143
|
);
|
package/src/coord/radar/Radar.js
CHANGED
|
@@ -186,7 +186,7 @@ Radar.prototype.update = function (ecModel, api) {
|
|
|
186
186
|
}
|
|
187
187
|
// Force all the axis fixing the maxSplitNumber.
|
|
188
188
|
zrUtil.each(indicatorAxes, function (indicatorAxis, idx) {
|
|
189
|
-
var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model);
|
|
189
|
+
var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model).extent;
|
|
190
190
|
niceScaleExtent(indicatorAxis.scale, indicatorAxis.model);
|
|
191
191
|
|
|
192
192
|
var axisModel = indicatorAxis.model;
|
package/src/data/Tree.js
CHANGED
|
@@ -248,11 +248,14 @@ TreeNode.prototype = {
|
|
|
248
248
|
var hostTree = this.hostTree;
|
|
249
249
|
var itemModel = hostTree.data.getItemModel(this.dataIndex);
|
|
250
250
|
var levelModel = this.getLevelModel();
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
|
|
252
|
+
// FIXME: refactor levelModel to "beforeLink", and remove levelModel here.
|
|
253
|
+
if (levelModel) {
|
|
254
|
+
return itemModel.getModel(path, levelModel.getModel(path));
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
return itemModel.getModel(path);
|
|
254
258
|
}
|
|
255
|
-
return itemModel.getModel(path, (levelModel || leavesModel || hostTree.hostModel).getModel(path));
|
|
256
259
|
},
|
|
257
260
|
|
|
258
261
|
/**
|
|
@@ -262,13 +265,6 @@ TreeNode.prototype = {
|
|
|
262
265
|
return (this.hostTree.levelModels || [])[this.depth];
|
|
263
266
|
},
|
|
264
267
|
|
|
265
|
-
/**
|
|
266
|
-
* @return {module:echarts/model/Model}
|
|
267
|
-
*/
|
|
268
|
-
getLeavesModel: function () {
|
|
269
|
-
return this.hostTree.leavesModel;
|
|
270
|
-
},
|
|
271
|
-
|
|
272
268
|
/**
|
|
273
269
|
* @example
|
|
274
270
|
* setItemVisual('color', color);
|
|
@@ -339,9 +335,8 @@ TreeNode.prototype = {
|
|
|
339
335
|
* @alias module:echarts/data/Tree
|
|
340
336
|
* @param {module:echarts/model/Model} hostModel
|
|
341
337
|
* @param {Array.<Object>} levelOptions
|
|
342
|
-
* @param {Object} leavesOption
|
|
343
338
|
*/
|
|
344
|
-
function Tree(hostModel, levelOptions
|
|
339
|
+
function Tree(hostModel, levelOptions) {
|
|
345
340
|
/**
|
|
346
341
|
* @type {module:echarts/data/Tree~TreeNode}
|
|
347
342
|
* @readOnly
|
|
@@ -377,7 +372,6 @@ function Tree(hostModel, levelOptions, leavesOption) {
|
|
|
377
372
|
return new Model(levelDefine, hostModel, hostModel.ecModel);
|
|
378
373
|
});
|
|
379
374
|
|
|
380
|
-
this.leavesModel = new Model(leavesOption || {}, hostModel, hostModel.ecModel);
|
|
381
375
|
}
|
|
382
376
|
|
|
383
377
|
Tree.prototype = {
|
|
@@ -469,12 +463,11 @@ Tree.prototype = {
|
|
|
469
463
|
* @param {module:echarts/model/Model} hostModel
|
|
470
464
|
* @param {Object} treeOptions
|
|
471
465
|
* @param {Array.<Object>} treeOptions.levels
|
|
472
|
-
* @param {Array.<Object>} treeOptions.leaves
|
|
473
466
|
* @return module:echarts/data/Tree
|
|
474
467
|
*/
|
|
475
468
|
Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
|
|
476
469
|
|
|
477
|
-
var tree = new Tree(hostModel, treeOptions
|
|
470
|
+
var tree = new Tree(hostModel, treeOptions && treeOptions.levels);
|
|
478
471
|
var listData = [];
|
|
479
472
|
var dimMax = 1;
|
|
480
473
|
|
|
@@ -511,6 +504,8 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
|
|
|
511
504
|
var list = new List(dimensionsInfo, hostModel);
|
|
512
505
|
list.initData(listData);
|
|
513
506
|
|
|
507
|
+
beforeLink && beforeLink(list);
|
|
508
|
+
|
|
514
509
|
linkList({
|
|
515
510
|
mainData: list,
|
|
516
511
|
struct: tree,
|
|
@@ -519,8 +514,6 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
|
|
|
519
514
|
|
|
520
515
|
tree.update();
|
|
521
516
|
|
|
522
|
-
beforeLink && beforeLink(list);
|
|
523
|
-
|
|
524
517
|
return tree;
|
|
525
518
|
};
|
|
526
519
|
|