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
package/lib/coord/axisHelper.js
CHANGED
|
@@ -71,8 +71,6 @@ function getScaleExtent(scale, model) {
|
|
|
71
71
|
var scaleType = scale.type;
|
|
72
72
|
var min = model.getMin();
|
|
73
73
|
var max = model.getMax();
|
|
74
|
-
var fixMin = min != null;
|
|
75
|
-
var fixMax = max != null;
|
|
76
74
|
var originalExtent = scale.getExtent();
|
|
77
75
|
var axisDataLen;
|
|
78
76
|
var boundaryGap;
|
|
@@ -109,14 +107,6 @@ function getScaleExtent(scale, model) {
|
|
|
109
107
|
// that the results processed by boundaryGap are positive/negative?
|
|
110
108
|
|
|
111
109
|
|
|
112
|
-
if (min == null) {
|
|
113
|
-
min = scaleType === 'ordinal' ? axisDataLen ? 0 : NaN : originalExtent[0] - boundaryGap[0] * span;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (max == null) {
|
|
117
|
-
max = scaleType === 'ordinal' ? axisDataLen ? axisDataLen - 1 : NaN : originalExtent[1] + boundaryGap[1] * span;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
110
|
if (min === 'dataMin') {
|
|
121
111
|
min = originalExtent[0];
|
|
122
112
|
} else if (typeof min === 'function') {
|
|
@@ -135,6 +125,17 @@ function getScaleExtent(scale, model) {
|
|
|
135
125
|
});
|
|
136
126
|
}
|
|
137
127
|
|
|
128
|
+
var fixMin = min != null;
|
|
129
|
+
var fixMax = max != null;
|
|
130
|
+
|
|
131
|
+
if (min == null) {
|
|
132
|
+
min = scaleType === 'ordinal' ? axisDataLen ? 0 : NaN : originalExtent[0] - boundaryGap[0] * span;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (max == null) {
|
|
136
|
+
max = scaleType === 'ordinal' ? axisDataLen ? axisDataLen - 1 : NaN : originalExtent[1] + boundaryGap[1] * span;
|
|
137
|
+
}
|
|
138
|
+
|
|
138
139
|
(min == null || !isFinite(min)) && (min = NaN);
|
|
139
140
|
(max == null || !isFinite(max)) && (max = NaN);
|
|
140
141
|
scale.setBlank(zrUtil.eqNaN(min) || zrUtil.eqNaN(max) || scaleType === 'ordinal' && !scale.getOrdinalMeta().categories.length); // Evaluate if axis needs cross zero
|
|
@@ -181,7 +182,13 @@ function getScaleExtent(scale, model) {
|
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
return
|
|
185
|
+
return {
|
|
186
|
+
extent: [min, max],
|
|
187
|
+
// "fix" means "fixed", the value should not be
|
|
188
|
+
// changed in the subsequent steps.
|
|
189
|
+
fixMin: fixMin,
|
|
190
|
+
fixMax: fixMax
|
|
191
|
+
};
|
|
185
192
|
}
|
|
186
193
|
|
|
187
194
|
function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
|
|
@@ -222,9 +229,8 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
|
|
|
222
229
|
}
|
|
223
230
|
|
|
224
231
|
function niceScaleExtent(scale, model) {
|
|
225
|
-
var
|
|
226
|
-
var
|
|
227
|
-
var fixMax = model.getMax() != null;
|
|
232
|
+
var extentInfo = getScaleExtent(scale, model);
|
|
233
|
+
var extent = extentInfo.extent;
|
|
228
234
|
var splitNumber = model.get('splitNumber');
|
|
229
235
|
|
|
230
236
|
if (scale.type === 'log') {
|
|
@@ -235,8 +241,8 @@ function niceScaleExtent(scale, model) {
|
|
|
235
241
|
scale.setExtent(extent[0], extent[1]);
|
|
236
242
|
scale.niceExtent({
|
|
237
243
|
splitNumber: splitNumber,
|
|
238
|
-
fixMin: fixMin,
|
|
239
|
-
fixMax: fixMax,
|
|
244
|
+
fixMin: extentInfo.fixMin,
|
|
245
|
+
fixMax: extentInfo.fixMax,
|
|
240
246
|
minInterval: scaleType === 'interval' || scaleType === 'time' ? model.get('minInterval') : null,
|
|
241
247
|
maxInterval: scaleType === 'interval' || scaleType === 'time' ? model.get('maxInterval') : null
|
|
242
248
|
}); // If some one specified the min, max. And the default calculated interval
|
|
@@ -336,7 +336,9 @@ Calendar.prototype = {
|
|
|
336
336
|
range.reverse();
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY) - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1; // Consider
|
|
339
|
+
var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY) - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1; // Consider case1 (#11677 #10430):
|
|
340
|
+
// Set the system timezone as "UK", set the range to `['2016-07-01', '2016-12-31']`
|
|
341
|
+
// Consider case2:
|
|
340
342
|
// Firstly set system timezone as "Time Zone: America/Toronto",
|
|
341
343
|
// ```
|
|
342
344
|
// var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
|
|
@@ -350,12 +352,14 @@ Calendar.prototype = {
|
|
|
350
352
|
var endDateNum = range[1].date.getDate();
|
|
351
353
|
date.setDate(startDateNum + allDay - 1); // The bias can not over a month, so just compare date.
|
|
352
354
|
|
|
353
|
-
|
|
355
|
+
var dateNum = date.getDate();
|
|
356
|
+
|
|
357
|
+
if (dateNum !== endDateNum) {
|
|
354
358
|
var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
|
|
355
359
|
|
|
356
|
-
while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
|
|
360
|
+
while ((dateNum = date.getDate()) !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
|
|
357
361
|
allDay -= sign;
|
|
358
|
-
date.setDate(
|
|
362
|
+
date.setDate(dateNum - sign);
|
|
359
363
|
}
|
|
360
364
|
}
|
|
361
365
|
|
|
@@ -60,9 +60,10 @@ var _default = {
|
|
|
60
60
|
/**
|
|
61
61
|
* @param {string} mapName
|
|
62
62
|
* @param {Object} mapRecord {specialAreas, geoJSON}
|
|
63
|
+
* @param {string} nameProperty
|
|
63
64
|
* @return {Object} {regions, boundingRect}
|
|
64
65
|
*/
|
|
65
|
-
load: function (mapName, mapRecord) {
|
|
66
|
+
load: function (mapName, mapRecord, nameProperty) {
|
|
66
67
|
var parsed = inner(mapRecord).parsed;
|
|
67
68
|
|
|
68
69
|
if (parsed) {
|
|
@@ -74,7 +75,7 @@ var _default = {
|
|
|
74
75
|
var regions; // https://jsperf.com/try-catch-performance-overhead
|
|
75
76
|
|
|
76
77
|
try {
|
|
77
|
-
regions = geoJSON ? parseGeoJson(geoJSON) : [];
|
|
78
|
+
regions = geoJSON ? parseGeoJson(geoJSON, nameProperty) : [];
|
|
78
79
|
} catch (e) {
|
|
79
80
|
throw new Error('Invalid geoJson format\n' + e.message);
|
|
80
81
|
}
|
|
@@ -61,16 +61,17 @@ var _default = {
|
|
|
61
61
|
/**
|
|
62
62
|
* @param {string} mapName
|
|
63
63
|
* @param {Object} nameMap
|
|
64
|
+
* @param {string} nameProperty
|
|
64
65
|
* @return {Object} source {regions, regionsMap, nameCoordMap, boundingRect}
|
|
65
66
|
*/
|
|
66
|
-
load: function (mapName, nameMap) {
|
|
67
|
+
load: function (mapName, nameMap, nameProperty) {
|
|
67
68
|
var regions = [];
|
|
68
69
|
var regionsMap = createHashMap();
|
|
69
70
|
var nameCoordMap = createHashMap();
|
|
70
71
|
var boundingRect;
|
|
71
72
|
var mapRecords = retrieveMap(mapName);
|
|
72
73
|
each(mapRecords, function (record) {
|
|
73
|
-
var singleSource = loaders[record.type].load(mapName, record);
|
|
74
|
+
var singleSource = loaders[record.type].load(mapName, record, nameProperty);
|
|
74
75
|
each(singleSource.regions, function (region) {
|
|
75
76
|
var regionName = region.name; // Try use the alias in geoNameMap
|
|
76
77
|
|
|
@@ -108,11 +108,12 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
|
|
|
108
108
|
/**
|
|
109
109
|
* @alias module:echarts/coord/geo/parseGeoJson
|
|
110
110
|
* @param {Object} geoJson
|
|
111
|
+
* @param {string} nameProperty
|
|
111
112
|
* @return {module:zrender/container/Group}
|
|
112
113
|
*/
|
|
113
114
|
|
|
114
115
|
|
|
115
|
-
function _default(geoJson) {
|
|
116
|
+
function _default(geoJson, nameProperty) {
|
|
116
117
|
decode(geoJson);
|
|
117
118
|
return zrUtil.map(zrUtil.filter(geoJson.features, function (featureObj) {
|
|
118
119
|
// Output of mapshaper may have geometry null
|
|
@@ -145,7 +146,7 @@ function _default(geoJson) {
|
|
|
145
146
|
});
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
var region = new Region(properties
|
|
149
|
+
var region = new Region(properties[nameProperty || 'name'], geometries, properties.cp);
|
|
149
150
|
region.properties = properties;
|
|
150
151
|
return region;
|
|
151
152
|
});
|
package/lib/coord/radar/Radar.js
CHANGED
|
@@ -210,7 +210,7 @@ Radar.prototype.update = function (ecModel, api) {
|
|
|
210
210
|
|
|
211
211
|
|
|
212
212
|
zrUtil.each(indicatorAxes, function (indicatorAxis, idx) {
|
|
213
|
-
var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model);
|
|
213
|
+
var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model).extent;
|
|
214
214
|
niceScaleExtent(indicatorAxis.scale, indicatorAxis.model);
|
|
215
215
|
var axisModel = indicatorAxis.model;
|
|
216
216
|
var scale = indicatorAxis.scale;
|
package/lib/data/Tree.js
CHANGED
|
@@ -281,14 +281,13 @@ TreeNode.prototype = {
|
|
|
281
281
|
|
|
282
282
|
var hostTree = this.hostTree;
|
|
283
283
|
var itemModel = hostTree.data.getItemModel(this.dataIndex);
|
|
284
|
-
var levelModel = this.getLevelModel();
|
|
285
|
-
var leavesModel;
|
|
284
|
+
var levelModel = this.getLevelModel(); // FIXME: refactor levelModel to "beforeLink", and remove levelModel here.
|
|
286
285
|
|
|
287
|
-
if (
|
|
288
|
-
|
|
286
|
+
if (levelModel) {
|
|
287
|
+
return itemModel.getModel(path, levelModel.getModel(path));
|
|
288
|
+
} else {
|
|
289
|
+
return itemModel.getModel(path);
|
|
289
290
|
}
|
|
290
|
-
|
|
291
|
-
return itemModel.getModel(path, (levelModel || leavesModel || hostTree.hostModel).getModel(path));
|
|
292
291
|
},
|
|
293
292
|
|
|
294
293
|
/**
|
|
@@ -298,13 +297,6 @@ TreeNode.prototype = {
|
|
|
298
297
|
return (this.hostTree.levelModels || [])[this.depth];
|
|
299
298
|
},
|
|
300
299
|
|
|
301
|
-
/**
|
|
302
|
-
* @return {module:echarts/model/Model}
|
|
303
|
-
*/
|
|
304
|
-
getLeavesModel: function () {
|
|
305
|
-
return this.hostTree.leavesModel;
|
|
306
|
-
},
|
|
307
|
-
|
|
308
300
|
/**
|
|
309
301
|
* @example
|
|
310
302
|
* setItemVisual('color', color);
|
|
@@ -376,10 +368,9 @@ TreeNode.prototype = {
|
|
|
376
368
|
* @alias module:echarts/data/Tree
|
|
377
369
|
* @param {module:echarts/model/Model} hostModel
|
|
378
370
|
* @param {Array.<Object>} levelOptions
|
|
379
|
-
* @param {Object} leavesOption
|
|
380
371
|
*/
|
|
381
372
|
|
|
382
|
-
function Tree(hostModel, levelOptions
|
|
373
|
+
function Tree(hostModel, levelOptions) {
|
|
383
374
|
/**
|
|
384
375
|
* @type {module:echarts/data/Tree~TreeNode}
|
|
385
376
|
* @readOnly
|
|
@@ -414,7 +405,6 @@ function Tree(hostModel, levelOptions, leavesOption) {
|
|
|
414
405
|
this.levelModels = zrUtil.map(levelOptions || [], function (levelDefine) {
|
|
415
406
|
return new Model(levelDefine, hostModel, hostModel.ecModel);
|
|
416
407
|
});
|
|
417
|
-
this.leavesModel = new Model(leavesOption || {}, hostModel, hostModel.ecModel);
|
|
418
408
|
}
|
|
419
409
|
|
|
420
410
|
Tree.prototype = {
|
|
@@ -503,12 +493,11 @@ Tree.prototype = {
|
|
|
503
493
|
* @param {module:echarts/model/Model} hostModel
|
|
504
494
|
* @param {Object} treeOptions
|
|
505
495
|
* @param {Array.<Object>} treeOptions.levels
|
|
506
|
-
* @param {Array.<Object>} treeOptions.leaves
|
|
507
496
|
* @return module:echarts/data/Tree
|
|
508
497
|
*/
|
|
509
498
|
|
|
510
499
|
Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
|
|
511
|
-
var tree = new Tree(hostModel, treeOptions
|
|
500
|
+
var tree = new Tree(hostModel, treeOptions && treeOptions.levels);
|
|
512
501
|
var listData = [];
|
|
513
502
|
var dimMax = 1;
|
|
514
503
|
buildHierarchy(dataRoot);
|
|
@@ -538,13 +527,13 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
|
|
|
538
527
|
});
|
|
539
528
|
var list = new List(dimensionsInfo, hostModel);
|
|
540
529
|
list.initData(listData);
|
|
530
|
+
beforeLink && beforeLink(list);
|
|
541
531
|
linkList({
|
|
542
532
|
mainData: list,
|
|
543
533
|
struct: tree,
|
|
544
534
|
structAttr: 'tree'
|
|
545
535
|
});
|
|
546
536
|
tree.update();
|
|
547
|
-
beforeLink && beforeLink(list);
|
|
548
537
|
return tree;
|
|
549
538
|
};
|
|
550
539
|
/**
|
package/lib/echarts.js
CHANGED
|
@@ -101,9 +101,9 @@ var each = zrUtil.each;
|
|
|
101
101
|
var isFunction = zrUtil.isFunction;
|
|
102
102
|
var isObject = zrUtil.isObject;
|
|
103
103
|
var parseClassType = ComponentModel.parseClassType;
|
|
104
|
-
var version = '4.
|
|
104
|
+
var version = '4.8.0';
|
|
105
105
|
var dependencies = {
|
|
106
|
-
zrender: '4.3.
|
|
106
|
+
zrender: '4.3.1'
|
|
107
107
|
};
|
|
108
108
|
var TEST_FRAME_REMAIN_TIME = 1;
|
|
109
109
|
var PRIORITY_PROCESSOR_FILTER = 1000;
|
|
@@ -498,7 +498,7 @@ echartsProto.getRenderedCanvas = function (opts) {
|
|
|
498
498
|
*/
|
|
499
499
|
|
|
500
500
|
|
|
501
|
-
echartsProto.
|
|
501
|
+
echartsProto.getSvgDataURL = function () {
|
|
502
502
|
if (!env.svgSupported) {
|
|
503
503
|
return;
|
|
504
504
|
}
|
|
@@ -509,7 +509,7 @@ echartsProto.getSvgDataUrl = function () {
|
|
|
509
509
|
zrUtil.each(list, function (el) {
|
|
510
510
|
el.stopAnimation(true);
|
|
511
511
|
});
|
|
512
|
-
return zr.painter.
|
|
512
|
+
return zr.painter.toDataURL();
|
|
513
513
|
};
|
|
514
514
|
/**
|
|
515
515
|
* @return {string}
|
|
@@ -544,7 +544,7 @@ echartsProto.getDataURL = function (opts) {
|
|
|
544
544
|
}
|
|
545
545
|
});
|
|
546
546
|
});
|
|
547
|
-
var url = this._zr.painter.getType() === 'svg' ? this.
|
|
547
|
+
var url = this._zr.painter.getType() === 'svg' ? this.getSvgDataURL() : this.getRenderedCanvas(opts).toDataURL('image/' + (opts && opts.type || 'png'));
|
|
548
548
|
each(excludesComponentViews, function (view) {
|
|
549
549
|
view.group.ignore = false;
|
|
550
550
|
});
|
|
@@ -569,6 +569,7 @@ echartsProto.getConnectedDataURL = function (opts) {
|
|
|
569
569
|
return;
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
+
var isSvg = opts.type === 'svg';
|
|
572
573
|
var groupId = this.group;
|
|
573
574
|
var mathMin = Math.min;
|
|
574
575
|
var mathMax = Math.max;
|
|
@@ -583,7 +584,7 @@ echartsProto.getConnectedDataURL = function (opts) {
|
|
|
583
584
|
var dpr = opts && opts.pixelRatio || 1;
|
|
584
585
|
zrUtil.each(instances, function (chart, id) {
|
|
585
586
|
if (chart.group === groupId) {
|
|
586
|
-
var canvas = chart.getRenderedCanvas(zrUtil.clone(opts));
|
|
587
|
+
var canvas = isSvg ? chart.getZr().painter.getSvgDom().innerHTML : chart.getRenderedCanvas(zrUtil.clone(opts));
|
|
587
588
|
var boundingRect = chart.getDom().getBoundingClientRect();
|
|
588
589
|
left = mathMin(boundingRect.left, left);
|
|
589
590
|
top = mathMin(boundingRect.top, top);
|
|
@@ -603,36 +604,58 @@ echartsProto.getConnectedDataURL = function (opts) {
|
|
|
603
604
|
var width = right - left;
|
|
604
605
|
var height = bottom - top;
|
|
605
606
|
var targetCanvas = zrUtil.createCanvas();
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
x: 0,
|
|
614
|
-
y: 0,
|
|
615
|
-
width: width,
|
|
616
|
-
height: height
|
|
617
|
-
},
|
|
618
|
-
style: {
|
|
619
|
-
fill: opts.connectedBackgroundColor
|
|
620
|
-
}
|
|
621
|
-
}));
|
|
622
|
-
}
|
|
607
|
+
var zr = zrender.init(targetCanvas, {
|
|
608
|
+
renderer: isSvg ? 'svg' : 'canvas'
|
|
609
|
+
});
|
|
610
|
+
zr.resize({
|
|
611
|
+
width: width,
|
|
612
|
+
height: height
|
|
613
|
+
});
|
|
623
614
|
|
|
624
|
-
|
|
625
|
-
var
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
615
|
+
if (isSvg) {
|
|
616
|
+
var content = '';
|
|
617
|
+
each(canvasList, function (item) {
|
|
618
|
+
var x = item.left - left;
|
|
619
|
+
var y = item.top - top;
|
|
620
|
+
content += '<g transform="translate(' + x + ',' + y + ')">' + item.dom + '</g>';
|
|
631
621
|
});
|
|
632
|
-
zr.
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
622
|
+
zr.painter.getSvgRoot().innerHTML = content;
|
|
623
|
+
|
|
624
|
+
if (opts.connectedBackgroundColor) {
|
|
625
|
+
zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
zr.refreshImmediately();
|
|
629
|
+
return zr.painter.toDataURL();
|
|
630
|
+
} else {
|
|
631
|
+
// Background between the charts
|
|
632
|
+
if (opts.connectedBackgroundColor) {
|
|
633
|
+
zr.add(new graphic.Rect({
|
|
634
|
+
shape: {
|
|
635
|
+
x: 0,
|
|
636
|
+
y: 0,
|
|
637
|
+
width: width,
|
|
638
|
+
height: height
|
|
639
|
+
},
|
|
640
|
+
style: {
|
|
641
|
+
fill: opts.connectedBackgroundColor
|
|
642
|
+
}
|
|
643
|
+
}));
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
each(canvasList, function (item) {
|
|
647
|
+
var img = new graphic.Image({
|
|
648
|
+
style: {
|
|
649
|
+
x: item.left * dpr - left,
|
|
650
|
+
y: item.top * dpr - top,
|
|
651
|
+
image: item.dom
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
zr.add(img);
|
|
655
|
+
});
|
|
656
|
+
zr.refreshImmediately();
|
|
657
|
+
return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
|
|
658
|
+
}
|
|
636
659
|
} else {
|
|
637
660
|
return this.getDataURL(opts);
|
|
638
661
|
}
|
package/lib/langEN.js
CHANGED
|
@@ -84,6 +84,32 @@ var _default = {
|
|
|
84
84
|
lang: ['Right Click to Save Image']
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
+
series: {
|
|
88
|
+
typeNames: {
|
|
89
|
+
pie: 'Pie chart',
|
|
90
|
+
bar: 'Bar chart',
|
|
91
|
+
line: 'Line chart',
|
|
92
|
+
scatter: 'Scatter plot',
|
|
93
|
+
effectScatter: 'Ripple scatter plot',
|
|
94
|
+
radar: 'Radar chart',
|
|
95
|
+
tree: 'Tree',
|
|
96
|
+
treemap: 'Treemap',
|
|
97
|
+
boxplot: 'Boxplot',
|
|
98
|
+
candlestick: 'Candlestick',
|
|
99
|
+
k: 'K line chart',
|
|
100
|
+
heatmap: 'Heat map',
|
|
101
|
+
map: 'Map',
|
|
102
|
+
parallel: 'Parallel coordinate map',
|
|
103
|
+
lines: 'Line graph',
|
|
104
|
+
graph: 'Relationship graph',
|
|
105
|
+
sankey: 'Sankey diagram',
|
|
106
|
+
funnel: 'Funnel chart',
|
|
107
|
+
gauge: 'Guage',
|
|
108
|
+
pictorialBar: 'Pictorial bar',
|
|
109
|
+
themeRiver: 'Theme River Map',
|
|
110
|
+
sunburst: 'Sunburst'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
87
113
|
aria: {
|
|
88
114
|
general: {
|
|
89
115
|
withTitle: 'This is a chart about "{title}"',
|
package/lib/loading/default.js
CHANGED
|
@@ -22,6 +22,8 @@ var zrUtil = require("zrender/lib/core/util");
|
|
|
22
22
|
|
|
23
23
|
var graphic = require("../util/graphic");
|
|
24
24
|
|
|
25
|
+
var textContain = require("zrender/lib/contain/text");
|
|
26
|
+
|
|
25
27
|
/*
|
|
26
28
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
27
29
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -54,11 +56,16 @@ function _default(api, opts) {
|
|
|
54
56
|
opts = opts || {};
|
|
55
57
|
zrUtil.defaults(opts, {
|
|
56
58
|
text: 'loading',
|
|
57
|
-
color: '#c23531',
|
|
58
59
|
textColor: '#000',
|
|
60
|
+
fontSize: '12px',
|
|
59
61
|
maskColor: 'rgba(255, 255, 255, 0.8)',
|
|
62
|
+
showSpinner: true,
|
|
63
|
+
color: '#c23531',
|
|
64
|
+
spinnerRadius: 10,
|
|
65
|
+
lineWidth: 5,
|
|
60
66
|
zlevel: 0
|
|
61
67
|
});
|
|
68
|
+
var group = new graphic.Group();
|
|
62
69
|
var mask = new graphic.Rect({
|
|
63
70
|
style: {
|
|
64
71
|
fill: opts.maskColor
|
|
@@ -66,24 +73,13 @@ function _default(api, opts) {
|
|
|
66
73
|
zlevel: opts.zlevel,
|
|
67
74
|
z: 10000
|
|
68
75
|
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
startAngle: -PI / 2,
|
|
72
|
-
endAngle: -PI / 2 + 0.1,
|
|
73
|
-
r: 10
|
|
74
|
-
},
|
|
75
|
-
style: {
|
|
76
|
-
stroke: opts.color,
|
|
77
|
-
lineCap: 'round',
|
|
78
|
-
lineWidth: 5
|
|
79
|
-
},
|
|
80
|
-
zlevel: opts.zlevel,
|
|
81
|
-
z: 10001
|
|
82
|
-
});
|
|
76
|
+
group.add(mask);
|
|
77
|
+
var font = opts.fontSize + ' sans-serif';
|
|
83
78
|
var labelRect = new graphic.Rect({
|
|
84
79
|
style: {
|
|
85
80
|
fill: 'none',
|
|
86
81
|
text: opts.text,
|
|
82
|
+
font: font,
|
|
87
83
|
textPosition: 'right',
|
|
88
84
|
textDistance: 10,
|
|
89
85
|
textFill: opts.textColor
|
|
@@ -91,25 +87,45 @@ function _default(api, opts) {
|
|
|
91
87
|
zlevel: opts.zlevel,
|
|
92
88
|
z: 10001
|
|
93
89
|
});
|
|
94
|
-
arc.animateShape(true).when(1000, {
|
|
95
|
-
endAngle: PI * 3 / 2
|
|
96
|
-
}).start('circularInOut');
|
|
97
|
-
arc.animateShape(true).when(1000, {
|
|
98
|
-
startAngle: PI * 3 / 2
|
|
99
|
-
}).delay(300).start('circularInOut');
|
|
100
|
-
var group = new graphic.Group();
|
|
101
|
-
group.add(arc);
|
|
102
90
|
group.add(labelRect);
|
|
103
|
-
|
|
91
|
+
|
|
92
|
+
if (opts.showSpinner) {
|
|
93
|
+
var arc = new graphic.Arc({
|
|
94
|
+
shape: {
|
|
95
|
+
startAngle: -PI / 2,
|
|
96
|
+
endAngle: -PI / 2 + 0.1,
|
|
97
|
+
r: opts.spinnerRadius
|
|
98
|
+
},
|
|
99
|
+
style: {
|
|
100
|
+
stroke: opts.color,
|
|
101
|
+
lineCap: 'round',
|
|
102
|
+
lineWidth: opts.lineWidth
|
|
103
|
+
},
|
|
104
|
+
zlevel: opts.zlevel,
|
|
105
|
+
z: 10001
|
|
106
|
+
});
|
|
107
|
+
arc.animateShape(true).when(1000, {
|
|
108
|
+
endAngle: PI * 3 / 2
|
|
109
|
+
}).start('circularInOut');
|
|
110
|
+
arc.animateShape(true).when(1000, {
|
|
111
|
+
startAngle: PI * 3 / 2
|
|
112
|
+
}).delay(300).start('circularInOut');
|
|
113
|
+
group.add(arc);
|
|
114
|
+
} // Inject resize
|
|
115
|
+
|
|
104
116
|
|
|
105
117
|
group.resize = function () {
|
|
106
|
-
var
|
|
118
|
+
var textWidth = textContain.getWidth(opts.text, font);
|
|
119
|
+
var r = opts.showSpinner ? opts.spinnerRadius : 0; // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
|
|
120
|
+
// textDistance needs to be calculated when both animation and text exist
|
|
121
|
+
|
|
122
|
+
var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2 // only show the text
|
|
123
|
+
- (opts.showSpinner ? 0 : textWidth / 2);
|
|
107
124
|
var cy = api.getHeight() / 2;
|
|
108
|
-
arc.setShape({
|
|
125
|
+
opts.showSpinner && arc.setShape({
|
|
109
126
|
cx: cx,
|
|
110
127
|
cy: cy
|
|
111
128
|
});
|
|
112
|
-
var r = arc.shape.r;
|
|
113
129
|
labelRect.setShape({
|
|
114
130
|
x: cx - r,
|
|
115
131
|
y: cy - r,
|
package/lib/model/Series.js
CHANGED
|
@@ -569,7 +569,7 @@ function dataTaskReset(context) {
|
|
|
569
569
|
|
|
570
570
|
function dataTaskProgress(param, context) {
|
|
571
571
|
// Avoid repead cloneShallow when data just created in reset.
|
|
572
|
-
if (param.end > context.outputData.count()) {
|
|
572
|
+
if (context.outputData && param.end > context.outputData.count()) {
|
|
573
573
|
context.model.getRawData().cloneShallow(context.outputData);
|
|
574
574
|
}
|
|
575
575
|
} // TODO refactor
|
package/lib/util/format.js
CHANGED
|
@@ -45,7 +45,7 @@ var numberUtil = require("./number");
|
|
|
45
45
|
// import Text from 'zrender/src/graphic/Text';
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* add commas after every three numbers
|
|
49
49
|
* @param {string|number} x
|
|
50
50
|
* @return {string}
|
|
51
51
|
*/
|
|
@@ -261,6 +261,22 @@ function getTextBoundingRect(opt) {
|
|
|
261
261
|
function getTextRect(text, font, textAlign, textVerticalAlign, textPadding, rich, truncate, textLineHeight) {
|
|
262
262
|
return textContain.getBoundingRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate);
|
|
263
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* open new tab
|
|
266
|
+
* @param {string} link url
|
|
267
|
+
* @param {string} target blank or self
|
|
268
|
+
*/
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
function windowOpen(link, target) {
|
|
272
|
+
if (target === '_blank' || target === 'blank') {
|
|
273
|
+
var blank = window.open();
|
|
274
|
+
blank.opener = null;
|
|
275
|
+
blank.location = link;
|
|
276
|
+
} else {
|
|
277
|
+
window.open(link, target);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
264
280
|
|
|
265
281
|
exports.addCommas = addCommas;
|
|
266
282
|
exports.toCamelCase = toCamelCase;
|
|
@@ -273,4 +289,5 @@ exports.formatTime = formatTime;
|
|
|
273
289
|
exports.capitalFirst = capitalFirst;
|
|
274
290
|
exports.truncateText = truncateText;
|
|
275
291
|
exports.getTextBoundingRect = getTextBoundingRect;
|
|
276
|
-
exports.getTextRect = getTextRect;
|
|
292
|
+
exports.getTextRect = getTextRect;
|
|
293
|
+
exports.windowOpen = windowOpen;
|
package/lib/util/graphic.js
CHANGED
|
@@ -727,11 +727,13 @@ function getHighlightDigit(highlightKey) {
|
|
|
727
727
|
* @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
|
|
728
728
|
* @param {string|Function} [opt.defaultText]
|
|
729
729
|
* @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
|
|
730
|
-
* `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
|
|
731
|
-
* @param {
|
|
732
|
-
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
|
|
733
|
-
* @param {
|
|
734
|
-
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
|
|
730
|
+
* `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
|
|
731
|
+
* @param {number} [opt.labelDataIndex] Fetch text by
|
|
732
|
+
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
|
|
733
|
+
* @param {number} [opt.labelDimIndex] Fetch text by
|
|
734
|
+
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
|
|
735
|
+
* @param {string} [opt.labelProp] Fetch text by
|
|
736
|
+
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
|
|
735
737
|
* @param {Object} [normalSpecified]
|
|
736
738
|
* @param {Object} [emphasisSpecified]
|
|
737
739
|
*/
|
|
@@ -741,7 +743,8 @@ function setLabelStyle(normalStyle, emphasisStyle, normalModel, emphasisModel, o
|
|
|
741
743
|
opt = opt || EMPTY_OBJ;
|
|
742
744
|
var labelFetcher = opt.labelFetcher;
|
|
743
745
|
var labelDataIndex = opt.labelDataIndex;
|
|
744
|
-
var labelDimIndex = opt.labelDimIndex;
|
|
746
|
+
var labelDimIndex = opt.labelDimIndex;
|
|
747
|
+
var labelProp = opt.labelProp; // This scenario, `label.normal.show = true; label.emphasis.show = false`,
|
|
745
748
|
// is not supported util someone requests.
|
|
746
749
|
|
|
747
750
|
var showNormal = normalModel.getShallow('show');
|
|
@@ -753,7 +756,7 @@ function setLabelStyle(normalStyle, emphasisStyle, normalModel, emphasisModel, o
|
|
|
753
756
|
|
|
754
757
|
if (showNormal || showEmphasis) {
|
|
755
758
|
if (labelFetcher) {
|
|
756
|
-
baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
|
|
759
|
+
baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
|
|
757
760
|
}
|
|
758
761
|
|
|
759
762
|
if (baseText == null) {
|
|
@@ -762,7 +765,7 @@ function setLabelStyle(normalStyle, emphasisStyle, normalModel, emphasisModel, o
|
|
|
762
765
|
}
|
|
763
766
|
|
|
764
767
|
var normalStyleText = showNormal ? baseText : null;
|
|
765
|
-
var emphasisStyleText = showEmphasis ? zrUtil.retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex) : null, baseText) : null; // Optimize: If style.text is null, text will not be drawn.
|
|
768
|
+
var emphasisStyleText = showEmphasis ? zrUtil.retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp) : null, baseText) : null; // Optimize: If style.text is null, text will not be drawn.
|
|
766
769
|
|
|
767
770
|
if (normalStyleText != null || emphasisStyleText != null) {
|
|
768
771
|
// Always set `textStyle` even if `normalStyle.text` is null, because default
|