You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2020/05/06 10:03:41 UTC
[incubator-echarts] 01/02: release: 4.8.0
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch release-dev
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit ced2c237dbe4fad632a4b1ea135f77040acd4525
Author: 100pah <su...@gmail.com>
AuthorDate: Wed May 6 18:01:14 2020 +0800
release: 4.8.0
---
dist/echarts-en.common.js | 520 ++++++++++++++++++++---------
dist/echarts-en.common.min.js | 2 +-
dist/echarts-en.js | 737 +++++++++++++++++++++++++++++-------------
dist/echarts-en.js.map | 2 +-
dist/echarts-en.min.js | 2 +-
dist/echarts-en.simple.js | 435 ++++++++++++++++++-------
dist/echarts-en.simple.min.js | 2 +-
dist/echarts.common.js | 494 +++++++++++++++++++---------
dist/echarts.common.min.js | 2 +-
dist/echarts.js | 711 +++++++++++++++++++++++++++-------------
dist/echarts.js.map | 2 +-
dist/echarts.min.js | 2 +-
dist/echarts.simple.js | 409 ++++++++++++++++-------
dist/echarts.simple.min.js | 2 +-
dist/extension/bmap.js | 338 ++++++++++++++++++-
dist/extension/bmap.js.map | 2 +-
dist/extension/bmap.min.js | 2 +-
extension/bmap/BMapView.js | 8 +-
package.json | 4 +-
src/echarts.js | 4 +-
20 files changed, 2658 insertions(+), 1022 deletions(-)
diff --git a/dist/echarts-en.common.js b/dist/echarts-en.common.js
index beb0f26..900be34 100644
--- a/dist/echarts-en.common.js
+++ b/dist/echarts-en.common.js
@@ -10252,6 +10252,10 @@ Painter.prototype = {
if (this._layerConfig[zlevel]) {
merge(layer, this._layerConfig[zlevel], true);
}
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
+ else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
+ merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
+ }
if (virtual) {
layer.virtual = virtual;
@@ -10404,12 +10408,26 @@ Painter.prototype = {
var prevLayer = null;
var incrementalLayerCount = 0;
+ var prevZlevel;
for (var i = 0; i < list.length; i++) {
var el = list[i];
var zlevel = el.zlevel;
var layer;
- // PENDING If change one incremental element style ?
- // TODO Where there are non-incremental elements between incremental elements.
+
+ if (prevZlevel !== zlevel) {
+ prevZlevel = zlevel;
+ incrementalLayerCount = 0;
+ }
+
+ // TODO Not use magic number on zlevel.
+
+ // Each layer with increment element can be separated to 3 layers.
+ // (Other Element drawn after incremental element)
+ // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------
+ // (Incremental element)
+ // ----------------------zlevel + INCREMENTAL_INC------------------------
+ // (Element drawn before incremental element)
+ // --------------------------------zlevel--------------------------------
if (el.incremental) {
layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
layer.incremental = true;
@@ -10504,6 +10522,7 @@ Painter.prototype = {
for (var i = 0; i < this._zlevelList.length; i++) {
var _zlevel = this._zlevelList[i];
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
var layer = this._layers[_zlevel];
merge(layer, layerConfig[zlevel], true);
@@ -11576,7 +11595,7 @@ var instances$1 = {}; // ZRender实例map索引
/**
* @type {string}
*/
-var version$1 = '4.3.0';
+var version$1 = '4.3.1';
/**
* Initializing a zrender instance
@@ -17782,11 +17801,13 @@ function getHighlightDigit(highlightKey) {
* @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
* @param {string|Function} [opt.defaultText]
* @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDataIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDimIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {string} [opt.labelProp] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
* @param {Object} [normalSpecified]
* @param {Object} [emphasisSpecified]
*/
@@ -17800,6 +17821,7 @@ function setLabelStyle(
var labelFetcher = opt.labelFetcher;
var labelDataIndex = opt.labelDataIndex;
var labelDimIndex = opt.labelDimIndex;
+ var labelProp = opt.labelProp;
// This scenario, `label.normal.show = true; label.emphasis.show = false`,
// is not supported util someone requests.
@@ -17813,7 +17835,7 @@ function setLabelStyle(
var baseText;
if (showNormal || showEmphasis) {
if (labelFetcher) {
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
}
if (baseText == null) {
baseText = isFunction$1(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -17823,7 +17845,7 @@ function setLabelStyle(
var emphasisStyleText = showEmphasis
? retrieve2(
labelFetcher
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
: null,
baseText
)
@@ -19734,7 +19756,7 @@ var number = (Object.freeze || Object)({
// import Text from 'zrender/src/graphic/Text';
/**
- * 每三位默认加,格式化
+ * add commas after every three numbers
* @param {string|number} x
* @return {string}
*/
@@ -19987,6 +20009,22 @@ function getTextRect(
);
}
+/**
+ * open new tab
+ * @param {string} link url
+ * @param {string} target blank or self
+ */
+function windowOpen(link, target) {
+ if (target === '_blank' || target === 'blank') {
+ var blank = window.open();
+ blank.opener = null;
+ blank.location = link;
+ }
+ else {
+ window.open(link, target);
+ }
+}
+
var format = (Object.freeze || Object)({
addCommas: addCommas,
@@ -20000,7 +20038,8 @@ var format = (Object.freeze || Object)({
capitalFirst: capitalFirst,
truncateText: truncateText$1,
getTextBoundingRect: getTextBoundingRect,
- getTextRect: getTextRect
+ getTextRect: getTextRect,
+ windowOpen: windowOpen
});
/*
@@ -24981,7 +25020,7 @@ function dataTaskReset(context) {
function dataTaskProgress(param, context) {
// Avoid repead cloneShallow when data just created in reset.
- if (param.end > context.outputData.count()) {
+ if (context.outputData && param.end > context.outputData.count()) {
context.model.getRawData().cloneShallow(context.outputData);
}
}
@@ -25703,6 +25742,32 @@ var lang = {
lang: ['Right Click to Save Image']
}
},
+ series: {
+ typeNames: {
+ pie: 'Pie chart',
+ bar: 'Bar chart',
+ line: 'Line chart',
+ scatter: 'Scatter plot',
+ effectScatter: 'Ripple scatter plot',
+ radar: 'Radar chart',
+ tree: 'Tree',
+ treemap: 'Treemap',
+ boxplot: 'Boxplot',
+ candlestick: 'Candlestick',
+ k: 'K line chart',
+ heatmap: 'Heat map',
+ map: 'Map',
+ parallel: 'Parallel coordinate map',
+ lines: 'Line graph',
+ graph: 'Relationship graph',
+ sankey: 'Sankey diagram',
+ funnel: 'Funnel chart',
+ gauge: 'Guage',
+ pictorialBar: 'Pictorial bar',
+ themeRiver: 'Theme River Map',
+ sunburst: 'Sunburst'
+ }
+ },
aria: {
general: {
withTitle: 'This is a chart about "{title}"',
@@ -25935,11 +26000,16 @@ var loadingDefault = function (api, opts) {
opts = opts || {};
defaults(opts, {
text: 'loading',
- color: '#c23531',
textColor: '#000',
+ fontSize: '12px',
maskColor: 'rgba(255, 255, 255, 0.8)',
+ showSpinner: true,
+ color: '#c23531',
+ spinnerRadius: 10,
+ lineWidth: 5,
zlevel: 0
});
+ var group = new Group();
var mask = new Rect({
style: {
fill: opts.maskColor
@@ -25947,24 +26017,13 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10000
});
- var arc = new Arc({
- shape: {
- startAngle: -PI$1 / 2,
- endAngle: -PI$1 / 2 + 0.1,
- r: 10
- },
- style: {
- stroke: opts.color,
- lineCap: 'round',
- lineWidth: 5
- },
- zlevel: opts.zlevel,
- z: 10001
- });
+ group.add(mask);
+ var font = opts.fontSize + ' sans-serif';
var labelRect = new Rect({
style: {
fill: 'none',
text: opts.text,
+ font: font,
textPosition: 'right',
textDistance: 10,
textFill: opts.textColor
@@ -25972,32 +26031,49 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10001
});
-
- arc.animateShape(true)
- .when(1000, {
- endAngle: PI$1 * 3 / 2
- })
- .start('circularInOut');
- arc.animateShape(true)
- .when(1000, {
- startAngle: PI$1 * 3 / 2
- })
- .delay(300)
- .start('circularInOut');
-
- var group = new Group();
- group.add(arc);
group.add(labelRect);
- group.add(mask);
+ if (opts.showSpinner) {
+ var arc = new Arc({
+ shape: {
+ startAngle: -PI$1 / 2,
+ endAngle: -PI$1 / 2 + 0.1,
+ r: opts.spinnerRadius
+ },
+ style: {
+ stroke: opts.color,
+ lineCap: 'round',
+ lineWidth: opts.lineWidth
+ },
+ zlevel: opts.zlevel,
+ z: 10001
+ });
+ arc.animateShape(true)
+ .when(1000, {
+ endAngle: PI$1 * 3 / 2
+ })
+ .start('circularInOut');
+ arc.animateShape(true)
+ .when(1000, {
+ startAngle: PI$1 * 3 / 2
+ })
+ .delay(300)
+ .start('circularInOut');
+ group.add(arc);
+ }
// Inject resize
group.resize = function () {
- var cx = api.getWidth() / 2;
+ var textWidth = getWidth(opts.text, font);
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
+ // textDistance needs to be calculated when both animation and text exist
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
+ // only show the text
+ - (opts.showSpinner ? 0 : textWidth / 2);
var cy = api.getHeight() / 2;
- arc.setShape({
+ opts.showSpinner && arc.setShape({
cx: cx,
cy: cy
});
- var r = arc.shape.r;
labelRect.setShape({
x: cx - r,
y: cy - r,
@@ -27653,10 +27729,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType;
-var version = '4.7.0';
+var version = '4.8.0';
var dependencies = {
- zrender: '4.3.0'
+ zrender: '4.3.1'
};
var TEST_FRAME_REMAIN_TIME = 1;
@@ -28075,7 +28151,7 @@ echartsProto.getRenderedCanvas = function (opts) {
* Get svg data url
* @return {string}
*/
-echartsProto.getSvgDataUrl = function () {
+echartsProto.getSvgDataURL = function () {
if (!env$1.svgSupported) {
return;
}
@@ -28087,7 +28163,7 @@ echartsProto.getSvgDataUrl = function () {
el.stopAnimation(true);
});
- return zr.painter.pathToDataUrl();
+ return zr.painter.toDataURL();
};
/**
@@ -28123,7 +28199,7 @@ echartsProto.getDataURL = function (opts) {
});
var url = this._zr.painter.getType() === 'svg'
- ? this.getSvgDataUrl()
+ ? this.getSvgDataURL()
: this.getRenderedCanvas(opts).toDataURL(
'image/' + (opts && opts.type || 'png')
);
@@ -28152,6 +28228,7 @@ echartsProto.getConnectedDataURL = function (opts) {
if (!env$1.canvasSupported) {
return;
}
+ var isSvg = opts.type === 'svg';
var groupId = this.group;
var mathMin = Math.min;
var mathMax = Math.max;
@@ -28166,9 +28243,9 @@ echartsProto.getConnectedDataURL = function (opts) {
each$1(instances, function (chart, id) {
if (chart.group === groupId) {
- var canvas = chart.getRenderedCanvas(
- clone(opts)
- );
+ var canvas = isSvg
+ ? chart.getZr().painter.getSvgDom().innerHTML
+ : chart.getRenderedCanvas(clone(opts));
var boundingRect = chart.getDom().getBoundingClientRect();
left = mathMin(boundingRect.left, left);
top = mathMin(boundingRect.top, top);
@@ -28189,38 +28266,61 @@ echartsProto.getConnectedDataURL = function (opts) {
var width = right - left;
var height = bottom - top;
var targetCanvas = createCanvas();
- targetCanvas.width = width;
- targetCanvas.height = height;
- var zr = init$1(targetCanvas);
+ var zr = init$1(targetCanvas, {
+ renderer: isSvg ? 'svg' : 'canvas'
+ });
+ zr.resize({
+ width: width,
+ height: height
+ });
- // Background between the charts
- if (opts.connectedBackgroundColor) {
- zr.add(new Rect({
- shape: {
- x: 0,
- y: 0,
- width: width,
- height: height
- },
- style: {
- fill: opts.connectedBackgroundColor
- }
- }));
+ if (isSvg) {
+ var content = '';
+ each(canvasList, function (item) {
+ var x = item.left - left;
+ var y = item.top - top;
+ content += '<g transform="translate(' + x + ','
+ + y + ')">' + item.dom + '</g>';
+ });
+ zr.painter.getSvgRoot().innerHTML = content;
+
+ if (opts.connectedBackgroundColor) {
+ zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
+ }
+
+ zr.refreshImmediately();
+ return zr.painter.toDataURL();
}
+ else {
+ // Background between the charts
+ if (opts.connectedBackgroundColor) {
+ zr.add(new Rect({
+ shape: {
+ x: 0,
+ y: 0,
+ width: width,
+ height: height
+ },
+ style: {
+ fill: opts.connectedBackgroundColor
+ }
+ }));
+ }
- each(canvasList, function (item) {
- var img = new ZImage({
- style: {
- x: item.left * dpr - left,
- y: item.top * dpr - top,
- image: item.dom
- }
+ each(canvasList, function (item) {
+ var img = new ZImage({
+ style: {
+ x: item.left * dpr - left,
+ y: item.top * dpr - top,
+ image: item.dom
+ }
+ });
+ zr.add(img);
});
- zr.add(img);
- });
- zr.refreshImmediately();
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ zr.refreshImmediately();
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ }
}
else {
return this.getDataURL(opts);
@@ -34628,9 +34728,11 @@ var largeLayout = {
coord = cartesian.dataToPoint(valuePair, null, coord);
// Data index might not be in order, depends on `progressiveChunkMode`.
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coordLayout.x + coordLayout.width : coord[0];
largePoints[pointsOffset++] = coord[0];
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coord[1] : coordLayout.y + coordLayout.height;
largePoints[pointsOffset++] = coord[1];
largeDataIndices[idxOffset++] = dataIndex;
}
@@ -35120,8 +35222,6 @@ function getScaleExtent(scale, model) {
var min = model.getMin();
var max = model.getMax();
- var fixMin = min != null;
- var fixMax = max != null;
var originalExtent = scale.getExtent();
var axisDataLen;
@@ -35165,17 +35265,6 @@ function getScaleExtent(scale, model) {
// (2) When `needCrossZero` and all data is positive/negative, should it be ensured
// that the results processed by boundaryGap are positive/negative?
- if (min == null) {
- min = scaleType === 'ordinal'
- ? (axisDataLen ? 0 : NaN)
- : originalExtent[0] - boundaryGap[0] * span;
- }
- if (max == null) {
- max = scaleType === 'ordinal'
- ? (axisDataLen ? axisDataLen - 1 : NaN)
- : originalExtent[1] + boundaryGap[1] * span;
- }
-
if (min === 'dataMin') {
min = originalExtent[0];
}
@@ -35196,6 +35285,20 @@ function getScaleExtent(scale, model) {
});
}
+ var fixMin = min != null;
+ var fixMax = max != null;
+
+ if (min == null) {
+ min = scaleType === 'ordinal'
+ ? (axisDataLen ? 0 : NaN)
+ : originalExtent[0] - boundaryGap[0] * span;
+ }
+ if (max == null) {
+ max = scaleType === 'ordinal'
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
+ : originalExtent[1] + boundaryGap[1] * span;
+ }
+
(min == null || !isFinite(min)) && (min = NaN);
(max == null || !isFinite(max)) && (max = NaN);
@@ -35246,7 +35349,13 @@ function getScaleExtent(scale, model) {
}
}
- return [min, max];
+ return {
+ extent: [min, max],
+ // "fix" means "fixed", the value should not be
+ // changed in the subsequent steps.
+ fixMin: fixMin,
+ fixMax: fixMax
+ };
}
function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -35285,9 +35394,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
}
function niceScaleExtent(scale, model) {
- var extent = getScaleExtent(scale, model);
- var fixMin = model.getMin() != null;
- var fixMax = model.getMax() != null;
+ var extentInfo = getScaleExtent(scale, model);
+ var extent = extentInfo.extent;
+
var splitNumber = model.get('splitNumber');
if (scale.type === 'log') {
@@ -35298,8 +35407,8 @@ function niceScaleExtent(scale, model) {
scale.setExtent(extent[0], extent[1]);
scale.niceExtent({
splitNumber: splitNumber,
- fixMin: fixMin,
- fixMax: fixMax,
+ fixMin: extentInfo.fixMin,
+ fixMax: extentInfo.fixMax,
minInterval: (scaleType === 'interval' || scaleType === 'time')
? model.get('minInterval') : null,
maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -36332,9 +36441,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
/**
* @alias module:echarts/coord/geo/parseGeoJson
* @param {Object} geoJson
+ * @param {string} nameProperty
* @return {module:zrender/container/Group}
*/
-var parseGeoJSON = function (geoJson) {
+var parseGeoJSON = function (geoJson, nameProperty) {
decode(geoJson);
@@ -36372,7 +36482,7 @@ var parseGeoJSON = function (geoJson) {
}
var region = new Region(
- properties.name,
+ properties[nameProperty || 'name'],
geometries,
properties.cp
);
@@ -37569,7 +37679,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var itemStyle = seriesScope && seriesScope.itemStyle;
var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
var symbolOffset = seriesScope && seriesScope.symbolOffset;
var labelModel = seriesScope && seriesScope.labelModel;
var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -37585,7 +37694,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
- symbolRotate = itemModel.getShallow('symbolRotate');
symbolOffset = itemModel.getShallow('symbolOffset');
labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -37599,6 +37707,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var elStyle = symbolPath.style;
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
+
symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
if (symbolOffset) {
@@ -38654,6 +38764,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
width += lineWidth;
height += lineWidth;
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
+ x = Math.floor(x);
+ width = Math.round(width);
+
var clipPath = new Rect({
shape: {
x: x,
@@ -38751,6 +38865,26 @@ function isPointsSame(points1, points2) {
return true;
}
+function getBoundingDiff(points1, points2) {
+ var min1 = [];
+ var max1 = [];
+
+ var min2 = [];
+ var max2 = [];
+
+ fromPoints(points1, min1, max1);
+ fromPoints(points2, min2, max2);
+
+ // Get a max value from each corner of two boundings.
+ 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])
+ );
+}
+
function getSmooth(smooth) {
return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
}
@@ -39363,6 +39497,24 @@ Chart.extend({
next = turnPointsIntoStep(diff.next, coordSys, step);
stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
}
+ // Don't apply animation if diff is large.
+ // For better result and avoid memory explosion problems like
+ // https://github.com/apache/incubator-echarts/issues/12229
+ if (getBoundingDiff(current, next) > 3000
+ || (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
+ ) {
+ polyline.setShape({
+ points: next
+ });
+ if (polygon) {
+ polygon.setShape({
+ points: next,
+ stackedOnPoints: stackedOnNext
+ });
+ }
+ return;
+ }
+
// `diff.current` is subset of `current` (which should be ensured by
// turnPointsIntoStep), so points in `__points` can be updated when
// points in `current` are update during animation.
@@ -39469,13 +39621,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var symbolType = seriesModel.get('symbol');
var symbolSize = seriesModel.get('symbolSize');
var keepAspect = seriesModel.get('symbolKeepAspect');
+ var symbolRotate = seriesModel.get('symbolRotate');
var hasSymbolTypeCallback = isFunction$1(symbolType);
var hasSymbolSizeCallback = isFunction$1(symbolSize);
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
-
data.setVisual({
legendSymbol: legendSymbol || seriesSymbol,
// If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -39484,7 +39637,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// some cases but generally it is not recommanded.
symbol: seriesSymbol,
symbolSize: seriesSymbolSize,
- symbolKeepAspect: keepAspect
+ symbolKeepAspect: keepAspect,
+ symbolRotate: symbolRotate
});
// Only visible series has each data be visual encoded
@@ -39498,12 +39652,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var params = seriesModel.getDataParams(idx);
hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
}
if (data.hasItemOption) {
var itemModel = data.getItemModel(idx);
var itemSymbolType = itemModel.getShallow('symbol', true);
var itemSymbolSize = itemModel.getShallow('symbolSize', true);
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
// If has item symbol
@@ -39514,6 +39670,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// PENDING Transform symbolSize ?
data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
}
+ if (itemSymbolRotate != null) {
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
+ }
if (itemSymbolKeepAspect != null) {
data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
}
@@ -43389,6 +43548,7 @@ extendChartView({
var drawBackground = seriesModel.get('showBackground', true);
var backgroundModel = seriesModel.getModel('backgroundStyle');
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
var bgEls = [];
var oldBgEls = this._backgroundEls || [];
@@ -43399,8 +43559,13 @@ extendChartView({
var layout = getLayout[coord.type](data, dataIndex, itemModel);
if (drawBackground) {
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
+ var bgLayout = getLayout[coord.type](data, dataIndex);
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[dataIndex] = bgEl;
}
@@ -43437,9 +43602,14 @@ extendChartView({
if (drawBackground) {
var bgEl = oldBgEls[oldIndex];
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[newIndex] = bgEl;
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
+ var bgLayout = getLayout[coord.type](data, newIndex);
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
updateProps(bgEl, { shape: shape }, animationModel, newIndex);
}
@@ -43689,9 +43859,11 @@ function removeSector(dataIndex, animationModel, el) {
}
var getLayout = {
+ // itemModel is only used to get borderWidth, which is not needed
+ // when calculating bar background layout.
cartesian2d: function (data, dataIndex, itemModel) {
var layout = data.getItemLayout(dataIndex);
- var fixedLineWidth = getLineWidth(itemModel, layout);
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
// fix layout with lineWidth
var signX = layout.width > 0 ? 1 : -1;
@@ -44565,31 +44737,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
this._updateLabel(data, idx, withAnimation);
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
+ this.highDownOnUpdate = !seriesModel.get('silent')
? function (fromState, toState) {
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
if (toState === 'emphasis') {
labelLine.ignore = labelLine.hoverIgnore;
labelText.ignore = labelText.hoverIgnore;
// Sector may has animation of updating data. Force to move to the last frame
// Or it may stopped on the wrong shape
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r + seriesModel.get('hoverOffset')
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r + seriesModel.get('hoverOffset')
+ }
+ }, 300, 'elasticOut');
+ }
}
else {
labelLine.ignore = labelLine.normalIgnore;
labelText.ignore = labelText.normalIgnore;
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r
+ }
+ }, 300, 'elasticOut');
+ }
}
}
: null;
@@ -49549,7 +49726,7 @@ extendComponentView({
var dataModel = el.dataModel || seriesModel;
var dataIndex = el.dataIndex;
var dataType = el.dataType;
- var data = dataModel.getData();
+ var data = dataModel.getData(dataType);
var tooltipModel = buildTooltipModel([
data.getItemModel(dataIndex),
@@ -51894,12 +52071,12 @@ extendComponentView({
if (link) {
textEl.on('click', function () {
- window.open(link, '_' + titleModel.get('target'));
+ windowOpen(link, '_' + titleModel.get('target'));
});
}
if (sublink) {
subTextEl.on('click', function () {
- window.open(sublink, '_' + titleModel.get('subtarget'));
+ windowOpen(link, '_' + titleModel.get('subtarget'));
});
}
@@ -53389,9 +53566,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
this.group.removeAll();
};
+function isEffectObject(el) {
+ return el.animators && el.animators.length > 0;
+}
+
lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
function updateIncrementalAndHover(el) {
- if (!el.isGroup) {
+ if (!el.isGroup && !isEffectObject(el)) {
el.incremental = el.useHoverLayer = true;
}
}
@@ -57899,7 +58080,7 @@ extendComponentView({
var feature;
// FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
- if (payload && payload.newTitle != null) {
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
featureOpt.title = payload.newTitle;
}
@@ -58172,7 +58353,8 @@ var proto$2 = SaveAsImage.prototype;
proto$2.onclick = function (ecModel, api) {
var model = this.model;
var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
- var type = model.get('type', true) || 'png';
+ var isSvg = api.getZr().painter.getType() === 'svg';
+ var type = isSvg ? 'svg' : model.get('type', true) || 'png';
var url = api.getConnectedDataURL({
type: type,
backgroundColor: model.get('backgroundColor', true)
@@ -58399,7 +58581,8 @@ proto$3.onclick = function (ecModel, api, type) {
type: 'changeMagicType',
currentType: type,
newOption: newOption,
- newTitle: newTitle
+ newTitle: newTitle,
+ featureName: 'magicType'
});
};
@@ -63928,11 +64111,16 @@ var SVGPainter = function (root, storage, opts, zrId) {
this.storage = storage;
this._opts = opts = extend({}, opts || {});
- var svgRoot = createElement('svg');
- svgRoot.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
- svgRoot.setAttribute('version', '1.1');
- svgRoot.setAttribute('baseProfile', 'full');
- svgRoot.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
+ var svgDom = createElement('svg');
+ svgDom.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
+ svgDom.setAttribute('version', '1.1');
+ svgDom.setAttribute('baseProfile', 'full');
+ svgDom.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
+
+ var bgRoot = createElement('g');
+ svgDom.appendChild(bgRoot);
+ var svgRoot = createElement('g');
+ svgDom.appendChild(svgRoot);
this.gradientManager = new GradientManager(zrId, svgRoot);
this.clipPathManager = new ClippathManager(zrId, svgRoot);
@@ -63941,11 +64129,13 @@ var SVGPainter = function (root, storage, opts, zrId) {
var viewport = document.createElement('div');
viewport.style.cssText = 'overflow:hidden;position:relative';
+ this._svgDom = svgDom;
this._svgRoot = svgRoot;
+ this._backgroundRoot = bgRoot;
this._viewport = viewport;
root.appendChild(viewport);
- viewport.appendChild(svgRoot);
+ viewport.appendChild(svgDom);
this.resize(opts.width, opts.height);
@@ -63964,6 +64154,14 @@ SVGPainter.prototype = {
return this._viewport;
},
+ getSvgDom: function () {
+ return this._svgDom;
+ },
+
+ getSvgRoot: function () {
+ return this._svgRoot;
+ },
+
getViewportRootOffset: function () {
var viewportRoot = this.getViewportRoot();
if (viewportRoot) {
@@ -63983,7 +64181,21 @@ SVGPainter.prototype = {
setBackgroundColor: function (backgroundColor) {
// TODO gradient
- this._viewport.style.background = backgroundColor;
+ // Insert a bg rect instead of setting background to viewport.
+ // Otherwise, the exported SVG don't have background.
+ if (this._backgroundRoot && this._backgroundNode) {
+ this._backgroundRoot.removeChild(this._backgroundNode);
+ }
+
+ var bgNode = createElement('rect');
+ bgNode.setAttribute('width', this.getWidth());
+ bgNode.setAttribute('height', this.getHeight());
+ bgNode.setAttribute('x', 0);
+ bgNode.setAttribute('y', 0);
+ bgNode.setAttribute('id', 0);
+ bgNode.style.fill = backgroundColor;
+ this._backgroundRoot.appendChild(bgNode);
+ this._backgroundNode = bgNode;
},
_paintList: function (list) {
@@ -64113,8 +64325,8 @@ SVGPainter.prototype = {
},
_getDefs: function (isForceCreating) {
- var svgRoot = this._svgRoot;
- var defs = this._svgRoot.getElementsByTagName('defs');
+ var svgRoot = this._svgDom;
+ var defs = svgRoot.getElementsByTagName('defs');
if (defs.length === 0) {
// Not exist
if (isForceCreating) {
@@ -64171,11 +64383,16 @@ SVGPainter.prototype = {
viewportStyle.width = width + 'px';
viewportStyle.height = height + 'px';
- var svgRoot = this._svgRoot;
+ var svgRoot = this._svgDom;
// Set width by 'svgRoot.width = width' is invalid
svgRoot.setAttribute('width', width);
svgRoot.setAttribute('height', height);
}
+
+ if (this._backgroundNode) {
+ this._backgroundNode.setAttribute('width', width);
+ this._backgroundNode.setAttribute('height', height);
+ }
},
/**
@@ -64217,10 +64434,13 @@ SVGPainter.prototype = {
dispose: function () {
this.root.innerHTML = '';
- this._svgRoot =
- this._viewport =
- this.storage =
- null;
+ this._svgRoot
+ = this._backgroundRoot
+ = this._svgDom
+ = this._backgroundNode
+ = this._viewport
+ = this.storage
+ = null;
},
clear: function () {
@@ -64229,9 +64449,9 @@ SVGPainter.prototype = {
}
},
- pathToDataUrl: function () {
+ toDataURL: function () {
this.refresh();
- var html = this._svgRoot.outerHTML;
+ var html = encodeURIComponent(this._svgDom.outerHTML.replace(/></g, '>\n\r<'));
return 'data:image/svg+xml;charset=UTF-8,' + html;
}
};
@@ -64247,7 +64467,7 @@ function createMethodNotSupport$1(method) {
each$1([
'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer',
'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer',
- 'toDataURL', 'pathToImage'
+ 'pathToImage'
], function (name) {
SVGPainter.prototype[name] = createMethodNotSupport$1(name);
});
diff --git a/dist/echarts-en.common.min.js b/dist/echarts-en.common.min.js
index 012873f..0e025de 100644
--- a/dist/echarts-en.common.min.js
+++ b/dist/echarts-en.common.min.js
@@ -19,4 +19,4 @@
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,i=function(){return e++},v="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,i=function(){return e++},v="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
diff --git a/dist/echarts-en.js b/dist/echarts-en.js
index 34f3d5b..69dc8fc 100644
--- a/dist/echarts-en.js
+++ b/dist/echarts-en.js
@@ -10252,6 +10252,10 @@ Painter.prototype = {
if (this._layerConfig[zlevel]) {
merge(layer, this._layerConfig[zlevel], true);
}
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
+ else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
+ merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
+ }
if (virtual) {
layer.virtual = virtual;
@@ -10404,12 +10408,26 @@ Painter.prototype = {
var prevLayer = null;
var incrementalLayerCount = 0;
+ var prevZlevel;
for (var i = 0; i < list.length; i++) {
var el = list[i];
var zlevel = el.zlevel;
var layer;
- // PENDING If change one incremental element style ?
- // TODO Where there are non-incremental elements between incremental elements.
+
+ if (prevZlevel !== zlevel) {
+ prevZlevel = zlevel;
+ incrementalLayerCount = 0;
+ }
+
+ // TODO Not use magic number on zlevel.
+
+ // Each layer with increment element can be separated to 3 layers.
+ // (Other Element drawn after incremental element)
+ // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------
+ // (Incremental element)
+ // ----------------------zlevel + INCREMENTAL_INC------------------------
+ // (Element drawn before incremental element)
+ // --------------------------------zlevel--------------------------------
if (el.incremental) {
layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
layer.incremental = true;
@@ -10504,6 +10522,7 @@ Painter.prototype = {
for (var i = 0; i < this._zlevelList.length; i++) {
var _zlevel = this._zlevelList[i];
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
var layer = this._layers[_zlevel];
merge(layer, layerConfig[zlevel], true);
@@ -11576,7 +11595,7 @@ var instances$1 = {}; // ZRender实例map索引
/**
* @type {string}
*/
-var version$1 = '4.3.0';
+var version$1 = '4.3.1';
/**
* Initializing a zrender instance
@@ -17838,11 +17857,13 @@ function getHighlightDigit(highlightKey) {
* @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
* @param {string|Function} [opt.defaultText]
* @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDataIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDimIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {string} [opt.labelProp] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
* @param {Object} [normalSpecified]
* @param {Object} [emphasisSpecified]
*/
@@ -17856,6 +17877,7 @@ function setLabelStyle(
var labelFetcher = opt.labelFetcher;
var labelDataIndex = opt.labelDataIndex;
var labelDimIndex = opt.labelDimIndex;
+ var labelProp = opt.labelProp;
// This scenario, `label.normal.show = true; label.emphasis.show = false`,
// is not supported util someone requests.
@@ -17869,7 +17891,7 @@ function setLabelStyle(
var baseText;
if (showNormal || showEmphasis) {
if (labelFetcher) {
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
}
if (baseText == null) {
baseText = isFunction$1(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -17879,7 +17901,7 @@ function setLabelStyle(
var emphasisStyleText = showEmphasis
? retrieve2(
labelFetcher
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
: null,
baseText
)
@@ -19790,7 +19812,7 @@ var number = (Object.freeze || Object)({
// import Text from 'zrender/src/graphic/Text';
/**
- * 每三位默认加,格式化
+ * add commas after every three numbers
* @param {string|number} x
* @return {string}
*/
@@ -20043,6 +20065,22 @@ function getTextRect(
);
}
+/**
+ * open new tab
+ * @param {string} link url
+ * @param {string} target blank or self
+ */
+function windowOpen(link, target) {
+ if (target === '_blank' || target === 'blank') {
+ var blank = window.open();
+ blank.opener = null;
+ blank.location = link;
+ }
+ else {
+ window.open(link, target);
+ }
+}
+
var format = (Object.freeze || Object)({
addCommas: addCommas,
@@ -20056,7 +20094,8 @@ var format = (Object.freeze || Object)({
capitalFirst: capitalFirst,
truncateText: truncateText$1,
getTextBoundingRect: getTextBoundingRect,
- getTextRect: getTextRect
+ getTextRect: getTextRect,
+ windowOpen: windowOpen
});
/*
@@ -25060,7 +25099,7 @@ function dataTaskReset(context) {
function dataTaskProgress(param, context) {
// Avoid repead cloneShallow when data just created in reset.
- if (param.end > context.outputData.count()) {
+ if (context.outputData && param.end > context.outputData.count()) {
context.model.getRawData().cloneShallow(context.outputData);
}
}
@@ -25782,6 +25821,32 @@ var lang = {
lang: ['Right Click to Save Image']
}
},
+ series: {
+ typeNames: {
+ pie: 'Pie chart',
+ bar: 'Bar chart',
+ line: 'Line chart',
+ scatter: 'Scatter plot',
+ effectScatter: 'Ripple scatter plot',
+ radar: 'Radar chart',
+ tree: 'Tree',
+ treemap: 'Treemap',
+ boxplot: 'Boxplot',
+ candlestick: 'Candlestick',
+ k: 'K line chart',
+ heatmap: 'Heat map',
+ map: 'Map',
+ parallel: 'Parallel coordinate map',
+ lines: 'Line graph',
+ graph: 'Relationship graph',
+ sankey: 'Sankey diagram',
+ funnel: 'Funnel chart',
+ gauge: 'Guage',
+ pictorialBar: 'Pictorial bar',
+ themeRiver: 'Theme River Map',
+ sunburst: 'Sunburst'
+ }
+ },
aria: {
general: {
withTitle: 'This is a chart about "{title}"',
@@ -26014,11 +26079,16 @@ var loadingDefault = function (api, opts) {
opts = opts || {};
defaults(opts, {
text: 'loading',
- color: '#c23531',
textColor: '#000',
+ fontSize: '12px',
maskColor: 'rgba(255, 255, 255, 0.8)',
+ showSpinner: true,
+ color: '#c23531',
+ spinnerRadius: 10,
+ lineWidth: 5,
zlevel: 0
});
+ var group = new Group();
var mask = new Rect({
style: {
fill: opts.maskColor
@@ -26026,24 +26096,13 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10000
});
- var arc = new Arc({
- shape: {
- startAngle: -PI$1 / 2,
- endAngle: -PI$1 / 2 + 0.1,
- r: 10
- },
- style: {
- stroke: opts.color,
- lineCap: 'round',
- lineWidth: 5
- },
- zlevel: opts.zlevel,
- z: 10001
- });
+ group.add(mask);
+ var font = opts.fontSize + ' sans-serif';
var labelRect = new Rect({
style: {
fill: 'none',
text: opts.text,
+ font: font,
textPosition: 'right',
textDistance: 10,
textFill: opts.textColor
@@ -26051,32 +26110,49 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10001
});
-
- arc.animateShape(true)
- .when(1000, {
- endAngle: PI$1 * 3 / 2
- })
- .start('circularInOut');
- arc.animateShape(true)
- .when(1000, {
- startAngle: PI$1 * 3 / 2
- })
- .delay(300)
- .start('circularInOut');
-
- var group = new Group();
- group.add(arc);
group.add(labelRect);
- group.add(mask);
+ if (opts.showSpinner) {
+ var arc = new Arc({
+ shape: {
+ startAngle: -PI$1 / 2,
+ endAngle: -PI$1 / 2 + 0.1,
+ r: opts.spinnerRadius
+ },
+ style: {
+ stroke: opts.color,
+ lineCap: 'round',
+ lineWidth: opts.lineWidth
+ },
+ zlevel: opts.zlevel,
+ z: 10001
+ });
+ arc.animateShape(true)
+ .when(1000, {
+ endAngle: PI$1 * 3 / 2
+ })
+ .start('circularInOut');
+ arc.animateShape(true)
+ .when(1000, {
+ startAngle: PI$1 * 3 / 2
+ })
+ .delay(300)
+ .start('circularInOut');
+ group.add(arc);
+ }
// Inject resize
group.resize = function () {
- var cx = api.getWidth() / 2;
+ var textWidth = getWidth(opts.text, font);
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
+ // textDistance needs to be calculated when both animation and text exist
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
+ // only show the text
+ - (opts.showSpinner ? 0 : textWidth / 2);
var cy = api.getHeight() / 2;
- arc.setShape({
+ opts.showSpinner && arc.setShape({
cx: cx,
cy: cy
});
- var r = arc.shape.r;
labelRect.setShape({
x: cx - r,
y: cy - r,
@@ -27736,10 +27812,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType;
-var version = '4.7.0';
+var version = '4.8.0';
var dependencies = {
- zrender: '4.3.0'
+ zrender: '4.3.1'
};
var TEST_FRAME_REMAIN_TIME = 1;
@@ -28158,7 +28234,7 @@ echartsProto.getRenderedCanvas = function (opts) {
* Get svg data url
* @return {string}
*/
-echartsProto.getSvgDataUrl = function () {
+echartsProto.getSvgDataURL = function () {
if (!env$1.svgSupported) {
return;
}
@@ -28170,7 +28246,7 @@ echartsProto.getSvgDataUrl = function () {
el.stopAnimation(true);
});
- return zr.painter.pathToDataUrl();
+ return zr.painter.toDataURL();
};
/**
@@ -28206,7 +28282,7 @@ echartsProto.getDataURL = function (opts) {
});
var url = this._zr.painter.getType() === 'svg'
- ? this.getSvgDataUrl()
+ ? this.getSvgDataURL()
: this.getRenderedCanvas(opts).toDataURL(
'image/' + (opts && opts.type || 'png')
);
@@ -28235,6 +28311,7 @@ echartsProto.getConnectedDataURL = function (opts) {
if (!env$1.canvasSupported) {
return;
}
+ var isSvg = opts.type === 'svg';
var groupId = this.group;
var mathMin = Math.min;
var mathMax = Math.max;
@@ -28249,9 +28326,9 @@ echartsProto.getConnectedDataURL = function (opts) {
each$1(instances, function (chart, id) {
if (chart.group === groupId) {
- var canvas = chart.getRenderedCanvas(
- clone(opts)
- );
+ var canvas = isSvg
+ ? chart.getZr().painter.getSvgDom().innerHTML
+ : chart.getRenderedCanvas(clone(opts));
var boundingRect = chart.getDom().getBoundingClientRect();
left = mathMin(boundingRect.left, left);
top = mathMin(boundingRect.top, top);
@@ -28272,38 +28349,61 @@ echartsProto.getConnectedDataURL = function (opts) {
var width = right - left;
var height = bottom - top;
var targetCanvas = createCanvas();
- targetCanvas.width = width;
- targetCanvas.height = height;
- var zr = init$1(targetCanvas);
+ var zr = init$1(targetCanvas, {
+ renderer: isSvg ? 'svg' : 'canvas'
+ });
+ zr.resize({
+ width: width,
+ height: height
+ });
- // Background between the charts
- if (opts.connectedBackgroundColor) {
- zr.add(new Rect({
- shape: {
- x: 0,
- y: 0,
- width: width,
- height: height
- },
- style: {
- fill: opts.connectedBackgroundColor
- }
- }));
+ if (isSvg) {
+ var content = '';
+ each(canvasList, function (item) {
+ var x = item.left - left;
+ var y = item.top - top;
+ content += '<g transform="translate(' + x + ','
+ + y + ')">' + item.dom + '</g>';
+ });
+ zr.painter.getSvgRoot().innerHTML = content;
+
+ if (opts.connectedBackgroundColor) {
+ zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
+ }
+
+ zr.refreshImmediately();
+ return zr.painter.toDataURL();
}
+ else {
+ // Background between the charts
+ if (opts.connectedBackgroundColor) {
+ zr.add(new Rect({
+ shape: {
+ x: 0,
+ y: 0,
+ width: width,
+ height: height
+ },
+ style: {
+ fill: opts.connectedBackgroundColor
+ }
+ }));
+ }
- each(canvasList, function (item) {
- var img = new ZImage({
- style: {
- x: item.left * dpr - left,
- y: item.top * dpr - top,
- image: item.dom
- }
+ each(canvasList, function (item) {
+ var img = new ZImage({
+ style: {
+ x: item.left * dpr - left,
+ y: item.top * dpr - top,
+ image: item.dom
+ }
+ });
+ zr.add(img);
});
- zr.add(img);
- });
- zr.refreshImmediately();
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ zr.refreshImmediately();
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ }
}
else {
return this.getDataURL(opts);
@@ -34738,9 +34838,11 @@ var largeLayout = {
coord = cartesian.dataToPoint(valuePair, null, coord);
// Data index might not be in order, depends on `progressiveChunkMode`.
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coordLayout.x + coordLayout.width : coord[0];
largePoints[pointsOffset++] = coord[0];
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coord[1] : coordLayout.y + coordLayout.height;
largePoints[pointsOffset++] = coord[1];
largeDataIndices[idxOffset++] = dataIndex;
}
@@ -35230,8 +35332,6 @@ function getScaleExtent(scale, model) {
var min = model.getMin();
var max = model.getMax();
- var fixMin = min != null;
- var fixMax = max != null;
var originalExtent = scale.getExtent();
var axisDataLen;
@@ -35275,17 +35375,6 @@ function getScaleExtent(scale, model) {
// (2) When `needCrossZero` and all data is positive/negative, should it be ensured
// that the results processed by boundaryGap are positive/negative?
- if (min == null) {
- min = scaleType === 'ordinal'
- ? (axisDataLen ? 0 : NaN)
- : originalExtent[0] - boundaryGap[0] * span;
- }
- if (max == null) {
- max = scaleType === 'ordinal'
- ? (axisDataLen ? axisDataLen - 1 : NaN)
- : originalExtent[1] + boundaryGap[1] * span;
- }
-
if (min === 'dataMin') {
min = originalExtent[0];
}
@@ -35306,6 +35395,20 @@ function getScaleExtent(scale, model) {
});
}
+ var fixMin = min != null;
+ var fixMax = max != null;
+
+ if (min == null) {
+ min = scaleType === 'ordinal'
+ ? (axisDataLen ? 0 : NaN)
+ : originalExtent[0] - boundaryGap[0] * span;
+ }
+ if (max == null) {
+ max = scaleType === 'ordinal'
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
+ : originalExtent[1] + boundaryGap[1] * span;
+ }
+
(min == null || !isFinite(min)) && (min = NaN);
(max == null || !isFinite(max)) && (max = NaN);
@@ -35356,7 +35459,13 @@ function getScaleExtent(scale, model) {
}
}
- return [min, max];
+ return {
+ extent: [min, max],
+ // "fix" means "fixed", the value should not be
+ // changed in the subsequent steps.
+ fixMin: fixMin,
+ fixMax: fixMax
+ };
}
function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -35395,9 +35504,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
}
function niceScaleExtent(scale, model) {
- var extent = getScaleExtent(scale, model);
- var fixMin = model.getMin() != null;
- var fixMax = model.getMax() != null;
+ var extentInfo = getScaleExtent(scale, model);
+ var extent = extentInfo.extent;
+
var splitNumber = model.get('splitNumber');
if (scale.type === 'log') {
@@ -35408,8 +35517,8 @@ function niceScaleExtent(scale, model) {
scale.setExtent(extent[0], extent[1]);
scale.niceExtent({
splitNumber: splitNumber,
- fixMin: fixMin,
- fixMax: fixMax,
+ fixMin: extentInfo.fixMin,
+ fixMax: extentInfo.fixMax,
minInterval: (scaleType === 'interval' || scaleType === 'time')
? model.get('minInterval') : null,
maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -36442,9 +36551,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
/**
* @alias module:echarts/coord/geo/parseGeoJson
* @param {Object} geoJson
+ * @param {string} nameProperty
* @return {module:zrender/container/Group}
*/
-var parseGeoJson$1 = function (geoJson) {
+var parseGeoJson$1 = function (geoJson, nameProperty) {
decode(geoJson);
@@ -36482,7 +36592,7 @@ var parseGeoJson$1 = function (geoJson) {
}
var region = new Region(
- properties.name,
+ properties[nameProperty || 'name'],
geometries,
properties.cp
);
@@ -37679,7 +37789,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var itemStyle = seriesScope && seriesScope.itemStyle;
var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
var symbolOffset = seriesScope && seriesScope.symbolOffset;
var labelModel = seriesScope && seriesScope.labelModel;
var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -37695,7 +37804,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
- symbolRotate = itemModel.getShallow('symbolRotate');
symbolOffset = itemModel.getShallow('symbolOffset');
labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -37709,6 +37817,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var elStyle = symbolPath.style;
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
+
symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
if (symbolOffset) {
@@ -38764,6 +38874,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
width += lineWidth;
height += lineWidth;
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
+ x = Math.floor(x);
+ width = Math.round(width);
+
var clipPath = new Rect({
shape: {
x: x,
@@ -38861,6 +38975,26 @@ function isPointsSame(points1, points2) {
return true;
}
+function getBoundingDiff(points1, points2) {
+ var min1 = [];
+ var max1 = [];
+
+ var min2 = [];
+ var max2 = [];
+
+ fromPoints(points1, min1, max1);
+ fromPoints(points2, min2, max2);
+
+ // Get a max value from each corner of two boundings.
+ 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])
+ );
+}
+
function getSmooth(smooth) {
return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
}
@@ -39473,6 +39607,24 @@ Chart.extend({
next = turnPointsIntoStep(diff.next, coordSys, step);
stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
}
+ // Don't apply animation if diff is large.
+ // For better result and avoid memory explosion problems like
+ // https://github.com/apache/incubator-echarts/issues/12229
+ if (getBoundingDiff(current, next) > 3000
+ || (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
+ ) {
+ polyline.setShape({
+ points: next
+ });
+ if (polygon) {
+ polygon.setShape({
+ points: next,
+ stackedOnPoints: stackedOnNext
+ });
+ }
+ return;
+ }
+
// `diff.current` is subset of `current` (which should be ensured by
// turnPointsIntoStep), so points in `__points` can be updated when
// points in `current` are update during animation.
@@ -39579,13 +39731,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var symbolType = seriesModel.get('symbol');
var symbolSize = seriesModel.get('symbolSize');
var keepAspect = seriesModel.get('symbolKeepAspect');
+ var symbolRotate = seriesModel.get('symbolRotate');
var hasSymbolTypeCallback = isFunction$1(symbolType);
var hasSymbolSizeCallback = isFunction$1(symbolSize);
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
-
data.setVisual({
legendSymbol: legendSymbol || seriesSymbol,
// If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -39594,7 +39747,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// some cases but generally it is not recommanded.
symbol: seriesSymbol,
symbolSize: seriesSymbolSize,
- symbolKeepAspect: keepAspect
+ symbolKeepAspect: keepAspect,
+ symbolRotate: symbolRotate
});
// Only visible series has each data be visual encoded
@@ -39608,12 +39762,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var params = seriesModel.getDataParams(idx);
hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
}
if (data.hasItemOption) {
var itemModel = data.getItemModel(idx);
var itemSymbolType = itemModel.getShallow('symbol', true);
var itemSymbolSize = itemModel.getShallow('symbolSize', true);
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
// If has item symbol
@@ -39624,6 +39780,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// PENDING Transform symbolSize ?
data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
}
+ if (itemSymbolRotate != null) {
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
+ }
if (itemSymbolKeepAspect != null) {
data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
}
@@ -43499,6 +43658,7 @@ extendChartView({
var drawBackground = seriesModel.get('showBackground', true);
var backgroundModel = seriesModel.getModel('backgroundStyle');
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
var bgEls = [];
var oldBgEls = this._backgroundEls || [];
@@ -43509,8 +43669,13 @@ extendChartView({
var layout = getLayout[coord.type](data, dataIndex, itemModel);
if (drawBackground) {
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
+ var bgLayout = getLayout[coord.type](data, dataIndex);
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[dataIndex] = bgEl;
}
@@ -43547,9 +43712,14 @@ extendChartView({
if (drawBackground) {
var bgEl = oldBgEls[oldIndex];
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[newIndex] = bgEl;
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
+ var bgLayout = getLayout[coord.type](data, newIndex);
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
updateProps(bgEl, { shape: shape }, animationModel, newIndex);
}
@@ -43799,9 +43969,11 @@ function removeSector(dataIndex, animationModel, el) {
}
var getLayout = {
+ // itemModel is only used to get borderWidth, which is not needed
+ // when calculating bar background layout.
cartesian2d: function (data, dataIndex, itemModel) {
var layout = data.getItemLayout(dataIndex);
- var fixedLineWidth = getLineWidth(itemModel, layout);
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
// fix layout with lineWidth
var signX = layout.width > 0 ? 1 : -1;
@@ -44675,31 +44847,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
this._updateLabel(data, idx, withAnimation);
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
+ this.highDownOnUpdate = !seriesModel.get('silent')
? function (fromState, toState) {
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
if (toState === 'emphasis') {
labelLine.ignore = labelLine.hoverIgnore;
labelText.ignore = labelText.hoverIgnore;
// Sector may has animation of updating data. Force to move to the last frame
// Or it may stopped on the wrong shape
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r + seriesModel.get('hoverOffset')
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r + seriesModel.get('hoverOffset')
+ }
+ }, 300, 'elasticOut');
+ }
}
else {
labelLine.ignore = labelLine.normalIgnore;
labelText.ignore = labelText.normalIgnore;
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r
+ }
+ }, 300, 'elasticOut');
+ }
}
}
: null;
@@ -46452,7 +46629,7 @@ Radar.prototype.update = function (ecModel, api) {
}
// Force all the axis fixing the maxSplitNumber.
each$1(indicatorAxes, function (indicatorAxis, idx) {
- var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model);
+ var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model).extent;
niceScaleExtent(indicatorAxis.scale, indicatorAxis.model);
var axisModel = indicatorAxis.model;
@@ -47572,9 +47749,10 @@ var geoJSONLoader = {
/**
* @param {string} mapName
* @param {Object} mapRecord {specialAreas, geoJSON}
+ * @param {string} nameProperty
* @return {Object} {regions, boundingRect}
*/
- load: function (mapName, mapRecord) {
+ load: function (mapName, mapRecord, nameProperty) {
var parsed = inner$7(mapRecord).parsed;
@@ -47588,7 +47766,7 @@ var geoJSONLoader = {
// https://jsperf.com/try-catch-performance-overhead
try {
- regions = geoJSON ? parseGeoJson$1(geoJSON) : [];
+ regions = geoJSON ? parseGeoJson$1(geoJSON, nameProperty) : [];
}
catch (e) {
throw new Error('Invalid geoJson format\n' + e.message);
@@ -47796,9 +47974,10 @@ var geoSourceManager = {
/**
* @param {string} mapName
* @param {Object} nameMap
+ * @param {string} nameProperty
* @return {Object} source {regions, regionsMap, nameCoordMap, boundingRect}
*/
- load: function (mapName, nameMap) {
+ load: function (mapName, nameMap, nameProperty) {
var regions = [];
var regionsMap = createHashMap();
var nameCoordMap = createHashMap();
@@ -47806,7 +47985,7 @@ var geoSourceManager = {
var mapRecords = retrieveMap(mapName);
each$1(mapRecords, function (record) {
- var singleSource = loaders[record.type].load(mapName, record);
+ var singleSource = loaders[record.type].load(mapName, record, nameProperty);
each$1(singleSource.regions, function (region) {
var regionName = region.name;
@@ -47945,7 +48124,7 @@ var MapSeries = SeriesModel.extend({
});
}
- var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap);
+ var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty);
each$1(geoSource.regions, function (region) {
var name = region.name;
if (!dataNameMap.get(name)) {
@@ -48135,7 +48314,8 @@ var MapSeries = SeriesModel.extend({
itemStyle: {
areaColor: 'rgba(255,215,0,0.8)'
}
- }
+ },
+ nameProperty: 'name'
}
});
@@ -48745,9 +48925,25 @@ MapDraw.prototype = {
var group = this.group;
var transformInfo = geo.getTransformInfo();
- group.transform = transformInfo.roamTransform;
- group.decomposeTransform();
- group.dirty();
+ // No animation when first draw or in action
+ var isFirstDraw = !regionsGroup.childAt(0) || payload;
+ var targetScale;
+ if (isFirstDraw) {
+ group.transform = transformInfo.roamTransform;
+ group.decomposeTransform();
+ group.dirty();
+ }
+ else {
+ var target = new Transformable();
+ target.transform = transformInfo.roamTransform;
+ target.decomposeTransform();
+ var props = {
+ scale: target.scale,
+ position: target.position
+ };
+ targetScale = target.scale;
+ updateProps(group, props, mapOrGeoModel);
+ }
var scale = transformInfo.rawScale;
var position = transformInfo.rawPosition;
@@ -48889,6 +49085,12 @@ MapDraw.prototype = {
}
);
+ if (!isFirstDraw) {
+ // Text animation
+ var textScale = [1 / targetScale[0], 1 / targetScale[1]];
+ updateProps(textEl, { scale: textScale }, mapOrGeoModel);
+ }
+
regionGroup.add(textEl);
}
@@ -50796,11 +50998,14 @@ TreeNode.prototype = {
var hostTree = this.hostTree;
var itemModel = hostTree.data.getItemModel(this.dataIndex);
var levelModel = this.getLevelModel();
- var leavesModel;
- if (!levelModel && (this.children.length === 0 || (this.children.length !== 0 && this.isExpand === false))) {
- leavesModel = this.getLeavesModel();
+
+ // FIXME: refactor levelModel to "beforeLink", and remove levelModel here.
+ if (levelModel) {
+ return itemModel.getModel(path, levelModel.getModel(path));
+ }
+ else {
+ return itemModel.getModel(path);
}
- return itemModel.getModel(path, (levelModel || leavesModel || hostTree.hostModel).getModel(path));
},
/**
@@ -50811,13 +51016,6 @@ TreeNode.prototype = {
},
/**
- * @return {module:echarts/model/Model}
- */
- getLeavesModel: function () {
- return this.hostTree.leavesModel;
- },
-
- /**
* @example
* setItemVisual('color', color);
* setItemVisual({
@@ -50887,9 +51085,8 @@ TreeNode.prototype = {
* @alias module:echarts/data/Tree
* @param {module:echarts/model/Model} hostModel
* @param {Array.<Object>} levelOptions
- * @param {Object} leavesOption
*/
-function Tree(hostModel, levelOptions, leavesOption) {
+function Tree(hostModel, levelOptions) {
/**
* @type {module:echarts/data/Tree~TreeNode}
* @readOnly
@@ -50925,7 +51122,6 @@ function Tree(hostModel, levelOptions, leavesOption) {
return new Model(levelDefine, hostModel, hostModel.ecModel);
});
- this.leavesModel = new Model(leavesOption || {}, hostModel, hostModel.ecModel);
}
Tree.prototype = {
@@ -51017,12 +51213,11 @@ Tree.prototype = {
* @param {module:echarts/model/Model} hostModel
* @param {Object} treeOptions
* @param {Array.<Object>} treeOptions.levels
- * @param {Array.<Object>} treeOptions.leaves
* @return module:echarts/data/Tree
*/
Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
- var tree = new Tree(hostModel, treeOptions.levels, treeOptions.leaves);
+ var tree = new Tree(hostModel, treeOptions && treeOptions.levels);
var listData = [];
var dimMax = 1;
@@ -51059,6 +51254,8 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
var list = new List(dimensionsInfo, hostModel);
list.initData(listData);
+ beforeLink && beforeLink(list);
+
linkList({
mainData: list,
struct: tree,
@@ -51067,8 +51264,6 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
tree.update();
- beforeLink && beforeLink(list);
-
return tree;
};
@@ -51128,17 +51323,13 @@ SeriesModel.extend({
var root = {name: option.name, children: option.data};
var leaves = option.leaves || {};
+ var leavesModel = new Model(leaves, this, this.ecModel);
- var treeOption = {};
-
- treeOption.leaves = leaves;
-
- var tree = Tree.createTree(root, this, treeOption, beforeLink);
+ var tree = Tree.createTree(root, this, {}, beforeLink);
function beforeLink(nodeData) {
nodeData.wrapMethod('getItemModel', function (model, idx) {
var node = tree.getNodeByDataIndex(idx);
- var leavesModel = node.getLeavesModel();
if (!node.children.length || !node.isExpand) {
model.parentModel = leavesModel;
}
@@ -52753,15 +52944,25 @@ SeriesModel.extend({
var levels = option.levels || [];
levels = option.levels = setDefault(levels, ecModel);
-
- var treeOption = {};
-
- treeOption.levels = levels;
+ var levelModels = map(levels || [], function (levelDefine) {
+ return new Model(levelDefine, this, ecModel);
+ }, this);
// Make sure always a new tree is created when setOption,
// in TreemapView, we check whether oldTree === newTree
// to choose mappings approach among old shapes and new shapes.
- return Tree.createTree(root, this, treeOption).data;
+ var tree = Tree.createTree(root, this, null, beforeLink);
+
+ function beforeLink(nodeData) {
+ nodeData.wrapMethod('getItemModel', function (model, idx) {
+ var node = tree.getNodeByDataIndex(idx);
+ var levelModel = levelModels[node.depth];
+ levelModel && (model.parentModel = levelModel);
+ return model;
+ });
+ }
+
+ return tree.data;
},
optionUpdated: function () {
@@ -53772,7 +53973,7 @@ extendChartView({
var itemModel = node.hostTree.data.getItemModel(node.dataIndex);
var link = itemModel.get('link', true);
var linkTarget = itemModel.get('target', true) || 'blank';
- link && window.open(link, linkTarget);
+ link && windowOpen(link, linkTarget);
}
}
@@ -53962,7 +54163,7 @@ function renderNode(
// Background
var bg = giveGraphic('background', Rect$1, depth, Z_BG);
- bg && renderBackground(group, bg, isParent && thisLayout.upperHeight);
+ bg && renderBackground(group, bg, isParent && thisLayout.upperLabelHeight);
// No children, render content.
if (isParent) {
@@ -54083,16 +54284,7 @@ function renderNode(
}
function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
- var text = retrieve(
- seriesModel.getFormattedLabel(
- thisNode.dataIndex, 'normal', null, null, upperLabelRect ? 'upperLabel' : 'label'
- ),
- nodeModel.get('name')
- );
- if (!upperLabelRect && thisLayout.isLeafRoot) {
- var iconChar = seriesModel.get('drillDownIcon', true);
- text = iconChar ? iconChar + ' ' + text : text;
- }
+ var defaultText = nodeModel.get('name');
var normalLabelModel = nodeModel.getModel(
upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL
@@ -54106,12 +54298,18 @@ function renderNode(
setLabelStyle(
normalStyle, emphasisStyle, normalLabelModel, emphasisLabelModel,
{
- defaultText: isShow ? text : null,
+ defaultText: isShow ? defaultText : null,
autoColor: visualColor,
- isRectText: true
+ isRectText: true,
+ labelFetcher: seriesModel,
+ labelDataIndex: thisNode.dataIndex,
+ labelProp: upperLabelRect ? 'upperLabel' : 'label'
}
);
+ addDrillDownIcon(normalStyle, upperLabelRect, thisLayout);
+ addDrillDownIcon(emphasisStyle, upperLabelRect, thisLayout);
+
upperLabelRect && (normalStyle.textRect = clone(upperLabelRect));
normalStyle.truncate = (isShow && normalLabelModel.get('ellipsis'))
@@ -54123,6 +54321,14 @@ function renderNode(
: null;
}
+ function addDrillDownIcon(style, upperLabelRect, thisLayout) {
+ var text = style.text;
+ if (!upperLabelRect && thisLayout.isLeafRoot && text != null) {
+ var iconChar = seriesModel.get('drillDownIcon', true);
+ style.text = iconChar ? iconChar + ' ' + text : text;
+ }
+ }
+
function giveGraphic(storageName, Ctor, depth, z) {
var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex];
var lasts = lastsForAnimation[storageName];
@@ -57293,9 +57499,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
this.group.removeAll();
};
+function isEffectObject(el) {
+ return el.animators && el.animators.length > 0;
+}
+
lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
function updateIncrementalAndHover(el) {
- if (!el.isGroup) {
+ if (!el.isGroup && !isEffectObject(el)) {
el.incremental = el.useHoverLayer = true;
}
}
@@ -64345,7 +64555,13 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
each$1(nodes, function (node) {
if (node.outEdges.length) {
var y = sum(node.outEdges, weightedTarget, orient)
- / sum(node.outEdges, getEdgeValue, orient);
+ / sum(node.outEdges, getEdgeValue, orient);
+
+ if (isNaN(y)) {
+ var len = node.outEdges.length;
+ y = len ? sum(node.outEdges, centerTarget, orient) / len : 0;
+ }
+
if (orient === 'vertical') {
var nodeX = node.getLayout().x + (y - center$1(node, orient)) * alpha;
node.setLayout({x: nodeX}, true);
@@ -64362,10 +64578,16 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
function weightedTarget(edge, orient) {
return center$1(edge.node2, orient) * edge.getValue();
}
+function centerTarget(edge, orient) {
+ return center$1(edge.node2, orient);
+}
function weightedSource(edge, orient) {
return center$1(edge.node1, orient) * edge.getValue();
}
+function centerSource(edge, orient) {
+ return center$1(edge.node1, orient);
+}
function center$1(node, orient) {
return orient === 'vertical'
@@ -64401,8 +64623,15 @@ function relaxLeftToRight(nodesByBreadth, alpha, orient) {
each$1(nodesByBreadth, function (nodes) {
each$1(nodes, function (node) {
if (node.inEdges.length) {
+
var y = sum(node.inEdges, weightedSource, orient)
- / sum(node.inEdges, getEdgeValue, orient);
+ / sum(node.inEdges, getEdgeValue, orient);
+
+ if (isNaN(y)) {
+ var len = node.inEdges.length;
+ y = len ? sum(node.inEdges, centerSource, orient) / len : 0;
+ }
+
if (orient === 'vertical') {
var nodeX = node.getLayout().x + (y - center$1(node, orient)) * alpha;
node.setLayout({x: nodeX}, true);
@@ -66242,7 +66471,8 @@ effectSymbolProto.updateData = function (data, idx) {
pos[0] = parsePercent$1(symbolOffset[0], symbolSize[0]);
pos[1] = parsePercent$1(symbolOffset[1], symbolSize[1]);
}
- rippleGroup.rotation = (itemModel.getShallow('symbolRotate') || 0) * Math.PI / 180 || 0;
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
+ rippleGroup.rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
var effectCfg = {};
@@ -68160,8 +68390,8 @@ extendChartView({
rect = new Rect({
shape: {
- x: Math.floor(point[0] - width / 2),
- y: Math.floor(point[1] - height / 2),
+ x: Math.floor(Math.round(point[0]) - width / 2),
+ y: Math.floor(Math.round(point[1]) - height / 2),
width: Math.ceil(width),
height: Math.ceil(height)
},
@@ -72638,8 +72868,7 @@ SeriesModel.extend({
align: 'center',
position: 'inside',
distance: 5,
- silent: true,
- emphasis: {}
+ silent: true
},
itemStyle: {
borderWidth: 1,
@@ -72649,13 +72878,19 @@ SeriesModel.extend({
shadowColor: 'rgba(0, 0, 0, 0.2)',
shadowOffsetX: 0,
shadowOffsetY: 0,
- opacity: 1,
- emphasis: {},
- highlight: {
+ opacity: 1
+ },
+ highlight: {
+ itemStyle: {
opacity: 1
+ }
+ },
+ downplay: {
+ itemStyle: {
+ opacity: 0.5
},
- downplay: {
- opacity: 0.9
+ label: {
+ opacity: 0.6
}
},
@@ -72901,6 +73136,8 @@ SunburstPieceProto.updateData = function (
this._seriesModel = seriesModel || this._seriesModel;
this._ecModel = ecModel || this._ecModel;
+
+ setHoverStyle(this);
};
SunburstPieceProto.onEmphasis = function (highlightPolicy) {
@@ -73364,7 +73601,7 @@ var SunburstView = Chart.extend({
if (link) {
var linkTarget = itemModel.get('target', true)
|| '_blank';
- window.open(link, linkTarget);
+ windowOpen(link, linkTarget);
}
}
targetFound = true;
@@ -77288,7 +77525,10 @@ Calendar.prototype = {
var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY)
- Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1;
- // Consider case:
+ // Consider case1 (#11677 #10430):
+ // Set the system timezone as "UK", set the range to `['2016-07-01', '2016-12-31']`
+
+ // Consider case2:
// Firstly set system timezone as "Time Zone: America/Toronto",
// ```
// var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
@@ -77301,11 +77541,15 @@ Calendar.prototype = {
var endDateNum = range[1].date.getDate();
date.setDate(startDateNum + allDay - 1);
// The bias can not over a month, so just compare date.
- if (date.getDate() !== endDateNum) {
+ var dateNum = date.getDate();
+ if (dateNum !== endDateNum) {
var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
- while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
+ while (
+ (dateNum = date.getDate()) !== endDateNum
+ && (date.getTime() - range[1].time) * sign > 0
+ ) {
allDay -= sign;
- date.setDate(startDateNum + allDay - 1);
+ date.setDate(dateNum - sign);
}
}
@@ -78892,7 +79136,7 @@ extendComponentView({
var feature;
// FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
- if (payload && payload.newTitle != null) {
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
featureOpt.title = payload.newTitle;
}
@@ -79165,7 +79409,8 @@ var proto$2 = SaveAsImage.prototype;
proto$2.onclick = function (ecModel, api) {
var model = this.model;
var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
- var type = model.get('type', true) || 'png';
+ var isSvg = api.getZr().painter.getType() === 'svg';
+ var type = isSvg ? 'svg' : model.get('type', true) || 'png';
var url = api.getConnectedDataURL({
type: type,
backgroundColor: model.get('backgroundColor', true)
@@ -79392,7 +79637,8 @@ proto$3.onclick = function (ecModel, api, type) {
type: 'changeMagicType',
currentType: type,
newOption: newOption,
- newTitle: newTitle
+ newTitle: newTitle,
+ featureName: 'magicType'
});
};
@@ -83576,7 +83822,7 @@ extendComponentView({
var dataModel = el.dataModel || seriesModel;
var dataIndex = el.dataIndex;
var dataType = el.dataType;
- var data = dataModel.getData();
+ var data = dataModel.getData(dataType);
var tooltipModel = buildTooltipModel([
data.getItemModel(dataIndex),
@@ -85374,12 +85620,12 @@ extendComponentView({
if (link) {
textEl.on('click', function () {
- window.open(link, '_' + titleModel.get('target'));
+ windowOpen(link, '_' + titleModel.get('target'));
});
}
if (sublink) {
subTextEl.on('click', function () {
- window.open(sublink, '_' + titleModel.get('subtarget'));
+ windowOpen(link, '_' + titleModel.get('subtarget'));
});
}
@@ -94144,25 +94390,21 @@ var resetMethods = {
thisOption.precision = precision;
splitStep = +splitStep.toFixed(precision);
- var index = 0;
-
if (thisOption.minOpen) {
pieceList.push({
- index: index++,
interval: [-Infinity, dataExtent[0]],
close: [0, 0]
});
}
for (
- var curr = dataExtent[0], len = index + splitNumber;
- index < len;
- curr += splitStep
+ var index = 0, curr = dataExtent[0];
+ index < splitNumber;
+ curr += splitStep, index++
) {
var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);
pieceList.push({
- index: index++,
interval: [curr, max],
close: [1, 1]
});
@@ -94170,7 +94412,6 @@ var resetMethods = {
if (thisOption.maxOpen) {
pieceList.push({
- index: index++,
interval: [dataExtent[1], Infinity],
close: [0, 0]
});
@@ -94178,7 +94419,8 @@ var resetMethods = {
reformIntervals(pieceList);
- each$1(pieceList, function (piece) {
+ each$1(pieceList, function (piece, index) {
+ piece.index = index;
piece.text = this.formatValueText(piece.interval);
}, this);
},
@@ -97487,11 +97729,16 @@ var SVGPainter = function (root, storage, opts, zrId) {
this.storage = storage;
this._opts = opts = extend({}, opts || {});
- var svgRoot = createElement('svg');
- svgRoot.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
- svgRoot.setAttribute('version', '1.1');
- svgRoot.setAttribute('baseProfile', 'full');
- svgRoot.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
+ var svgDom = createElement('svg');
+ svgDom.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
+ svgDom.setAttribute('version', '1.1');
+ svgDom.setAttribute('baseProfile', 'full');
+ svgDom.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
+
+ var bgRoot = createElement('g');
+ svgDom.appendChild(bgRoot);
+ var svgRoot = createElement('g');
+ svgDom.appendChild(svgRoot);
this.gradientManager = new GradientManager(zrId, svgRoot);
this.clipPathManager = new ClippathManager(zrId, svgRoot);
@@ -97500,11 +97747,13 @@ var SVGPainter = function (root, storage, opts, zrId) {
var viewport = document.createElement('div');
viewport.style.cssText = 'overflow:hidden;position:relative';
+ this._svgDom = svgDom;
this._svgRoot = svgRoot;
+ this._backgroundRoot = bgRoot;
this._viewport = viewport;
root.appendChild(viewport);
- viewport.appendChild(svgRoot);
+ viewport.appendChild(svgDom);
this.resize(opts.width, opts.height);
@@ -97523,6 +97772,14 @@ SVGPainter.prototype = {
return this._viewport;
},
+ getSvgDom: function () {
+ return this._svgDom;
+ },
+
+ getSvgRoot: function () {
+ return this._svgRoot;
+ },
+
getViewportRootOffset: function () {
var viewportRoot = this.getViewportRoot();
if (viewportRoot) {
@@ -97542,7 +97799,21 @@ SVGPainter.prototype = {
setBackgroundColor: function (backgroundColor) {
// TODO gradient
- this._viewport.style.background = backgroundColor;
+ // Insert a bg rect instead of setting background to viewport.
+ // Otherwise, the exported SVG don't have background.
+ if (this._backgroundRoot && this._backgroundNode) {
+ this._backgroundRoot.removeChild(this._backgroundNode);
+ }
+
+ var bgNode = createElement('rect');
+ bgNode.setAttribute('width', this.getWidth());
+ bgNode.setAttribute('height', this.getHeight());
+ bgNode.setAttribute('x', 0);
+ bgNode.setAttribute('y', 0);
+ bgNode.setAttribute('id', 0);
+ bgNode.style.fill = backgroundColor;
+ this._backgroundRoot.appendChild(bgNode);
+ this._backgroundNode = bgNode;
},
_paintList: function (list) {
@@ -97672,8 +97943,8 @@ SVGPainter.prototype = {
},
_getDefs: function (isForceCreating) {
- var svgRoot = this._svgRoot;
- var defs = this._svgRoot.getElementsByTagName('defs');
+ var svgRoot = this._svgDom;
+ var defs = svgRoot.getElementsByTagName('defs');
if (defs.length === 0) {
// Not exist
if (isForceCreating) {
@@ -97730,11 +98001,16 @@ SVGPainter.prototype = {
viewportStyle.width = width + 'px';
viewportStyle.height = height + 'px';
- var svgRoot = this._svgRoot;
+ var svgRoot = this._svgDom;
// Set width by 'svgRoot.width = width' is invalid
svgRoot.setAttribute('width', width);
svgRoot.setAttribute('height', height);
}
+
+ if (this._backgroundNode) {
+ this._backgroundNode.setAttribute('width', width);
+ this._backgroundNode.setAttribute('height', height);
+ }
},
/**
@@ -97776,10 +98052,13 @@ SVGPainter.prototype = {
dispose: function () {
this.root.innerHTML = '';
- this._svgRoot =
- this._viewport =
- this.storage =
- null;
+ this._svgRoot
+ = this._backgroundRoot
+ = this._svgDom
+ = this._backgroundNode
+ = this._viewport
+ = this.storage
+ = null;
},
clear: function () {
@@ -97788,9 +98067,9 @@ SVGPainter.prototype = {
}
},
- pathToDataUrl: function () {
+ toDataURL: function () {
this.refresh();
- var html = this._svgRoot.outerHTML;
+ var html = encodeURIComponent(this._svgDom.outerHTML.replace(/></g, '>\n\r<'));
return 'data:image/svg+xml;charset=UTF-8,' + html;
}
};
@@ -97806,7 +98085,7 @@ function createMethodNotSupport$1(method) {
each$1([
'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer',
'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer',
- 'toDataURL', 'pathToImage'
+ 'pathToImage'
], function (name) {
SVGPainter.prototype[name] = createMethodNotSupport$1(name);
});
diff --git a/dist/echarts-en.js.map b/dist/echarts-en.js.map
index 81951f0..85f8c54 100644
--- a/dist/echarts-en.js.map
+++ b/dist/echarts-en.js.map
@@ -1 +1 @@
-{"version":3,"file":"echarts-en.js","sources":["../src/config.js","../../zrender/src/core/guid.js","../../zrender/src/core/env.js","../../zrender/src/core/util.js","../../zrender/src/core/vector.js","../../zrender/src/mixin/Draggable.js","../../zrender/src/mixin/Eventful.js","../../zrender/src/core/fourPointsTransform.js","../../zrender/src/core/dom.js","../../zrender/src/core/event.js","../../zrender/src/core/GestureMgr.js","../../zrender/src/Handler.js","../../zrender/src/core/matrix.j [...]
\ No newline at end of file
+{"version":3,"file":"echarts-en.js","sources":["../src/config.js","../../zrender/src/core/guid.js","../../zrender/src/core/env.js","../../zrender/src/core/util.js","../../zrender/src/core/vector.js","../../zrender/src/mixin/Draggable.js","../../zrender/src/mixin/Eventful.js","../../zrender/src/core/fourPointsTransform.js","../../zrender/src/core/dom.js","../../zrender/src/core/event.js","../../zrender/src/core/GestureMgr.js","../../zrender/src/Handler.js","../../zrender/src/core/matrix.j [...]
\ No newline at end of file
diff --git a/dist/echarts-en.min.js b/dist/echarts-en.min.js
index d118440..9129d3e 100644
--- a/dist/echarts-en.min.js
+++ b/dist/echarts-en.min.js
@@ -19,4 +19,4 @@
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,n=function(){return e++},v="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,n=function(){return e++},v="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
diff --git a/dist/echarts-en.simple.js b/dist/echarts-en.simple.js
index c282195..960a3a5 100644
--- a/dist/echarts-en.simple.js
+++ b/dist/echarts-en.simple.js
@@ -9948,6 +9948,10 @@ Painter.prototype = {
if (this._layerConfig[zlevel]) {
merge(layer, this._layerConfig[zlevel], true);
}
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
+ else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
+ merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
+ }
if (virtual) {
layer.virtual = virtual;
@@ -10100,12 +10104,26 @@ Painter.prototype = {
var prevLayer = null;
var incrementalLayerCount = 0;
+ var prevZlevel;
for (var i = 0; i < list.length; i++) {
var el = list[i];
var zlevel = el.zlevel;
var layer;
- // PENDING If change one incremental element style ?
- // TODO Where there are non-incremental elements between incremental elements.
+
+ if (prevZlevel !== zlevel) {
+ prevZlevel = zlevel;
+ incrementalLayerCount = 0;
+ }
+
+ // TODO Not use magic number on zlevel.
+
+ // Each layer with increment element can be separated to 3 layers.
+ // (Other Element drawn after incremental element)
+ // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------
+ // (Incremental element)
+ // ----------------------zlevel + INCREMENTAL_INC------------------------
+ // (Element drawn before incremental element)
+ // --------------------------------zlevel--------------------------------
if (el.incremental) {
layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
layer.incremental = true;
@@ -10200,6 +10218,7 @@ Painter.prototype = {
for (var i = 0; i < this._zlevelList.length; i++) {
var _zlevel = this._zlevelList[i];
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
var layer = this._layers[_zlevel];
merge(layer, layerConfig[zlevel], true);
@@ -11270,7 +11289,7 @@ var painterCtors = {
/**
* @type {string}
*/
-var version$1 = '4.3.0';
+var version$1 = '4.3.1';
/**
* Initializing a zrender instance
@@ -13098,7 +13117,30 @@ var extremity = create();
* @param {number} min
* @param {number} max
*/
+function fromPoints(points, min$$1, max$$1) {
+ if (points.length === 0) {
+ return;
+ }
+ var p = points[0];
+ var left = p[0];
+ var right = p[0];
+ var top = p[1];
+ var bottom = p[1];
+ var i;
+ for (i = 1; i < points.length; i++) {
+ p = points[i];
+ left = mathMin$3(left, p[0]);
+ right = mathMax$3(right, p[0]);
+ top = mathMin$3(top, p[1]);
+ bottom = mathMax$3(bottom, p[1]);
+ }
+
+ min$$1[0] = left;
+ min$$1[1] = top;
+ max$$1[0] = right;
+ max$$1[1] = bottom;
+}
/**
* @memberOf module:zrender/core/bbox
@@ -17420,11 +17462,13 @@ function getHighlightDigit(highlightKey) {
* @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
* @param {string|Function} [opt.defaultText]
* @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDataIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDimIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {string} [opt.labelProp] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
* @param {Object} [normalSpecified]
* @param {Object} [emphasisSpecified]
*/
@@ -17438,6 +17482,7 @@ function setLabelStyle(
var labelFetcher = opt.labelFetcher;
var labelDataIndex = opt.labelDataIndex;
var labelDimIndex = opt.labelDimIndex;
+ var labelProp = opt.labelProp;
// This scenario, `label.normal.show = true; label.emphasis.show = false`,
// is not supported util someone requests.
@@ -17451,7 +17496,7 @@ function setLabelStyle(
var baseText;
if (showNormal || showEmphasis) {
if (labelFetcher) {
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
}
if (baseText == null) {
baseText = isFunction$1(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -17461,7 +17506,7 @@ function setLabelStyle(
var emphasisStyleText = showEmphasis
? retrieve2(
labelFetcher
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
: null,
baseText
)
@@ -19280,7 +19325,7 @@ function nice(val, round) {
// import Text from 'zrender/src/graphic/Text';
/**
- * 每三位默认加,格式化
+ * add commas after every three numbers
* @param {string|number} x
* @return {string}
*/
@@ -19495,6 +19540,13 @@ var truncateText$1 = truncateText;
* But deprecated this interface. Please use `getTextBoundingRect` instead.
*/
+
+/**
+ * open new tab
+ * @param {string} link url
+ * @param {string} target blank or self
+ */
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24429,7 +24481,7 @@ function dataTaskReset(context) {
function dataTaskProgress(param, context) {
// Avoid repead cloneShallow when data just created in reset.
- if (param.end > context.outputData.count()) {
+ if (context.outputData && param.end > context.outputData.count()) {
context.model.getRawData().cloneShallow(context.outputData);
}
}
@@ -25116,6 +25168,32 @@ var lang = {
lang: ['Right Click to Save Image']
}
},
+ series: {
+ typeNames: {
+ pie: 'Pie chart',
+ bar: 'Bar chart',
+ line: 'Line chart',
+ scatter: 'Scatter plot',
+ effectScatter: 'Ripple scatter plot',
+ radar: 'Radar chart',
+ tree: 'Tree',
+ treemap: 'Treemap',
+ boxplot: 'Boxplot',
+ candlestick: 'Candlestick',
+ k: 'K line chart',
+ heatmap: 'Heat map',
+ map: 'Map',
+ parallel: 'Parallel coordinate map',
+ lines: 'Line graph',
+ graph: 'Relationship graph',
+ sankey: 'Sankey diagram',
+ funnel: 'Funnel chart',
+ gauge: 'Guage',
+ pictorialBar: 'Pictorial bar',
+ themeRiver: 'Theme River Map',
+ sunburst: 'Sunburst'
+ }
+ },
aria: {
general: {
withTitle: 'This is a chart about "{title}"',
@@ -25348,11 +25426,16 @@ var loadingDefault = function (api, opts) {
opts = opts || {};
defaults(opts, {
text: 'loading',
- color: '#c23531',
textColor: '#000',
+ fontSize: '12px',
maskColor: 'rgba(255, 255, 255, 0.8)',
+ showSpinner: true,
+ color: '#c23531',
+ spinnerRadius: 10,
+ lineWidth: 5,
zlevel: 0
});
+ var group = new Group();
var mask = new Rect({
style: {
fill: opts.maskColor
@@ -25360,24 +25443,13 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10000
});
- var arc = new Arc({
- shape: {
- startAngle: -PI$1 / 2,
- endAngle: -PI$1 / 2 + 0.1,
- r: 10
- },
- style: {
- stroke: opts.color,
- lineCap: 'round',
- lineWidth: 5
- },
- zlevel: opts.zlevel,
- z: 10001
- });
+ group.add(mask);
+ var font = opts.fontSize + ' sans-serif';
var labelRect = new Rect({
style: {
fill: 'none',
text: opts.text,
+ font: font,
textPosition: 'right',
textDistance: 10,
textFill: opts.textColor
@@ -25385,32 +25457,49 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10001
});
-
- arc.animateShape(true)
- .when(1000, {
- endAngle: PI$1 * 3 / 2
- })
- .start('circularInOut');
- arc.animateShape(true)
- .when(1000, {
- startAngle: PI$1 * 3 / 2
- })
- .delay(300)
- .start('circularInOut');
-
- var group = new Group();
- group.add(arc);
group.add(labelRect);
- group.add(mask);
+ if (opts.showSpinner) {
+ var arc = new Arc({
+ shape: {
+ startAngle: -PI$1 / 2,
+ endAngle: -PI$1 / 2 + 0.1,
+ r: opts.spinnerRadius
+ },
+ style: {
+ stroke: opts.color,
+ lineCap: 'round',
+ lineWidth: opts.lineWidth
+ },
+ zlevel: opts.zlevel,
+ z: 10001
+ });
+ arc.animateShape(true)
+ .when(1000, {
+ endAngle: PI$1 * 3 / 2
+ })
+ .start('circularInOut');
+ arc.animateShape(true)
+ .when(1000, {
+ startAngle: PI$1 * 3 / 2
+ })
+ .delay(300)
+ .start('circularInOut');
+ group.add(arc);
+ }
// Inject resize
group.resize = function () {
- var cx = api.getWidth() / 2;
+ var textWidth = getWidth(opts.text, font);
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
+ // textDistance needs to be calculated when both animation and text exist
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
+ // only show the text
+ - (opts.showSpinner ? 0 : textWidth / 2);
var cy = api.getHeight() / 2;
- arc.setShape({
+ opts.showSpinner && arc.setShape({
cx: cx,
cy: cy
});
- var r = arc.shape.r;
labelRect.setShape({
x: cx - r,
y: cy - r,
@@ -27066,10 +27155,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType;
-var version = '4.7.0';
+var version = '4.8.0';
var dependencies = {
- zrender: '4.3.0'
+ zrender: '4.3.1'
};
var TEST_FRAME_REMAIN_TIME = 1;
@@ -27488,7 +27577,7 @@ echartsProto.getRenderedCanvas = function (opts) {
* Get svg data url
* @return {string}
*/
-echartsProto.getSvgDataUrl = function () {
+echartsProto.getSvgDataURL = function () {
if (!env$1.svgSupported) {
return;
}
@@ -27500,7 +27589,7 @@ echartsProto.getSvgDataUrl = function () {
el.stopAnimation(true);
});
- return zr.painter.pathToDataUrl();
+ return zr.painter.toDataURL();
};
/**
@@ -27536,7 +27625,7 @@ echartsProto.getDataURL = function (opts) {
});
var url = this._zr.painter.getType() === 'svg'
- ? this.getSvgDataUrl()
+ ? this.getSvgDataURL()
: this.getRenderedCanvas(opts).toDataURL(
'image/' + (opts && opts.type || 'png')
);
@@ -27565,6 +27654,7 @@ echartsProto.getConnectedDataURL = function (opts) {
if (!env$1.canvasSupported) {
return;
}
+ var isSvg = opts.type === 'svg';
var groupId = this.group;
var mathMin = Math.min;
var mathMax = Math.max;
@@ -27579,9 +27669,9 @@ echartsProto.getConnectedDataURL = function (opts) {
each$1(instances, function (chart, id) {
if (chart.group === groupId) {
- var canvas = chart.getRenderedCanvas(
- clone(opts)
- );
+ var canvas = isSvg
+ ? chart.getZr().painter.getSvgDom().innerHTML
+ : chart.getRenderedCanvas(clone(opts));
var boundingRect = chart.getDom().getBoundingClientRect();
left = mathMin(boundingRect.left, left);
top = mathMin(boundingRect.top, top);
@@ -27602,38 +27692,61 @@ echartsProto.getConnectedDataURL = function (opts) {
var width = right - left;
var height = bottom - top;
var targetCanvas = createCanvas();
- targetCanvas.width = width;
- targetCanvas.height = height;
- var zr = init$1(targetCanvas);
+ var zr = init$1(targetCanvas, {
+ renderer: isSvg ? 'svg' : 'canvas'
+ });
+ zr.resize({
+ width: width,
+ height: height
+ });
- // Background between the charts
- if (opts.connectedBackgroundColor) {
- zr.add(new Rect({
- shape: {
- x: 0,
- y: 0,
- width: width,
- height: height
- },
- style: {
- fill: opts.connectedBackgroundColor
- }
- }));
+ if (isSvg) {
+ var content = '';
+ each(canvasList, function (item) {
+ var x = item.left - left;
+ var y = item.top - top;
+ content += '<g transform="translate(' + x + ','
+ + y + ')">' + item.dom + '</g>';
+ });
+ zr.painter.getSvgRoot().innerHTML = content;
+
+ if (opts.connectedBackgroundColor) {
+ zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
+ }
+
+ zr.refreshImmediately();
+ return zr.painter.toDataURL();
}
+ else {
+ // Background between the charts
+ if (opts.connectedBackgroundColor) {
+ zr.add(new Rect({
+ shape: {
+ x: 0,
+ y: 0,
+ width: width,
+ height: height
+ },
+ style: {
+ fill: opts.connectedBackgroundColor
+ }
+ }));
+ }
- each(canvasList, function (item) {
- var img = new ZImage({
- style: {
- x: item.left * dpr - left,
- y: item.top * dpr - top,
- image: item.dom
- }
+ each(canvasList, function (item) {
+ var img = new ZImage({
+ style: {
+ x: item.left * dpr - left,
+ y: item.top * dpr - top,
+ image: item.dom
+ }
+ });
+ zr.add(img);
});
- zr.add(img);
- });
- zr.refreshImmediately();
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ zr.refreshImmediately();
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ }
}
else {
return this.getDataURL(opts);
@@ -33491,7 +33604,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var itemStyle = seriesScope && seriesScope.itemStyle;
var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
var symbolOffset = seriesScope && seriesScope.symbolOffset;
var labelModel = seriesScope && seriesScope.labelModel;
var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -33507,7 +33619,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
- symbolRotate = itemModel.getShallow('symbolRotate');
symbolOffset = itemModel.getShallow('symbolOffset');
labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -33521,6 +33632,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var elStyle = symbolPath.style;
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
+
symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
if (symbolOffset) {
@@ -34576,6 +34689,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
width += lineWidth;
height += lineWidth;
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
+ x = Math.floor(x);
+ width = Math.round(width);
+
var clipPath = new Rect({
shape: {
x: x,
@@ -34673,6 +34790,26 @@ function isPointsSame(points1, points2) {
return true;
}
+function getBoundingDiff(points1, points2) {
+ var min1 = [];
+ var max1 = [];
+
+ var min2 = [];
+ var max2 = [];
+
+ fromPoints(points1, min1, max1);
+ fromPoints(points2, min2, max2);
+
+ // Get a max value from each corner of two boundings.
+ 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])
+ );
+}
+
function getSmooth(smooth) {
return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
}
@@ -35285,6 +35422,24 @@ Chart.extend({
next = turnPointsIntoStep(diff.next, coordSys, step);
stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
}
+ // Don't apply animation if diff is large.
+ // For better result and avoid memory explosion problems like
+ // https://github.com/apache/incubator-echarts/issues/12229
+ if (getBoundingDiff(current, next) > 3000
+ || (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
+ ) {
+ polyline.setShape({
+ points: next
+ });
+ if (polygon) {
+ polygon.setShape({
+ points: next,
+ stackedOnPoints: stackedOnNext
+ });
+ }
+ return;
+ }
+
// `diff.current` is subset of `current` (which should be ensured by
// turnPointsIntoStep), so points in `__points` can be updated when
// points in `current` are update during animation.
@@ -35391,13 +35546,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var symbolType = seriesModel.get('symbol');
var symbolSize = seriesModel.get('symbolSize');
var keepAspect = seriesModel.get('symbolKeepAspect');
+ var symbolRotate = seriesModel.get('symbolRotate');
var hasSymbolTypeCallback = isFunction$1(symbolType);
var hasSymbolSizeCallback = isFunction$1(symbolSize);
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
-
data.setVisual({
legendSymbol: legendSymbol || seriesSymbol,
// If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -35406,7 +35562,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// some cases but generally it is not recommanded.
symbol: seriesSymbol,
symbolSize: seriesSymbolSize,
- symbolKeepAspect: keepAspect
+ symbolKeepAspect: keepAspect,
+ symbolRotate: symbolRotate
});
// Only visible series has each data be visual encoded
@@ -35420,12 +35577,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var params = seriesModel.getDataParams(idx);
hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
}
if (data.hasItemOption) {
var itemModel = data.getItemModel(idx);
var itemSymbolType = itemModel.getShallow('symbol', true);
var itemSymbolSize = itemModel.getShallow('symbolSize', true);
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
// If has item symbol
@@ -35436,6 +35595,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// PENDING Transform symbolSize ?
data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
}
+ if (itemSymbolRotate != null) {
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
+ }
if (itemSymbolKeepAspect != null) {
data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
}
@@ -36944,9 +37106,11 @@ var largeLayout = {
coord = cartesian.dataToPoint(valuePair, null, coord);
// Data index might not be in order, depends on `progressiveChunkMode`.
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coordLayout.x + coordLayout.width : coord[0];
largePoints[pointsOffset++] = coord[0];
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coord[1] : coordLayout.y + coordLayout.height;
largePoints[pointsOffset++] = coord[1];
largeDataIndices[idxOffset++] = dataIndex;
}
@@ -37436,8 +37600,6 @@ function getScaleExtent(scale, model) {
var min = model.getMin();
var max = model.getMax();
- var fixMin = min != null;
- var fixMax = max != null;
var originalExtent = scale.getExtent();
var axisDataLen;
@@ -37481,17 +37643,6 @@ function getScaleExtent(scale, model) {
// (2) When `needCrossZero` and all data is positive/negative, should it be ensured
// that the results processed by boundaryGap are positive/negative?
- if (min == null) {
- min = scaleType === 'ordinal'
- ? (axisDataLen ? 0 : NaN)
- : originalExtent[0] - boundaryGap[0] * span;
- }
- if (max == null) {
- max = scaleType === 'ordinal'
- ? (axisDataLen ? axisDataLen - 1 : NaN)
- : originalExtent[1] + boundaryGap[1] * span;
- }
-
if (min === 'dataMin') {
min = originalExtent[0];
}
@@ -37512,6 +37663,20 @@ function getScaleExtent(scale, model) {
});
}
+ var fixMin = min != null;
+ var fixMax = max != null;
+
+ if (min == null) {
+ min = scaleType === 'ordinal'
+ ? (axisDataLen ? 0 : NaN)
+ : originalExtent[0] - boundaryGap[0] * span;
+ }
+ if (max == null) {
+ max = scaleType === 'ordinal'
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
+ : originalExtent[1] + boundaryGap[1] * span;
+ }
+
(min == null || !isFinite(min)) && (min = NaN);
(max == null || !isFinite(max)) && (max = NaN);
@@ -37562,7 +37727,13 @@ function getScaleExtent(scale, model) {
}
}
- return [min, max];
+ return {
+ extent: [min, max],
+ // "fix" means "fixed", the value should not be
+ // changed in the subsequent steps.
+ fixMin: fixMin,
+ fixMax: fixMax
+ };
}
function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -37601,9 +37772,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
}
function niceScaleExtent(scale, model) {
- var extent = getScaleExtent(scale, model);
- var fixMin = model.getMin() != null;
- var fixMax = model.getMax() != null;
+ var extentInfo = getScaleExtent(scale, model);
+ var extent = extentInfo.extent;
+
var splitNumber = model.get('splitNumber');
if (scale.type === 'log') {
@@ -37614,8 +37785,8 @@ function niceScaleExtent(scale, model) {
scale.setExtent(extent[0], extent[1]);
scale.niceExtent({
splitNumber: splitNumber,
- fixMin: fixMin,
- fixMax: fixMax,
+ fixMin: extentInfo.fixMin,
+ fixMax: extentInfo.fixMax,
minInterval: (scaleType === 'interval' || scaleType === 'time')
? model.get('minInterval') : null,
maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -42055,6 +42226,7 @@ extendChartView({
var drawBackground = seriesModel.get('showBackground', true);
var backgroundModel = seriesModel.getModel('backgroundStyle');
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
var bgEls = [];
var oldBgEls = this._backgroundEls || [];
@@ -42065,8 +42237,13 @@ extendChartView({
var layout = getLayout[coord.type](data, dataIndex, itemModel);
if (drawBackground) {
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
+ var bgLayout = getLayout[coord.type](data, dataIndex);
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[dataIndex] = bgEl;
}
@@ -42103,9 +42280,14 @@ extendChartView({
if (drawBackground) {
var bgEl = oldBgEls[oldIndex];
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[newIndex] = bgEl;
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
+ var bgLayout = getLayout[coord.type](data, newIndex);
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
updateProps(bgEl, { shape: shape }, animationModel, newIndex);
}
@@ -42355,9 +42537,11 @@ function removeSector(dataIndex, animationModel, el) {
}
var getLayout = {
+ // itemModel is only used to get borderWidth, which is not needed
+ // when calculating bar background layout.
cartesian2d: function (data, dataIndex, itemModel) {
var layout = data.getItemLayout(dataIndex);
- var fixedLineWidth = getLineWidth(itemModel, layout);
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
// fix layout with lineWidth
var signX = layout.width > 0 ? 1 : -1;
@@ -43231,31 +43415,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
this._updateLabel(data, idx, withAnimation);
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
+ this.highDownOnUpdate = !seriesModel.get('silent')
? function (fromState, toState) {
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
if (toState === 'emphasis') {
labelLine.ignore = labelLine.hoverIgnore;
labelText.ignore = labelText.hoverIgnore;
// Sector may has animation of updating data. Force to move to the last frame
// Or it may stopped on the wrong shape
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r + seriesModel.get('hoverOffset')
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r + seriesModel.get('hoverOffset')
+ }
+ }, 300, 'elasticOut');
+ }
}
else {
labelLine.ignore = labelLine.normalIgnore;
labelText.ignore = labelText.normalIgnore;
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r
+ }
+ }, 300, 'elasticOut');
+ }
}
}
: null;
diff --git a/dist/echarts-en.simple.min.js b/dist/echarts-en.simple.min.js
index f289ecd..0bdc6f3 100644
--- a/dist/echarts-en.simple.min.js
+++ b/dist/echarts-en.simple.min.js
@@ -19,4 +19,4 @@
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,n=function(){return e++},m="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,n=function(){return e++},m="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
diff --git a/dist/echarts.common.js b/dist/echarts.common.js
index 96417af..1b2ee0f 100644
--- a/dist/echarts.common.js
+++ b/dist/echarts.common.js
@@ -10252,6 +10252,10 @@ Painter.prototype = {
if (this._layerConfig[zlevel]) {
merge(layer, this._layerConfig[zlevel], true);
}
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
+ else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
+ merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
+ }
if (virtual) {
layer.virtual = virtual;
@@ -10404,12 +10408,26 @@ Painter.prototype = {
var prevLayer = null;
var incrementalLayerCount = 0;
+ var prevZlevel;
for (var i = 0; i < list.length; i++) {
var el = list[i];
var zlevel = el.zlevel;
var layer;
- // PENDING If change one incremental element style ?
- // TODO Where there are non-incremental elements between incremental elements.
+
+ if (prevZlevel !== zlevel) {
+ prevZlevel = zlevel;
+ incrementalLayerCount = 0;
+ }
+
+ // TODO Not use magic number on zlevel.
+
+ // Each layer with increment element can be separated to 3 layers.
+ // (Other Element drawn after incremental element)
+ // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------
+ // (Incremental element)
+ // ----------------------zlevel + INCREMENTAL_INC------------------------
+ // (Element drawn before incremental element)
+ // --------------------------------zlevel--------------------------------
if (el.incremental) {
layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
layer.incremental = true;
@@ -10504,6 +10522,7 @@ Painter.prototype = {
for (var i = 0; i < this._zlevelList.length; i++) {
var _zlevel = this._zlevelList[i];
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
var layer = this._layers[_zlevel];
merge(layer, layerConfig[zlevel], true);
@@ -11576,7 +11595,7 @@ var instances$1 = {}; // ZRender实例map索引
/**
* @type {string}
*/
-var version$1 = '4.3.0';
+var version$1 = '4.3.1';
/**
* Initializing a zrender instance
@@ -17782,11 +17801,13 @@ function getHighlightDigit(highlightKey) {
* @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
* @param {string|Function} [opt.defaultText]
* @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDataIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDimIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {string} [opt.labelProp] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
* @param {Object} [normalSpecified]
* @param {Object} [emphasisSpecified]
*/
@@ -17800,6 +17821,7 @@ function setLabelStyle(
var labelFetcher = opt.labelFetcher;
var labelDataIndex = opt.labelDataIndex;
var labelDimIndex = opt.labelDimIndex;
+ var labelProp = opt.labelProp;
// This scenario, `label.normal.show = true; label.emphasis.show = false`,
// is not supported util someone requests.
@@ -17813,7 +17835,7 @@ function setLabelStyle(
var baseText;
if (showNormal || showEmphasis) {
if (labelFetcher) {
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
}
if (baseText == null) {
baseText = isFunction$1(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -17823,7 +17845,7 @@ function setLabelStyle(
var emphasisStyleText = showEmphasis
? retrieve2(
labelFetcher
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
: null,
baseText
)
@@ -19734,7 +19756,7 @@ var number = (Object.freeze || Object)({
// import Text from 'zrender/src/graphic/Text';
/**
- * 每三位默认加,格式化
+ * add commas after every three numbers
* @param {string|number} x
* @return {string}
*/
@@ -19987,6 +20009,22 @@ function getTextRect(
);
}
+/**
+ * open new tab
+ * @param {string} link url
+ * @param {string} target blank or self
+ */
+function windowOpen(link, target) {
+ if (target === '_blank' || target === 'blank') {
+ var blank = window.open();
+ blank.opener = null;
+ blank.location = link;
+ }
+ else {
+ window.open(link, target);
+ }
+}
+
var format = (Object.freeze || Object)({
addCommas: addCommas,
@@ -20000,7 +20038,8 @@ var format = (Object.freeze || Object)({
capitalFirst: capitalFirst,
truncateText: truncateText$1,
getTextBoundingRect: getTextBoundingRect,
- getTextRect: getTextRect
+ getTextRect: getTextRect,
+ windowOpen: windowOpen
});
/*
@@ -24981,7 +25020,7 @@ function dataTaskReset(context) {
function dataTaskProgress(param, context) {
// Avoid repead cloneShallow when data just created in reset.
- if (param.end > context.outputData.count()) {
+ if (context.outputData && param.end > context.outputData.count()) {
context.model.getRawData().cloneShallow(context.outputData);
}
}
@@ -25961,11 +26000,16 @@ var loadingDefault = function (api, opts) {
opts = opts || {};
defaults(opts, {
text: 'loading',
- color: '#c23531',
textColor: '#000',
+ fontSize: '12px',
maskColor: 'rgba(255, 255, 255, 0.8)',
+ showSpinner: true,
+ color: '#c23531',
+ spinnerRadius: 10,
+ lineWidth: 5,
zlevel: 0
});
+ var group = new Group();
var mask = new Rect({
style: {
fill: opts.maskColor
@@ -25973,24 +26017,13 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10000
});
- var arc = new Arc({
- shape: {
- startAngle: -PI$1 / 2,
- endAngle: -PI$1 / 2 + 0.1,
- r: 10
- },
- style: {
- stroke: opts.color,
- lineCap: 'round',
- lineWidth: 5
- },
- zlevel: opts.zlevel,
- z: 10001
- });
+ group.add(mask);
+ var font = opts.fontSize + ' sans-serif';
var labelRect = new Rect({
style: {
fill: 'none',
text: opts.text,
+ font: font,
textPosition: 'right',
textDistance: 10,
textFill: opts.textColor
@@ -25998,32 +26031,49 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10001
});
-
- arc.animateShape(true)
- .when(1000, {
- endAngle: PI$1 * 3 / 2
- })
- .start('circularInOut');
- arc.animateShape(true)
- .when(1000, {
- startAngle: PI$1 * 3 / 2
- })
- .delay(300)
- .start('circularInOut');
-
- var group = new Group();
- group.add(arc);
group.add(labelRect);
- group.add(mask);
+ if (opts.showSpinner) {
+ var arc = new Arc({
+ shape: {
+ startAngle: -PI$1 / 2,
+ endAngle: -PI$1 / 2 + 0.1,
+ r: opts.spinnerRadius
+ },
+ style: {
+ stroke: opts.color,
+ lineCap: 'round',
+ lineWidth: opts.lineWidth
+ },
+ zlevel: opts.zlevel,
+ z: 10001
+ });
+ arc.animateShape(true)
+ .when(1000, {
+ endAngle: PI$1 * 3 / 2
+ })
+ .start('circularInOut');
+ arc.animateShape(true)
+ .when(1000, {
+ startAngle: PI$1 * 3 / 2
+ })
+ .delay(300)
+ .start('circularInOut');
+ group.add(arc);
+ }
// Inject resize
group.resize = function () {
- var cx = api.getWidth() / 2;
+ var textWidth = getWidth(opts.text, font);
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
+ // textDistance needs to be calculated when both animation and text exist
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
+ // only show the text
+ - (opts.showSpinner ? 0 : textWidth / 2);
var cy = api.getHeight() / 2;
- arc.setShape({
+ opts.showSpinner && arc.setShape({
cx: cx,
cy: cy
});
- var r = arc.shape.r;
labelRect.setShape({
x: cx - r,
y: cy - r,
@@ -27679,10 +27729,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType;
-var version = '4.7.0';
+var version = '4.8.0';
var dependencies = {
- zrender: '4.3.0'
+ zrender: '4.3.1'
};
var TEST_FRAME_REMAIN_TIME = 1;
@@ -28101,7 +28151,7 @@ echartsProto.getRenderedCanvas = function (opts) {
* Get svg data url
* @return {string}
*/
-echartsProto.getSvgDataUrl = function () {
+echartsProto.getSvgDataURL = function () {
if (!env$1.svgSupported) {
return;
}
@@ -28113,7 +28163,7 @@ echartsProto.getSvgDataUrl = function () {
el.stopAnimation(true);
});
- return zr.painter.pathToDataUrl();
+ return zr.painter.toDataURL();
};
/**
@@ -28149,7 +28199,7 @@ echartsProto.getDataURL = function (opts) {
});
var url = this._zr.painter.getType() === 'svg'
- ? this.getSvgDataUrl()
+ ? this.getSvgDataURL()
: this.getRenderedCanvas(opts).toDataURL(
'image/' + (opts && opts.type || 'png')
);
@@ -28178,6 +28228,7 @@ echartsProto.getConnectedDataURL = function (opts) {
if (!env$1.canvasSupported) {
return;
}
+ var isSvg = opts.type === 'svg';
var groupId = this.group;
var mathMin = Math.min;
var mathMax = Math.max;
@@ -28192,9 +28243,9 @@ echartsProto.getConnectedDataURL = function (opts) {
each$1(instances, function (chart, id) {
if (chart.group === groupId) {
- var canvas = chart.getRenderedCanvas(
- clone(opts)
- );
+ var canvas = isSvg
+ ? chart.getZr().painter.getSvgDom().innerHTML
+ : chart.getRenderedCanvas(clone(opts));
var boundingRect = chart.getDom().getBoundingClientRect();
left = mathMin(boundingRect.left, left);
top = mathMin(boundingRect.top, top);
@@ -28215,38 +28266,61 @@ echartsProto.getConnectedDataURL = function (opts) {
var width = right - left;
var height = bottom - top;
var targetCanvas = createCanvas();
- targetCanvas.width = width;
- targetCanvas.height = height;
- var zr = init$1(targetCanvas);
+ var zr = init$1(targetCanvas, {
+ renderer: isSvg ? 'svg' : 'canvas'
+ });
+ zr.resize({
+ width: width,
+ height: height
+ });
- // Background between the charts
- if (opts.connectedBackgroundColor) {
- zr.add(new Rect({
- shape: {
- x: 0,
- y: 0,
- width: width,
- height: height
- },
- style: {
- fill: opts.connectedBackgroundColor
- }
- }));
+ if (isSvg) {
+ var content = '';
+ each(canvasList, function (item) {
+ var x = item.left - left;
+ var y = item.top - top;
+ content += '<g transform="translate(' + x + ','
+ + y + ')">' + item.dom + '</g>';
+ });
+ zr.painter.getSvgRoot().innerHTML = content;
+
+ if (opts.connectedBackgroundColor) {
+ zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
+ }
+
+ zr.refreshImmediately();
+ return zr.painter.toDataURL();
}
+ else {
+ // Background between the charts
+ if (opts.connectedBackgroundColor) {
+ zr.add(new Rect({
+ shape: {
+ x: 0,
+ y: 0,
+ width: width,
+ height: height
+ },
+ style: {
+ fill: opts.connectedBackgroundColor
+ }
+ }));
+ }
- each(canvasList, function (item) {
- var img = new ZImage({
- style: {
- x: item.left * dpr - left,
- y: item.top * dpr - top,
- image: item.dom
- }
+ each(canvasList, function (item) {
+ var img = new ZImage({
+ style: {
+ x: item.left * dpr - left,
+ y: item.top * dpr - top,
+ image: item.dom
+ }
+ });
+ zr.add(img);
});
- zr.add(img);
- });
- zr.refreshImmediately();
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ zr.refreshImmediately();
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ }
}
else {
return this.getDataURL(opts);
@@ -34654,9 +34728,11 @@ var largeLayout = {
coord = cartesian.dataToPoint(valuePair, null, coord);
// Data index might not be in order, depends on `progressiveChunkMode`.
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coordLayout.x + coordLayout.width : coord[0];
largePoints[pointsOffset++] = coord[0];
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coord[1] : coordLayout.y + coordLayout.height;
largePoints[pointsOffset++] = coord[1];
largeDataIndices[idxOffset++] = dataIndex;
}
@@ -35146,8 +35222,6 @@ function getScaleExtent(scale, model) {
var min = model.getMin();
var max = model.getMax();
- var fixMin = min != null;
- var fixMax = max != null;
var originalExtent = scale.getExtent();
var axisDataLen;
@@ -35191,17 +35265,6 @@ function getScaleExtent(scale, model) {
// (2) When `needCrossZero` and all data is positive/negative, should it be ensured
// that the results processed by boundaryGap are positive/negative?
- if (min == null) {
- min = scaleType === 'ordinal'
- ? (axisDataLen ? 0 : NaN)
- : originalExtent[0] - boundaryGap[0] * span;
- }
- if (max == null) {
- max = scaleType === 'ordinal'
- ? (axisDataLen ? axisDataLen - 1 : NaN)
- : originalExtent[1] + boundaryGap[1] * span;
- }
-
if (min === 'dataMin') {
min = originalExtent[0];
}
@@ -35222,6 +35285,20 @@ function getScaleExtent(scale, model) {
});
}
+ var fixMin = min != null;
+ var fixMax = max != null;
+
+ if (min == null) {
+ min = scaleType === 'ordinal'
+ ? (axisDataLen ? 0 : NaN)
+ : originalExtent[0] - boundaryGap[0] * span;
+ }
+ if (max == null) {
+ max = scaleType === 'ordinal'
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
+ : originalExtent[1] + boundaryGap[1] * span;
+ }
+
(min == null || !isFinite(min)) && (min = NaN);
(max == null || !isFinite(max)) && (max = NaN);
@@ -35272,7 +35349,13 @@ function getScaleExtent(scale, model) {
}
}
- return [min, max];
+ return {
+ extent: [min, max],
+ // "fix" means "fixed", the value should not be
+ // changed in the subsequent steps.
+ fixMin: fixMin,
+ fixMax: fixMax
+ };
}
function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -35311,9 +35394,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
}
function niceScaleExtent(scale, model) {
- var extent = getScaleExtent(scale, model);
- var fixMin = model.getMin() != null;
- var fixMax = model.getMax() != null;
+ var extentInfo = getScaleExtent(scale, model);
+ var extent = extentInfo.extent;
+
var splitNumber = model.get('splitNumber');
if (scale.type === 'log') {
@@ -35324,8 +35407,8 @@ function niceScaleExtent(scale, model) {
scale.setExtent(extent[0], extent[1]);
scale.niceExtent({
splitNumber: splitNumber,
- fixMin: fixMin,
- fixMax: fixMax,
+ fixMin: extentInfo.fixMin,
+ fixMax: extentInfo.fixMax,
minInterval: (scaleType === 'interval' || scaleType === 'time')
? model.get('minInterval') : null,
maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -36358,9 +36441,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
/**
* @alias module:echarts/coord/geo/parseGeoJson
* @param {Object} geoJson
+ * @param {string} nameProperty
* @return {module:zrender/container/Group}
*/
-var parseGeoJSON = function (geoJson) {
+var parseGeoJSON = function (geoJson, nameProperty) {
decode(geoJson);
@@ -36398,7 +36482,7 @@ var parseGeoJSON = function (geoJson) {
}
var region = new Region(
- properties.name,
+ properties[nameProperty || 'name'],
geometries,
properties.cp
);
@@ -37595,7 +37679,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var itemStyle = seriesScope && seriesScope.itemStyle;
var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
var symbolOffset = seriesScope && seriesScope.symbolOffset;
var labelModel = seriesScope && seriesScope.labelModel;
var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -37611,7 +37694,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
- symbolRotate = itemModel.getShallow('symbolRotate');
symbolOffset = itemModel.getShallow('symbolOffset');
labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -37625,6 +37707,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var elStyle = symbolPath.style;
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
+
symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
if (symbolOffset) {
@@ -38680,6 +38764,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
width += lineWidth;
height += lineWidth;
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
+ x = Math.floor(x);
+ width = Math.round(width);
+
var clipPath = new Rect({
shape: {
x: x,
@@ -38777,6 +38865,26 @@ function isPointsSame(points1, points2) {
return true;
}
+function getBoundingDiff(points1, points2) {
+ var min1 = [];
+ var max1 = [];
+
+ var min2 = [];
+ var max2 = [];
+
+ fromPoints(points1, min1, max1);
+ fromPoints(points2, min2, max2);
+
+ // Get a max value from each corner of two boundings.
+ 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])
+ );
+}
+
function getSmooth(smooth) {
return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
}
@@ -39389,6 +39497,24 @@ Chart.extend({
next = turnPointsIntoStep(diff.next, coordSys, step);
stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
}
+ // Don't apply animation if diff is large.
+ // For better result and avoid memory explosion problems like
+ // https://github.com/apache/incubator-echarts/issues/12229
+ if (getBoundingDiff(current, next) > 3000
+ || (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
+ ) {
+ polyline.setShape({
+ points: next
+ });
+ if (polygon) {
+ polygon.setShape({
+ points: next,
+ stackedOnPoints: stackedOnNext
+ });
+ }
+ return;
+ }
+
// `diff.current` is subset of `current` (which should be ensured by
// turnPointsIntoStep), so points in `__points` can be updated when
// points in `current` are update during animation.
@@ -39495,13 +39621,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var symbolType = seriesModel.get('symbol');
var symbolSize = seriesModel.get('symbolSize');
var keepAspect = seriesModel.get('symbolKeepAspect');
+ var symbolRotate = seriesModel.get('symbolRotate');
var hasSymbolTypeCallback = isFunction$1(symbolType);
var hasSymbolSizeCallback = isFunction$1(symbolSize);
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
-
data.setVisual({
legendSymbol: legendSymbol || seriesSymbol,
// If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -39510,7 +39637,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// some cases but generally it is not recommanded.
symbol: seriesSymbol,
symbolSize: seriesSymbolSize,
- symbolKeepAspect: keepAspect
+ symbolKeepAspect: keepAspect,
+ symbolRotate: symbolRotate
});
// Only visible series has each data be visual encoded
@@ -39524,12 +39652,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var params = seriesModel.getDataParams(idx);
hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
}
if (data.hasItemOption) {
var itemModel = data.getItemModel(idx);
var itemSymbolType = itemModel.getShallow('symbol', true);
var itemSymbolSize = itemModel.getShallow('symbolSize', true);
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
// If has item symbol
@@ -39540,6 +39670,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// PENDING Transform symbolSize ?
data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
}
+ if (itemSymbolRotate != null) {
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
+ }
if (itemSymbolKeepAspect != null) {
data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
}
@@ -43415,6 +43548,7 @@ extendChartView({
var drawBackground = seriesModel.get('showBackground', true);
var backgroundModel = seriesModel.getModel('backgroundStyle');
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
var bgEls = [];
var oldBgEls = this._backgroundEls || [];
@@ -43425,8 +43559,13 @@ extendChartView({
var layout = getLayout[coord.type](data, dataIndex, itemModel);
if (drawBackground) {
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
+ var bgLayout = getLayout[coord.type](data, dataIndex);
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[dataIndex] = bgEl;
}
@@ -43463,9 +43602,14 @@ extendChartView({
if (drawBackground) {
var bgEl = oldBgEls[oldIndex];
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[newIndex] = bgEl;
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
+ var bgLayout = getLayout[coord.type](data, newIndex);
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
updateProps(bgEl, { shape: shape }, animationModel, newIndex);
}
@@ -43715,9 +43859,11 @@ function removeSector(dataIndex, animationModel, el) {
}
var getLayout = {
+ // itemModel is only used to get borderWidth, which is not needed
+ // when calculating bar background layout.
cartesian2d: function (data, dataIndex, itemModel) {
var layout = data.getItemLayout(dataIndex);
- var fixedLineWidth = getLineWidth(itemModel, layout);
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
// fix layout with lineWidth
var signX = layout.width > 0 ? 1 : -1;
@@ -44591,31 +44737,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
this._updateLabel(data, idx, withAnimation);
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
+ this.highDownOnUpdate = !seriesModel.get('silent')
? function (fromState, toState) {
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
if (toState === 'emphasis') {
labelLine.ignore = labelLine.hoverIgnore;
labelText.ignore = labelText.hoverIgnore;
// Sector may has animation of updating data. Force to move to the last frame
// Or it may stopped on the wrong shape
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r + seriesModel.get('hoverOffset')
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r + seriesModel.get('hoverOffset')
+ }
+ }, 300, 'elasticOut');
+ }
}
else {
labelLine.ignore = labelLine.normalIgnore;
labelText.ignore = labelText.normalIgnore;
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r
+ }
+ }, 300, 'elasticOut');
+ }
}
}
: null;
@@ -49575,7 +49726,7 @@ extendComponentView({
var dataModel = el.dataModel || seriesModel;
var dataIndex = el.dataIndex;
var dataType = el.dataType;
- var data = dataModel.getData();
+ var data = dataModel.getData(dataType);
var tooltipModel = buildTooltipModel([
data.getItemModel(dataIndex),
@@ -51920,12 +52071,12 @@ extendComponentView({
if (link) {
textEl.on('click', function () {
- window.open(link, '_' + titleModel.get('target'));
+ windowOpen(link, '_' + titleModel.get('target'));
});
}
if (sublink) {
subTextEl.on('click', function () {
- window.open(sublink, '_' + titleModel.get('subtarget'));
+ windowOpen(link, '_' + titleModel.get('subtarget'));
});
}
@@ -53415,9 +53566,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
this.group.removeAll();
};
+function isEffectObject(el) {
+ return el.animators && el.animators.length > 0;
+}
+
lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
function updateIncrementalAndHover(el) {
- if (!el.isGroup) {
+ if (!el.isGroup && !isEffectObject(el)) {
el.incremental = el.useHoverLayer = true;
}
}
@@ -57925,7 +58080,7 @@ extendComponentView({
var feature;
// FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
- if (payload && payload.newTitle != null) {
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
featureOpt.title = payload.newTitle;
}
@@ -58198,7 +58353,8 @@ var proto$2 = SaveAsImage.prototype;
proto$2.onclick = function (ecModel, api) {
var model = this.model;
var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
- var type = model.get('type', true) || 'png';
+ var isSvg = api.getZr().painter.getType() === 'svg';
+ var type = isSvg ? 'svg' : model.get('type', true) || 'png';
var url = api.getConnectedDataURL({
type: type,
backgroundColor: model.get('backgroundColor', true)
@@ -58425,7 +58581,8 @@ proto$3.onclick = function (ecModel, api, type) {
type: 'changeMagicType',
currentType: type,
newOption: newOption,
- newTitle: newTitle
+ newTitle: newTitle,
+ featureName: 'magicType'
});
};
@@ -63954,11 +64111,16 @@ var SVGPainter = function (root, storage, opts, zrId) {
this.storage = storage;
this._opts = opts = extend({}, opts || {});
- var svgRoot = createElement('svg');
- svgRoot.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
- svgRoot.setAttribute('version', '1.1');
- svgRoot.setAttribute('baseProfile', 'full');
- svgRoot.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
+ var svgDom = createElement('svg');
+ svgDom.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
+ svgDom.setAttribute('version', '1.1');
+ svgDom.setAttribute('baseProfile', 'full');
+ svgDom.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
+
+ var bgRoot = createElement('g');
+ svgDom.appendChild(bgRoot);
+ var svgRoot = createElement('g');
+ svgDom.appendChild(svgRoot);
this.gradientManager = new GradientManager(zrId, svgRoot);
this.clipPathManager = new ClippathManager(zrId, svgRoot);
@@ -63967,11 +64129,13 @@ var SVGPainter = function (root, storage, opts, zrId) {
var viewport = document.createElement('div');
viewport.style.cssText = 'overflow:hidden;position:relative';
+ this._svgDom = svgDom;
this._svgRoot = svgRoot;
+ this._backgroundRoot = bgRoot;
this._viewport = viewport;
root.appendChild(viewport);
- viewport.appendChild(svgRoot);
+ viewport.appendChild(svgDom);
this.resize(opts.width, opts.height);
@@ -63990,6 +64154,14 @@ SVGPainter.prototype = {
return this._viewport;
},
+ getSvgDom: function () {
+ return this._svgDom;
+ },
+
+ getSvgRoot: function () {
+ return this._svgRoot;
+ },
+
getViewportRootOffset: function () {
var viewportRoot = this.getViewportRoot();
if (viewportRoot) {
@@ -64009,7 +64181,21 @@ SVGPainter.prototype = {
setBackgroundColor: function (backgroundColor) {
// TODO gradient
- this._viewport.style.background = backgroundColor;
+ // Insert a bg rect instead of setting background to viewport.
+ // Otherwise, the exported SVG don't have background.
+ if (this._backgroundRoot && this._backgroundNode) {
+ this._backgroundRoot.removeChild(this._backgroundNode);
+ }
+
+ var bgNode = createElement('rect');
+ bgNode.setAttribute('width', this.getWidth());
+ bgNode.setAttribute('height', this.getHeight());
+ bgNode.setAttribute('x', 0);
+ bgNode.setAttribute('y', 0);
+ bgNode.setAttribute('id', 0);
+ bgNode.style.fill = backgroundColor;
+ this._backgroundRoot.appendChild(bgNode);
+ this._backgroundNode = bgNode;
},
_paintList: function (list) {
@@ -64139,8 +64325,8 @@ SVGPainter.prototype = {
},
_getDefs: function (isForceCreating) {
- var svgRoot = this._svgRoot;
- var defs = this._svgRoot.getElementsByTagName('defs');
+ var svgRoot = this._svgDom;
+ var defs = svgRoot.getElementsByTagName('defs');
if (defs.length === 0) {
// Not exist
if (isForceCreating) {
@@ -64197,11 +64383,16 @@ SVGPainter.prototype = {
viewportStyle.width = width + 'px';
viewportStyle.height = height + 'px';
- var svgRoot = this._svgRoot;
+ var svgRoot = this._svgDom;
// Set width by 'svgRoot.width = width' is invalid
svgRoot.setAttribute('width', width);
svgRoot.setAttribute('height', height);
}
+
+ if (this._backgroundNode) {
+ this._backgroundNode.setAttribute('width', width);
+ this._backgroundNode.setAttribute('height', height);
+ }
},
/**
@@ -64243,10 +64434,13 @@ SVGPainter.prototype = {
dispose: function () {
this.root.innerHTML = '';
- this._svgRoot =
- this._viewport =
- this.storage =
- null;
+ this._svgRoot
+ = this._backgroundRoot
+ = this._svgDom
+ = this._backgroundNode
+ = this._viewport
+ = this.storage
+ = null;
},
clear: function () {
@@ -64255,9 +64449,9 @@ SVGPainter.prototype = {
}
},
- pathToDataUrl: function () {
+ toDataURL: function () {
this.refresh();
- var html = this._svgRoot.outerHTML;
+ var html = encodeURIComponent(this._svgDom.outerHTML.replace(/></g, '>\n\r<'));
return 'data:image/svg+xml;charset=UTF-8,' + html;
}
};
@@ -64273,7 +64467,7 @@ function createMethodNotSupport$1(method) {
each$1([
'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer',
'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer',
- 'toDataURL', 'pathToImage'
+ 'pathToImage'
], function (name) {
SVGPainter.prototype[name] = createMethodNotSupport$1(name);
});
diff --git a/dist/echarts.common.min.js b/dist/echarts.common.min.js
index 0d97001..54d93ec 100644
--- a/dist/echarts.common.min.js
+++ b/dist/echarts.common.min.js
@@ -19,4 +19,4 @@
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,i=function(){return e++},v="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,i=function(){return e++},v="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
diff --git a/dist/echarts.js b/dist/echarts.js
index 49a2582..dd55582 100644
--- a/dist/echarts.js
+++ b/dist/echarts.js
@@ -10252,6 +10252,10 @@ Painter.prototype = {
if (this._layerConfig[zlevel]) {
merge(layer, this._layerConfig[zlevel], true);
}
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
+ else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
+ merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
+ }
if (virtual) {
layer.virtual = virtual;
@@ -10404,12 +10408,26 @@ Painter.prototype = {
var prevLayer = null;
var incrementalLayerCount = 0;
+ var prevZlevel;
for (var i = 0; i < list.length; i++) {
var el = list[i];
var zlevel = el.zlevel;
var layer;
- // PENDING If change one incremental element style ?
- // TODO Where there are non-incremental elements between incremental elements.
+
+ if (prevZlevel !== zlevel) {
+ prevZlevel = zlevel;
+ incrementalLayerCount = 0;
+ }
+
+ // TODO Not use magic number on zlevel.
+
+ // Each layer with increment element can be separated to 3 layers.
+ // (Other Element drawn after incremental element)
+ // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------
+ // (Incremental element)
+ // ----------------------zlevel + INCREMENTAL_INC------------------------
+ // (Element drawn before incremental element)
+ // --------------------------------zlevel--------------------------------
if (el.incremental) {
layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
layer.incremental = true;
@@ -10504,6 +10522,7 @@ Painter.prototype = {
for (var i = 0; i < this._zlevelList.length; i++) {
var _zlevel = this._zlevelList[i];
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
var layer = this._layers[_zlevel];
merge(layer, layerConfig[zlevel], true);
@@ -11576,7 +11595,7 @@ var instances$1 = {}; // ZRender实例map索引
/**
* @type {string}
*/
-var version$1 = '4.3.0';
+var version$1 = '4.3.1';
/**
* Initializing a zrender instance
@@ -17838,11 +17857,13 @@ function getHighlightDigit(highlightKey) {
* @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
* @param {string|Function} [opt.defaultText]
* @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDataIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDimIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {string} [opt.labelProp] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
* @param {Object} [normalSpecified]
* @param {Object} [emphasisSpecified]
*/
@@ -17856,6 +17877,7 @@ function setLabelStyle(
var labelFetcher = opt.labelFetcher;
var labelDataIndex = opt.labelDataIndex;
var labelDimIndex = opt.labelDimIndex;
+ var labelProp = opt.labelProp;
// This scenario, `label.normal.show = true; label.emphasis.show = false`,
// is not supported util someone requests.
@@ -17869,7 +17891,7 @@ function setLabelStyle(
var baseText;
if (showNormal || showEmphasis) {
if (labelFetcher) {
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
}
if (baseText == null) {
baseText = isFunction$1(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -17879,7 +17901,7 @@ function setLabelStyle(
var emphasisStyleText = showEmphasis
? retrieve2(
labelFetcher
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
: null,
baseText
)
@@ -19790,7 +19812,7 @@ var number = (Object.freeze || Object)({
// import Text from 'zrender/src/graphic/Text';
/**
- * 每三位默认加,格式化
+ * add commas after every three numbers
* @param {string|number} x
* @return {string}
*/
@@ -20043,6 +20065,22 @@ function getTextRect(
);
}
+/**
+ * open new tab
+ * @param {string} link url
+ * @param {string} target blank or self
+ */
+function windowOpen(link, target) {
+ if (target === '_blank' || target === 'blank') {
+ var blank = window.open();
+ blank.opener = null;
+ blank.location = link;
+ }
+ else {
+ window.open(link, target);
+ }
+}
+
var format = (Object.freeze || Object)({
addCommas: addCommas,
@@ -20056,7 +20094,8 @@ var format = (Object.freeze || Object)({
capitalFirst: capitalFirst,
truncateText: truncateText$1,
getTextBoundingRect: getTextBoundingRect,
- getTextRect: getTextRect
+ getTextRect: getTextRect,
+ windowOpen: windowOpen
});
/*
@@ -25060,7 +25099,7 @@ function dataTaskReset(context) {
function dataTaskProgress(param, context) {
// Avoid repead cloneShallow when data just created in reset.
- if (param.end > context.outputData.count()) {
+ if (context.outputData && param.end > context.outputData.count()) {
context.model.getRawData().cloneShallow(context.outputData);
}
}
@@ -26040,11 +26079,16 @@ var loadingDefault = function (api, opts) {
opts = opts || {};
defaults(opts, {
text: 'loading',
- color: '#c23531',
textColor: '#000',
+ fontSize: '12px',
maskColor: 'rgba(255, 255, 255, 0.8)',
+ showSpinner: true,
+ color: '#c23531',
+ spinnerRadius: 10,
+ lineWidth: 5,
zlevel: 0
});
+ var group = new Group();
var mask = new Rect({
style: {
fill: opts.maskColor
@@ -26052,24 +26096,13 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10000
});
- var arc = new Arc({
- shape: {
- startAngle: -PI$1 / 2,
- endAngle: -PI$1 / 2 + 0.1,
- r: 10
- },
- style: {
- stroke: opts.color,
- lineCap: 'round',
- lineWidth: 5
- },
- zlevel: opts.zlevel,
- z: 10001
- });
+ group.add(mask);
+ var font = opts.fontSize + ' sans-serif';
var labelRect = new Rect({
style: {
fill: 'none',
text: opts.text,
+ font: font,
textPosition: 'right',
textDistance: 10,
textFill: opts.textColor
@@ -26077,32 +26110,49 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10001
});
-
- arc.animateShape(true)
- .when(1000, {
- endAngle: PI$1 * 3 / 2
- })
- .start('circularInOut');
- arc.animateShape(true)
- .when(1000, {
- startAngle: PI$1 * 3 / 2
- })
- .delay(300)
- .start('circularInOut');
-
- var group = new Group();
- group.add(arc);
group.add(labelRect);
- group.add(mask);
+ if (opts.showSpinner) {
+ var arc = new Arc({
+ shape: {
+ startAngle: -PI$1 / 2,
+ endAngle: -PI$1 / 2 + 0.1,
+ r: opts.spinnerRadius
+ },
+ style: {
+ stroke: opts.color,
+ lineCap: 'round',
+ lineWidth: opts.lineWidth
+ },
+ zlevel: opts.zlevel,
+ z: 10001
+ });
+ arc.animateShape(true)
+ .when(1000, {
+ endAngle: PI$1 * 3 / 2
+ })
+ .start('circularInOut');
+ arc.animateShape(true)
+ .when(1000, {
+ startAngle: PI$1 * 3 / 2
+ })
+ .delay(300)
+ .start('circularInOut');
+ group.add(arc);
+ }
// Inject resize
group.resize = function () {
- var cx = api.getWidth() / 2;
+ var textWidth = getWidth(opts.text, font);
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
+ // textDistance needs to be calculated when both animation and text exist
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
+ // only show the text
+ - (opts.showSpinner ? 0 : textWidth / 2);
var cy = api.getHeight() / 2;
- arc.setShape({
+ opts.showSpinner && arc.setShape({
cx: cx,
cy: cy
});
- var r = arc.shape.r;
labelRect.setShape({
x: cx - r,
y: cy - r,
@@ -27762,10 +27812,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType;
-var version = '4.7.0';
+var version = '4.8.0';
var dependencies = {
- zrender: '4.3.0'
+ zrender: '4.3.1'
};
var TEST_FRAME_REMAIN_TIME = 1;
@@ -28184,7 +28234,7 @@ echartsProto.getRenderedCanvas = function (opts) {
* Get svg data url
* @return {string}
*/
-echartsProto.getSvgDataUrl = function () {
+echartsProto.getSvgDataURL = function () {
if (!env$1.svgSupported) {
return;
}
@@ -28196,7 +28246,7 @@ echartsProto.getSvgDataUrl = function () {
el.stopAnimation(true);
});
- return zr.painter.pathToDataUrl();
+ return zr.painter.toDataURL();
};
/**
@@ -28232,7 +28282,7 @@ echartsProto.getDataURL = function (opts) {
});
var url = this._zr.painter.getType() === 'svg'
- ? this.getSvgDataUrl()
+ ? this.getSvgDataURL()
: this.getRenderedCanvas(opts).toDataURL(
'image/' + (opts && opts.type || 'png')
);
@@ -28261,6 +28311,7 @@ echartsProto.getConnectedDataURL = function (opts) {
if (!env$1.canvasSupported) {
return;
}
+ var isSvg = opts.type === 'svg';
var groupId = this.group;
var mathMin = Math.min;
var mathMax = Math.max;
@@ -28275,9 +28326,9 @@ echartsProto.getConnectedDataURL = function (opts) {
each$1(instances, function (chart, id) {
if (chart.group === groupId) {
- var canvas = chart.getRenderedCanvas(
- clone(opts)
- );
+ var canvas = isSvg
+ ? chart.getZr().painter.getSvgDom().innerHTML
+ : chart.getRenderedCanvas(clone(opts));
var boundingRect = chart.getDom().getBoundingClientRect();
left = mathMin(boundingRect.left, left);
top = mathMin(boundingRect.top, top);
@@ -28298,38 +28349,61 @@ echartsProto.getConnectedDataURL = function (opts) {
var width = right - left;
var height = bottom - top;
var targetCanvas = createCanvas();
- targetCanvas.width = width;
- targetCanvas.height = height;
- var zr = init$1(targetCanvas);
+ var zr = init$1(targetCanvas, {
+ renderer: isSvg ? 'svg' : 'canvas'
+ });
+ zr.resize({
+ width: width,
+ height: height
+ });
- // Background between the charts
- if (opts.connectedBackgroundColor) {
- zr.add(new Rect({
- shape: {
- x: 0,
- y: 0,
- width: width,
- height: height
- },
- style: {
- fill: opts.connectedBackgroundColor
- }
- }));
+ if (isSvg) {
+ var content = '';
+ each(canvasList, function (item) {
+ var x = item.left - left;
+ var y = item.top - top;
+ content += '<g transform="translate(' + x + ','
+ + y + ')">' + item.dom + '</g>';
+ });
+ zr.painter.getSvgRoot().innerHTML = content;
+
+ if (opts.connectedBackgroundColor) {
+ zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
+ }
+
+ zr.refreshImmediately();
+ return zr.painter.toDataURL();
}
+ else {
+ // Background between the charts
+ if (opts.connectedBackgroundColor) {
+ zr.add(new Rect({
+ shape: {
+ x: 0,
+ y: 0,
+ width: width,
+ height: height
+ },
+ style: {
+ fill: opts.connectedBackgroundColor
+ }
+ }));
+ }
- each(canvasList, function (item) {
- var img = new ZImage({
- style: {
- x: item.left * dpr - left,
- y: item.top * dpr - top,
- image: item.dom
- }
+ each(canvasList, function (item) {
+ var img = new ZImage({
+ style: {
+ x: item.left * dpr - left,
+ y: item.top * dpr - top,
+ image: item.dom
+ }
+ });
+ zr.add(img);
});
- zr.add(img);
- });
- zr.refreshImmediately();
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ zr.refreshImmediately();
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ }
}
else {
return this.getDataURL(opts);
@@ -34764,9 +34838,11 @@ var largeLayout = {
coord = cartesian.dataToPoint(valuePair, null, coord);
// Data index might not be in order, depends on `progressiveChunkMode`.
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coordLayout.x + coordLayout.width : coord[0];
largePoints[pointsOffset++] = coord[0];
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coord[1] : coordLayout.y + coordLayout.height;
largePoints[pointsOffset++] = coord[1];
largeDataIndices[idxOffset++] = dataIndex;
}
@@ -35256,8 +35332,6 @@ function getScaleExtent(scale, model) {
var min = model.getMin();
var max = model.getMax();
- var fixMin = min != null;
- var fixMax = max != null;
var originalExtent = scale.getExtent();
var axisDataLen;
@@ -35301,17 +35375,6 @@ function getScaleExtent(scale, model) {
// (2) When `needCrossZero` and all data is positive/negative, should it be ensured
// that the results processed by boundaryGap are positive/negative?
- if (min == null) {
- min = scaleType === 'ordinal'
- ? (axisDataLen ? 0 : NaN)
- : originalExtent[0] - boundaryGap[0] * span;
- }
- if (max == null) {
- max = scaleType === 'ordinal'
- ? (axisDataLen ? axisDataLen - 1 : NaN)
- : originalExtent[1] + boundaryGap[1] * span;
- }
-
if (min === 'dataMin') {
min = originalExtent[0];
}
@@ -35332,6 +35395,20 @@ function getScaleExtent(scale, model) {
});
}
+ var fixMin = min != null;
+ var fixMax = max != null;
+
+ if (min == null) {
+ min = scaleType === 'ordinal'
+ ? (axisDataLen ? 0 : NaN)
+ : originalExtent[0] - boundaryGap[0] * span;
+ }
+ if (max == null) {
+ max = scaleType === 'ordinal'
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
+ : originalExtent[1] + boundaryGap[1] * span;
+ }
+
(min == null || !isFinite(min)) && (min = NaN);
(max == null || !isFinite(max)) && (max = NaN);
@@ -35382,7 +35459,13 @@ function getScaleExtent(scale, model) {
}
}
- return [min, max];
+ return {
+ extent: [min, max],
+ // "fix" means "fixed", the value should not be
+ // changed in the subsequent steps.
+ fixMin: fixMin,
+ fixMax: fixMax
+ };
}
function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -35421,9 +35504,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
}
function niceScaleExtent(scale, model) {
- var extent = getScaleExtent(scale, model);
- var fixMin = model.getMin() != null;
- var fixMax = model.getMax() != null;
+ var extentInfo = getScaleExtent(scale, model);
+ var extent = extentInfo.extent;
+
var splitNumber = model.get('splitNumber');
if (scale.type === 'log') {
@@ -35434,8 +35517,8 @@ function niceScaleExtent(scale, model) {
scale.setExtent(extent[0], extent[1]);
scale.niceExtent({
splitNumber: splitNumber,
- fixMin: fixMin,
- fixMax: fixMax,
+ fixMin: extentInfo.fixMin,
+ fixMax: extentInfo.fixMax,
minInterval: (scaleType === 'interval' || scaleType === 'time')
? model.get('minInterval') : null,
maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -36468,9 +36551,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
/**
* @alias module:echarts/coord/geo/parseGeoJson
* @param {Object} geoJson
+ * @param {string} nameProperty
* @return {module:zrender/container/Group}
*/
-var parseGeoJson$1 = function (geoJson) {
+var parseGeoJson$1 = function (geoJson, nameProperty) {
decode(geoJson);
@@ -36508,7 +36592,7 @@ var parseGeoJson$1 = function (geoJson) {
}
var region = new Region(
- properties.name,
+ properties[nameProperty || 'name'],
geometries,
properties.cp
);
@@ -37705,7 +37789,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var itemStyle = seriesScope && seriesScope.itemStyle;
var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
var symbolOffset = seriesScope && seriesScope.symbolOffset;
var labelModel = seriesScope && seriesScope.labelModel;
var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -37721,7 +37804,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
- symbolRotate = itemModel.getShallow('symbolRotate');
symbolOffset = itemModel.getShallow('symbolOffset');
labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -37735,6 +37817,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var elStyle = symbolPath.style;
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
+
symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
if (symbolOffset) {
@@ -38790,6 +38874,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
width += lineWidth;
height += lineWidth;
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
+ x = Math.floor(x);
+ width = Math.round(width);
+
var clipPath = new Rect({
shape: {
x: x,
@@ -38887,6 +38975,26 @@ function isPointsSame(points1, points2) {
return true;
}
+function getBoundingDiff(points1, points2) {
+ var min1 = [];
+ var max1 = [];
+
+ var min2 = [];
+ var max2 = [];
+
+ fromPoints(points1, min1, max1);
+ fromPoints(points2, min2, max2);
+
+ // Get a max value from each corner of two boundings.
+ 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])
+ );
+}
+
function getSmooth(smooth) {
return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
}
@@ -39499,6 +39607,24 @@ Chart.extend({
next = turnPointsIntoStep(diff.next, coordSys, step);
stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
}
+ // Don't apply animation if diff is large.
+ // For better result and avoid memory explosion problems like
+ // https://github.com/apache/incubator-echarts/issues/12229
+ if (getBoundingDiff(current, next) > 3000
+ || (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
+ ) {
+ polyline.setShape({
+ points: next
+ });
+ if (polygon) {
+ polygon.setShape({
+ points: next,
+ stackedOnPoints: stackedOnNext
+ });
+ }
+ return;
+ }
+
// `diff.current` is subset of `current` (which should be ensured by
// turnPointsIntoStep), so points in `__points` can be updated when
// points in `current` are update during animation.
@@ -39605,13 +39731,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var symbolType = seriesModel.get('symbol');
var symbolSize = seriesModel.get('symbolSize');
var keepAspect = seriesModel.get('symbolKeepAspect');
+ var symbolRotate = seriesModel.get('symbolRotate');
var hasSymbolTypeCallback = isFunction$1(symbolType);
var hasSymbolSizeCallback = isFunction$1(symbolSize);
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
-
data.setVisual({
legendSymbol: legendSymbol || seriesSymbol,
// If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -39620,7 +39747,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// some cases but generally it is not recommanded.
symbol: seriesSymbol,
symbolSize: seriesSymbolSize,
- symbolKeepAspect: keepAspect
+ symbolKeepAspect: keepAspect,
+ symbolRotate: symbolRotate
});
// Only visible series has each data be visual encoded
@@ -39634,12 +39762,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var params = seriesModel.getDataParams(idx);
hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
}
if (data.hasItemOption) {
var itemModel = data.getItemModel(idx);
var itemSymbolType = itemModel.getShallow('symbol', true);
var itemSymbolSize = itemModel.getShallow('symbolSize', true);
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
// If has item symbol
@@ -39650,6 +39780,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// PENDING Transform symbolSize ?
data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
}
+ if (itemSymbolRotate != null) {
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
+ }
if (itemSymbolKeepAspect != null) {
data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
}
@@ -43525,6 +43658,7 @@ extendChartView({
var drawBackground = seriesModel.get('showBackground', true);
var backgroundModel = seriesModel.getModel('backgroundStyle');
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
var bgEls = [];
var oldBgEls = this._backgroundEls || [];
@@ -43535,8 +43669,13 @@ extendChartView({
var layout = getLayout[coord.type](data, dataIndex, itemModel);
if (drawBackground) {
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
+ var bgLayout = getLayout[coord.type](data, dataIndex);
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[dataIndex] = bgEl;
}
@@ -43573,9 +43712,14 @@ extendChartView({
if (drawBackground) {
var bgEl = oldBgEls[oldIndex];
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[newIndex] = bgEl;
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
+ var bgLayout = getLayout[coord.type](data, newIndex);
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
updateProps(bgEl, { shape: shape }, animationModel, newIndex);
}
@@ -43825,9 +43969,11 @@ function removeSector(dataIndex, animationModel, el) {
}
var getLayout = {
+ // itemModel is only used to get borderWidth, which is not needed
+ // when calculating bar background layout.
cartesian2d: function (data, dataIndex, itemModel) {
var layout = data.getItemLayout(dataIndex);
- var fixedLineWidth = getLineWidth(itemModel, layout);
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
// fix layout with lineWidth
var signX = layout.width > 0 ? 1 : -1;
@@ -44701,31 +44847,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
this._updateLabel(data, idx, withAnimation);
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
+ this.highDownOnUpdate = !seriesModel.get('silent')
? function (fromState, toState) {
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
if (toState === 'emphasis') {
labelLine.ignore = labelLine.hoverIgnore;
labelText.ignore = labelText.hoverIgnore;
// Sector may has animation of updating data. Force to move to the last frame
// Or it may stopped on the wrong shape
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r + seriesModel.get('hoverOffset')
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r + seriesModel.get('hoverOffset')
+ }
+ }, 300, 'elasticOut');
+ }
}
else {
labelLine.ignore = labelLine.normalIgnore;
labelText.ignore = labelText.normalIgnore;
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r
+ }
+ }, 300, 'elasticOut');
+ }
}
}
: null;
@@ -46478,7 +46629,7 @@ Radar.prototype.update = function (ecModel, api) {
}
// Force all the axis fixing the maxSplitNumber.
each$1(indicatorAxes, function (indicatorAxis, idx) {
- var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model);
+ var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model).extent;
niceScaleExtent(indicatorAxis.scale, indicatorAxis.model);
var axisModel = indicatorAxis.model;
@@ -47598,9 +47749,10 @@ var geoJSONLoader = {
/**
* @param {string} mapName
* @param {Object} mapRecord {specialAreas, geoJSON}
+ * @param {string} nameProperty
* @return {Object} {regions, boundingRect}
*/
- load: function (mapName, mapRecord) {
+ load: function (mapName, mapRecord, nameProperty) {
var parsed = inner$7(mapRecord).parsed;
@@ -47614,7 +47766,7 @@ var geoJSONLoader = {
// https://jsperf.com/try-catch-performance-overhead
try {
- regions = geoJSON ? parseGeoJson$1(geoJSON) : [];
+ regions = geoJSON ? parseGeoJson$1(geoJSON, nameProperty) : [];
}
catch (e) {
throw new Error('Invalid geoJson format\n' + e.message);
@@ -47822,9 +47974,10 @@ var geoSourceManager = {
/**
* @param {string} mapName
* @param {Object} nameMap
+ * @param {string} nameProperty
* @return {Object} source {regions, regionsMap, nameCoordMap, boundingRect}
*/
- load: function (mapName, nameMap) {
+ load: function (mapName, nameMap, nameProperty) {
var regions = [];
var regionsMap = createHashMap();
var nameCoordMap = createHashMap();
@@ -47832,7 +47985,7 @@ var geoSourceManager = {
var mapRecords = retrieveMap(mapName);
each$1(mapRecords, function (record) {
- var singleSource = loaders[record.type].load(mapName, record);
+ var singleSource = loaders[record.type].load(mapName, record, nameProperty);
each$1(singleSource.regions, function (region) {
var regionName = region.name;
@@ -47971,7 +48124,7 @@ var MapSeries = SeriesModel.extend({
});
}
- var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap);
+ var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty);
each$1(geoSource.regions, function (region) {
var name = region.name;
if (!dataNameMap.get(name)) {
@@ -48161,7 +48314,8 @@ var MapSeries = SeriesModel.extend({
itemStyle: {
areaColor: 'rgba(255,215,0,0.8)'
}
- }
+ },
+ nameProperty: 'name'
}
});
@@ -48771,9 +48925,25 @@ MapDraw.prototype = {
var group = this.group;
var transformInfo = geo.getTransformInfo();
- group.transform = transformInfo.roamTransform;
- group.decomposeTransform();
- group.dirty();
+ // No animation when first draw or in action
+ var isFirstDraw = !regionsGroup.childAt(0) || payload;
+ var targetScale;
+ if (isFirstDraw) {
+ group.transform = transformInfo.roamTransform;
+ group.decomposeTransform();
+ group.dirty();
+ }
+ else {
+ var target = new Transformable();
+ target.transform = transformInfo.roamTransform;
+ target.decomposeTransform();
+ var props = {
+ scale: target.scale,
+ position: target.position
+ };
+ targetScale = target.scale;
+ updateProps(group, props, mapOrGeoModel);
+ }
var scale = transformInfo.rawScale;
var position = transformInfo.rawPosition;
@@ -48915,6 +49085,12 @@ MapDraw.prototype = {
}
);
+ if (!isFirstDraw) {
+ // Text animation
+ var textScale = [1 / targetScale[0], 1 / targetScale[1]];
+ updateProps(textEl, { scale: textScale }, mapOrGeoModel);
+ }
+
regionGroup.add(textEl);
}
@@ -50822,11 +50998,14 @@ TreeNode.prototype = {
var hostTree = this.hostTree;
var itemModel = hostTree.data.getItemModel(this.dataIndex);
var levelModel = this.getLevelModel();
- var leavesModel;
- if (!levelModel && (this.children.length === 0 || (this.children.length !== 0 && this.isExpand === false))) {
- leavesModel = this.getLeavesModel();
+
+ // FIXME: refactor levelModel to "beforeLink", and remove levelModel here.
+ if (levelModel) {
+ return itemModel.getModel(path, levelModel.getModel(path));
+ }
+ else {
+ return itemModel.getModel(path);
}
- return itemModel.getModel(path, (levelModel || leavesModel || hostTree.hostModel).getModel(path));
},
/**
@@ -50837,13 +51016,6 @@ TreeNode.prototype = {
},
/**
- * @return {module:echarts/model/Model}
- */
- getLeavesModel: function () {
- return this.hostTree.leavesModel;
- },
-
- /**
* @example
* setItemVisual('color', color);
* setItemVisual({
@@ -50913,9 +51085,8 @@ TreeNode.prototype = {
* @alias module:echarts/data/Tree
* @param {module:echarts/model/Model} hostModel
* @param {Array.<Object>} levelOptions
- * @param {Object} leavesOption
*/
-function Tree(hostModel, levelOptions, leavesOption) {
+function Tree(hostModel, levelOptions) {
/**
* @type {module:echarts/data/Tree~TreeNode}
* @readOnly
@@ -50951,7 +51122,6 @@ function Tree(hostModel, levelOptions, leavesOption) {
return new Model(levelDefine, hostModel, hostModel.ecModel);
});
- this.leavesModel = new Model(leavesOption || {}, hostModel, hostModel.ecModel);
}
Tree.prototype = {
@@ -51043,12 +51213,11 @@ Tree.prototype = {
* @param {module:echarts/model/Model} hostModel
* @param {Object} treeOptions
* @param {Array.<Object>} treeOptions.levels
- * @param {Array.<Object>} treeOptions.leaves
* @return module:echarts/data/Tree
*/
Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
- var tree = new Tree(hostModel, treeOptions.levels, treeOptions.leaves);
+ var tree = new Tree(hostModel, treeOptions && treeOptions.levels);
var listData = [];
var dimMax = 1;
@@ -51085,6 +51254,8 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
var list = new List(dimensionsInfo, hostModel);
list.initData(listData);
+ beforeLink && beforeLink(list);
+
linkList({
mainData: list,
struct: tree,
@@ -51093,8 +51264,6 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
tree.update();
- beforeLink && beforeLink(list);
-
return tree;
};
@@ -51154,17 +51323,13 @@ SeriesModel.extend({
var root = {name: option.name, children: option.data};
var leaves = option.leaves || {};
+ var leavesModel = new Model(leaves, this, this.ecModel);
- var treeOption = {};
-
- treeOption.leaves = leaves;
-
- var tree = Tree.createTree(root, this, treeOption, beforeLink);
+ var tree = Tree.createTree(root, this, {}, beforeLink);
function beforeLink(nodeData) {
nodeData.wrapMethod('getItemModel', function (model, idx) {
var node = tree.getNodeByDataIndex(idx);
- var leavesModel = node.getLeavesModel();
if (!node.children.length || !node.isExpand) {
model.parentModel = leavesModel;
}
@@ -52779,15 +52944,25 @@ SeriesModel.extend({
var levels = option.levels || [];
levels = option.levels = setDefault(levels, ecModel);
-
- var treeOption = {};
-
- treeOption.levels = levels;
+ var levelModels = map(levels || [], function (levelDefine) {
+ return new Model(levelDefine, this, ecModel);
+ }, this);
// Make sure always a new tree is created when setOption,
// in TreemapView, we check whether oldTree === newTree
// to choose mappings approach among old shapes and new shapes.
- return Tree.createTree(root, this, treeOption).data;
+ var tree = Tree.createTree(root, this, null, beforeLink);
+
+ function beforeLink(nodeData) {
+ nodeData.wrapMethod('getItemModel', function (model, idx) {
+ var node = tree.getNodeByDataIndex(idx);
+ var levelModel = levelModels[node.depth];
+ levelModel && (model.parentModel = levelModel);
+ return model;
+ });
+ }
+
+ return tree.data;
},
optionUpdated: function () {
@@ -53798,7 +53973,7 @@ extendChartView({
var itemModel = node.hostTree.data.getItemModel(node.dataIndex);
var link = itemModel.get('link', true);
var linkTarget = itemModel.get('target', true) || 'blank';
- link && window.open(link, linkTarget);
+ link && windowOpen(link, linkTarget);
}
}
@@ -53988,7 +54163,7 @@ function renderNode(
// Background
var bg = giveGraphic('background', Rect$1, depth, Z_BG);
- bg && renderBackground(group, bg, isParent && thisLayout.upperHeight);
+ bg && renderBackground(group, bg, isParent && thisLayout.upperLabelHeight);
// No children, render content.
if (isParent) {
@@ -54109,16 +54284,7 @@ function renderNode(
}
function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
- var text = retrieve(
- seriesModel.getFormattedLabel(
- thisNode.dataIndex, 'normal', null, null, upperLabelRect ? 'upperLabel' : 'label'
- ),
- nodeModel.get('name')
- );
- if (!upperLabelRect && thisLayout.isLeafRoot) {
- var iconChar = seriesModel.get('drillDownIcon', true);
- text = iconChar ? iconChar + ' ' + text : text;
- }
+ var defaultText = nodeModel.get('name');
var normalLabelModel = nodeModel.getModel(
upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL
@@ -54132,12 +54298,18 @@ function renderNode(
setLabelStyle(
normalStyle, emphasisStyle, normalLabelModel, emphasisLabelModel,
{
- defaultText: isShow ? text : null,
+ defaultText: isShow ? defaultText : null,
autoColor: visualColor,
- isRectText: true
+ isRectText: true,
+ labelFetcher: seriesModel,
+ labelDataIndex: thisNode.dataIndex,
+ labelProp: upperLabelRect ? 'upperLabel' : 'label'
}
);
+ addDrillDownIcon(normalStyle, upperLabelRect, thisLayout);
+ addDrillDownIcon(emphasisStyle, upperLabelRect, thisLayout);
+
upperLabelRect && (normalStyle.textRect = clone(upperLabelRect));
normalStyle.truncate = (isShow && normalLabelModel.get('ellipsis'))
@@ -54149,6 +54321,14 @@ function renderNode(
: null;
}
+ function addDrillDownIcon(style, upperLabelRect, thisLayout) {
+ var text = style.text;
+ if (!upperLabelRect && thisLayout.isLeafRoot && text != null) {
+ var iconChar = seriesModel.get('drillDownIcon', true);
+ style.text = iconChar ? iconChar + ' ' + text : text;
+ }
+ }
+
function giveGraphic(storageName, Ctor, depth, z) {
var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex];
var lasts = lastsForAnimation[storageName];
@@ -57319,9 +57499,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
this.group.removeAll();
};
+function isEffectObject(el) {
+ return el.animators && el.animators.length > 0;
+}
+
lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
function updateIncrementalAndHover(el) {
- if (!el.isGroup) {
+ if (!el.isGroup && !isEffectObject(el)) {
el.incremental = el.useHoverLayer = true;
}
}
@@ -64371,7 +64555,13 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
each$1(nodes, function (node) {
if (node.outEdges.length) {
var y = sum(node.outEdges, weightedTarget, orient)
- / sum(node.outEdges, getEdgeValue, orient);
+ / sum(node.outEdges, getEdgeValue, orient);
+
+ if (isNaN(y)) {
+ var len = node.outEdges.length;
+ y = len ? sum(node.outEdges, centerTarget, orient) / len : 0;
+ }
+
if (orient === 'vertical') {
var nodeX = node.getLayout().x + (y - center$1(node, orient)) * alpha;
node.setLayout({x: nodeX}, true);
@@ -64388,10 +64578,16 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
function weightedTarget(edge, orient) {
return center$1(edge.node2, orient) * edge.getValue();
}
+function centerTarget(edge, orient) {
+ return center$1(edge.node2, orient);
+}
function weightedSource(edge, orient) {
return center$1(edge.node1, orient) * edge.getValue();
}
+function centerSource(edge, orient) {
+ return center$1(edge.node1, orient);
+}
function center$1(node, orient) {
return orient === 'vertical'
@@ -64427,8 +64623,15 @@ function relaxLeftToRight(nodesByBreadth, alpha, orient) {
each$1(nodesByBreadth, function (nodes) {
each$1(nodes, function (node) {
if (node.inEdges.length) {
+
var y = sum(node.inEdges, weightedSource, orient)
- / sum(node.inEdges, getEdgeValue, orient);
+ / sum(node.inEdges, getEdgeValue, orient);
+
+ if (isNaN(y)) {
+ var len = node.inEdges.length;
+ y = len ? sum(node.inEdges, centerSource, orient) / len : 0;
+ }
+
if (orient === 'vertical') {
var nodeX = node.getLayout().x + (y - center$1(node, orient)) * alpha;
node.setLayout({x: nodeX}, true);
@@ -66268,7 +66471,8 @@ effectSymbolProto.updateData = function (data, idx) {
pos[0] = parsePercent$1(symbolOffset[0], symbolSize[0]);
pos[1] = parsePercent$1(symbolOffset[1], symbolSize[1]);
}
- rippleGroup.rotation = (itemModel.getShallow('symbolRotate') || 0) * Math.PI / 180 || 0;
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
+ rippleGroup.rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
var effectCfg = {};
@@ -68186,8 +68390,8 @@ extendChartView({
rect = new Rect({
shape: {
- x: Math.floor(point[0] - width / 2),
- y: Math.floor(point[1] - height / 2),
+ x: Math.floor(Math.round(point[0]) - width / 2),
+ y: Math.floor(Math.round(point[1]) - height / 2),
width: Math.ceil(width),
height: Math.ceil(height)
},
@@ -72664,8 +72868,7 @@ SeriesModel.extend({
align: 'center',
position: 'inside',
distance: 5,
- silent: true,
- emphasis: {}
+ silent: true
},
itemStyle: {
borderWidth: 1,
@@ -72675,13 +72878,19 @@ SeriesModel.extend({
shadowColor: 'rgba(0, 0, 0, 0.2)',
shadowOffsetX: 0,
shadowOffsetY: 0,
- opacity: 1,
- emphasis: {},
- highlight: {
+ opacity: 1
+ },
+ highlight: {
+ itemStyle: {
opacity: 1
+ }
+ },
+ downplay: {
+ itemStyle: {
+ opacity: 0.5
},
- downplay: {
- opacity: 0.9
+ label: {
+ opacity: 0.6
}
},
@@ -72927,6 +73136,8 @@ SunburstPieceProto.updateData = function (
this._seriesModel = seriesModel || this._seriesModel;
this._ecModel = ecModel || this._ecModel;
+
+ setHoverStyle(this);
};
SunburstPieceProto.onEmphasis = function (highlightPolicy) {
@@ -73390,7 +73601,7 @@ var SunburstView = Chart.extend({
if (link) {
var linkTarget = itemModel.get('target', true)
|| '_blank';
- window.open(link, linkTarget);
+ windowOpen(link, linkTarget);
}
}
targetFound = true;
@@ -77314,7 +77525,10 @@ Calendar.prototype = {
var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY)
- Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1;
- // Consider case:
+ // Consider case1 (#11677 #10430):
+ // Set the system timezone as "UK", set the range to `['2016-07-01', '2016-12-31']`
+
+ // Consider case2:
// Firstly set system timezone as "Time Zone: America/Toronto",
// ```
// var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
@@ -77327,11 +77541,15 @@ Calendar.prototype = {
var endDateNum = range[1].date.getDate();
date.setDate(startDateNum + allDay - 1);
// The bias can not over a month, so just compare date.
- if (date.getDate() !== endDateNum) {
+ var dateNum = date.getDate();
+ if (dateNum !== endDateNum) {
var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
- while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
+ while (
+ (dateNum = date.getDate()) !== endDateNum
+ && (date.getTime() - range[1].time) * sign > 0
+ ) {
allDay -= sign;
- date.setDate(startDateNum + allDay - 1);
+ date.setDate(dateNum - sign);
}
}
@@ -78918,7 +79136,7 @@ extendComponentView({
var feature;
// FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
- if (payload && payload.newTitle != null) {
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
featureOpt.title = payload.newTitle;
}
@@ -79191,7 +79409,8 @@ var proto$2 = SaveAsImage.prototype;
proto$2.onclick = function (ecModel, api) {
var model = this.model;
var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
- var type = model.get('type', true) || 'png';
+ var isSvg = api.getZr().painter.getType() === 'svg';
+ var type = isSvg ? 'svg' : model.get('type', true) || 'png';
var url = api.getConnectedDataURL({
type: type,
backgroundColor: model.get('backgroundColor', true)
@@ -79418,7 +79637,8 @@ proto$3.onclick = function (ecModel, api, type) {
type: 'changeMagicType',
currentType: type,
newOption: newOption,
- newTitle: newTitle
+ newTitle: newTitle,
+ featureName: 'magicType'
});
};
@@ -83602,7 +83822,7 @@ extendComponentView({
var dataModel = el.dataModel || seriesModel;
var dataIndex = el.dataIndex;
var dataType = el.dataType;
- var data = dataModel.getData();
+ var data = dataModel.getData(dataType);
var tooltipModel = buildTooltipModel([
data.getItemModel(dataIndex),
@@ -85400,12 +85620,12 @@ extendComponentView({
if (link) {
textEl.on('click', function () {
- window.open(link, '_' + titleModel.get('target'));
+ windowOpen(link, '_' + titleModel.get('target'));
});
}
if (sublink) {
subTextEl.on('click', function () {
- window.open(sublink, '_' + titleModel.get('subtarget'));
+ windowOpen(link, '_' + titleModel.get('subtarget'));
});
}
@@ -94170,25 +94390,21 @@ var resetMethods = {
thisOption.precision = precision;
splitStep = +splitStep.toFixed(precision);
- var index = 0;
-
if (thisOption.minOpen) {
pieceList.push({
- index: index++,
interval: [-Infinity, dataExtent[0]],
close: [0, 0]
});
}
for (
- var curr = dataExtent[0], len = index + splitNumber;
- index < len;
- curr += splitStep
+ var index = 0, curr = dataExtent[0];
+ index < splitNumber;
+ curr += splitStep, index++
) {
var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);
pieceList.push({
- index: index++,
interval: [curr, max],
close: [1, 1]
});
@@ -94196,7 +94412,6 @@ var resetMethods = {
if (thisOption.maxOpen) {
pieceList.push({
- index: index++,
interval: [dataExtent[1], Infinity],
close: [0, 0]
});
@@ -94204,7 +94419,8 @@ var resetMethods = {
reformIntervals(pieceList);
- each$1(pieceList, function (piece) {
+ each$1(pieceList, function (piece, index) {
+ piece.index = index;
piece.text = this.formatValueText(piece.interval);
}, this);
},
@@ -97513,11 +97729,16 @@ var SVGPainter = function (root, storage, opts, zrId) {
this.storage = storage;
this._opts = opts = extend({}, opts || {});
- var svgRoot = createElement('svg');
- svgRoot.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
- svgRoot.setAttribute('version', '1.1');
- svgRoot.setAttribute('baseProfile', 'full');
- svgRoot.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
+ var svgDom = createElement('svg');
+ svgDom.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
+ svgDom.setAttribute('version', '1.1');
+ svgDom.setAttribute('baseProfile', 'full');
+ svgDom.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
+
+ var bgRoot = createElement('g');
+ svgDom.appendChild(bgRoot);
+ var svgRoot = createElement('g');
+ svgDom.appendChild(svgRoot);
this.gradientManager = new GradientManager(zrId, svgRoot);
this.clipPathManager = new ClippathManager(zrId, svgRoot);
@@ -97526,11 +97747,13 @@ var SVGPainter = function (root, storage, opts, zrId) {
var viewport = document.createElement('div');
viewport.style.cssText = 'overflow:hidden;position:relative';
+ this._svgDom = svgDom;
this._svgRoot = svgRoot;
+ this._backgroundRoot = bgRoot;
this._viewport = viewport;
root.appendChild(viewport);
- viewport.appendChild(svgRoot);
+ viewport.appendChild(svgDom);
this.resize(opts.width, opts.height);
@@ -97549,6 +97772,14 @@ SVGPainter.prototype = {
return this._viewport;
},
+ getSvgDom: function () {
+ return this._svgDom;
+ },
+
+ getSvgRoot: function () {
+ return this._svgRoot;
+ },
+
getViewportRootOffset: function () {
var viewportRoot = this.getViewportRoot();
if (viewportRoot) {
@@ -97568,7 +97799,21 @@ SVGPainter.prototype = {
setBackgroundColor: function (backgroundColor) {
// TODO gradient
- this._viewport.style.background = backgroundColor;
+ // Insert a bg rect instead of setting background to viewport.
+ // Otherwise, the exported SVG don't have background.
+ if (this._backgroundRoot && this._backgroundNode) {
+ this._backgroundRoot.removeChild(this._backgroundNode);
+ }
+
+ var bgNode = createElement('rect');
+ bgNode.setAttribute('width', this.getWidth());
+ bgNode.setAttribute('height', this.getHeight());
+ bgNode.setAttribute('x', 0);
+ bgNode.setAttribute('y', 0);
+ bgNode.setAttribute('id', 0);
+ bgNode.style.fill = backgroundColor;
+ this._backgroundRoot.appendChild(bgNode);
+ this._backgroundNode = bgNode;
},
_paintList: function (list) {
@@ -97698,8 +97943,8 @@ SVGPainter.prototype = {
},
_getDefs: function (isForceCreating) {
- var svgRoot = this._svgRoot;
- var defs = this._svgRoot.getElementsByTagName('defs');
+ var svgRoot = this._svgDom;
+ var defs = svgRoot.getElementsByTagName('defs');
if (defs.length === 0) {
// Not exist
if (isForceCreating) {
@@ -97756,11 +98001,16 @@ SVGPainter.prototype = {
viewportStyle.width = width + 'px';
viewportStyle.height = height + 'px';
- var svgRoot = this._svgRoot;
+ var svgRoot = this._svgDom;
// Set width by 'svgRoot.width = width' is invalid
svgRoot.setAttribute('width', width);
svgRoot.setAttribute('height', height);
}
+
+ if (this._backgroundNode) {
+ this._backgroundNode.setAttribute('width', width);
+ this._backgroundNode.setAttribute('height', height);
+ }
},
/**
@@ -97802,10 +98052,13 @@ SVGPainter.prototype = {
dispose: function () {
this.root.innerHTML = '';
- this._svgRoot =
- this._viewport =
- this.storage =
- null;
+ this._svgRoot
+ = this._backgroundRoot
+ = this._svgDom
+ = this._backgroundNode
+ = this._viewport
+ = this.storage
+ = null;
},
clear: function () {
@@ -97814,9 +98067,9 @@ SVGPainter.prototype = {
}
},
- pathToDataUrl: function () {
+ toDataURL: function () {
this.refresh();
- var html = this._svgRoot.outerHTML;
+ var html = encodeURIComponent(this._svgDom.outerHTML.replace(/></g, '>\n\r<'));
return 'data:image/svg+xml;charset=UTF-8,' + html;
}
};
@@ -97832,7 +98085,7 @@ function createMethodNotSupport$1(method) {
each$1([
'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer',
'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer',
- 'toDataURL', 'pathToImage'
+ 'pathToImage'
], function (name) {
SVGPainter.prototype[name] = createMethodNotSupport$1(name);
});
diff --git a/dist/echarts.js.map b/dist/echarts.js.map
index d989128..479d634 100644
--- a/dist/echarts.js.map
+++ b/dist/echarts.js.map
@@ -1 +1 @@
-{"version":3,"file":"echarts.js","sources":["../src/config.js","../../zrender/src/core/guid.js","../../zrender/src/core/env.js","../../zrender/src/core/util.js","../../zrender/src/core/vector.js","../../zrender/src/mixin/Draggable.js","../../zrender/src/mixin/Eventful.js","../../zrender/src/core/fourPointsTransform.js","../../zrender/src/core/dom.js","../../zrender/src/core/event.js","../../zrender/src/core/GestureMgr.js","../../zrender/src/Handler.js","../../zrender/src/core/matrix.js", [...]
\ No newline at end of file
+{"version":3,"file":"echarts.js","sources":["../src/config.js","../../zrender/src/core/guid.js","../../zrender/src/core/env.js","../../zrender/src/core/util.js","../../zrender/src/core/vector.js","../../zrender/src/mixin/Draggable.js","../../zrender/src/mixin/Eventful.js","../../zrender/src/core/fourPointsTransform.js","../../zrender/src/core/dom.js","../../zrender/src/core/event.js","../../zrender/src/core/GestureMgr.js","../../zrender/src/Handler.js","../../zrender/src/core/matrix.js", [...]
\ No newline at end of file
diff --git a/dist/echarts.min.js b/dist/echarts.min.js
index 35d375c..dc78df6 100644
--- a/dist/echarts.min.js
+++ b/dist/echarts.min.js
@@ -19,4 +19,4 @@
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,n=function(){return e++},v="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,n=function(){return e++},v="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
diff --git a/dist/echarts.simple.js b/dist/echarts.simple.js
index 23cb6d2..4bb3088 100644
--- a/dist/echarts.simple.js
+++ b/dist/echarts.simple.js
@@ -9948,6 +9948,10 @@ Painter.prototype = {
if (this._layerConfig[zlevel]) {
merge(layer, this._layerConfig[zlevel], true);
}
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
+ else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
+ merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
+ }
if (virtual) {
layer.virtual = virtual;
@@ -10100,12 +10104,26 @@ Painter.prototype = {
var prevLayer = null;
var incrementalLayerCount = 0;
+ var prevZlevel;
for (var i = 0; i < list.length; i++) {
var el = list[i];
var zlevel = el.zlevel;
var layer;
- // PENDING If change one incremental element style ?
- // TODO Where there are non-incremental elements between incremental elements.
+
+ if (prevZlevel !== zlevel) {
+ prevZlevel = zlevel;
+ incrementalLayerCount = 0;
+ }
+
+ // TODO Not use magic number on zlevel.
+
+ // Each layer with increment element can be separated to 3 layers.
+ // (Other Element drawn after incremental element)
+ // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------
+ // (Incremental element)
+ // ----------------------zlevel + INCREMENTAL_INC------------------------
+ // (Element drawn before incremental element)
+ // --------------------------------zlevel--------------------------------
if (el.incremental) {
layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
layer.incremental = true;
@@ -10200,6 +10218,7 @@ Painter.prototype = {
for (var i = 0; i < this._zlevelList.length; i++) {
var _zlevel = this._zlevelList[i];
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
var layer = this._layers[_zlevel];
merge(layer, layerConfig[zlevel], true);
@@ -11270,7 +11289,7 @@ var painterCtors = {
/**
* @type {string}
*/
-var version$1 = '4.3.0';
+var version$1 = '4.3.1';
/**
* Initializing a zrender instance
@@ -13098,7 +13117,30 @@ var extremity = create();
* @param {number} min
* @param {number} max
*/
+function fromPoints(points, min$$1, max$$1) {
+ if (points.length === 0) {
+ return;
+ }
+ var p = points[0];
+ var left = p[0];
+ var right = p[0];
+ var top = p[1];
+ var bottom = p[1];
+ var i;
+ for (i = 1; i < points.length; i++) {
+ p = points[i];
+ left = mathMin$3(left, p[0]);
+ right = mathMax$3(right, p[0]);
+ top = mathMin$3(top, p[1]);
+ bottom = mathMax$3(bottom, p[1]);
+ }
+
+ min$$1[0] = left;
+ min$$1[1] = top;
+ max$$1[0] = right;
+ max$$1[1] = bottom;
+}
/**
* @memberOf module:zrender/core/bbox
@@ -17420,11 +17462,13 @@ function getHighlightDigit(highlightKey) {
* @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
* @param {string|Function} [opt.defaultText]
* @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDataIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {number} [opt.labelDimIndex] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
+ * @param {string} [opt.labelProp] Fetch text by
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
* @param {Object} [normalSpecified]
* @param {Object} [emphasisSpecified]
*/
@@ -17438,6 +17482,7 @@ function setLabelStyle(
var labelFetcher = opt.labelFetcher;
var labelDataIndex = opt.labelDataIndex;
var labelDimIndex = opt.labelDimIndex;
+ var labelProp = opt.labelProp;
// This scenario, `label.normal.show = true; label.emphasis.show = false`,
// is not supported util someone requests.
@@ -17451,7 +17496,7 @@ function setLabelStyle(
var baseText;
if (showNormal || showEmphasis) {
if (labelFetcher) {
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
}
if (baseText == null) {
baseText = isFunction$1(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -17461,7 +17506,7 @@ function setLabelStyle(
var emphasisStyleText = showEmphasis
? retrieve2(
labelFetcher
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
: null,
baseText
)
@@ -19280,7 +19325,7 @@ function nice(val, round) {
// import Text from 'zrender/src/graphic/Text';
/**
- * 每三位默认加,格式化
+ * add commas after every three numbers
* @param {string|number} x
* @return {string}
*/
@@ -19495,6 +19540,13 @@ var truncateText$1 = truncateText;
* But deprecated this interface. Please use `getTextBoundingRect` instead.
*/
+
+/**
+ * open new tab
+ * @param {string} link url
+ * @param {string} target blank or self
+ */
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24429,7 +24481,7 @@ function dataTaskReset(context) {
function dataTaskProgress(param, context) {
// Avoid repead cloneShallow when data just created in reset.
- if (param.end > context.outputData.count()) {
+ if (context.outputData && param.end > context.outputData.count()) {
context.model.getRawData().cloneShallow(context.outputData);
}
}
@@ -25374,11 +25426,16 @@ var loadingDefault = function (api, opts) {
opts = opts || {};
defaults(opts, {
text: 'loading',
- color: '#c23531',
textColor: '#000',
+ fontSize: '12px',
maskColor: 'rgba(255, 255, 255, 0.8)',
+ showSpinner: true,
+ color: '#c23531',
+ spinnerRadius: 10,
+ lineWidth: 5,
zlevel: 0
});
+ var group = new Group();
var mask = new Rect({
style: {
fill: opts.maskColor
@@ -25386,24 +25443,13 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10000
});
- var arc = new Arc({
- shape: {
- startAngle: -PI$1 / 2,
- endAngle: -PI$1 / 2 + 0.1,
- r: 10
- },
- style: {
- stroke: opts.color,
- lineCap: 'round',
- lineWidth: 5
- },
- zlevel: opts.zlevel,
- z: 10001
- });
+ group.add(mask);
+ var font = opts.fontSize + ' sans-serif';
var labelRect = new Rect({
style: {
fill: 'none',
text: opts.text,
+ font: font,
textPosition: 'right',
textDistance: 10,
textFill: opts.textColor
@@ -25411,32 +25457,49 @@ var loadingDefault = function (api, opts) {
zlevel: opts.zlevel,
z: 10001
});
-
- arc.animateShape(true)
- .when(1000, {
- endAngle: PI$1 * 3 / 2
- })
- .start('circularInOut');
- arc.animateShape(true)
- .when(1000, {
- startAngle: PI$1 * 3 / 2
- })
- .delay(300)
- .start('circularInOut');
-
- var group = new Group();
- group.add(arc);
group.add(labelRect);
- group.add(mask);
+ if (opts.showSpinner) {
+ var arc = new Arc({
+ shape: {
+ startAngle: -PI$1 / 2,
+ endAngle: -PI$1 / 2 + 0.1,
+ r: opts.spinnerRadius
+ },
+ style: {
+ stroke: opts.color,
+ lineCap: 'round',
+ lineWidth: opts.lineWidth
+ },
+ zlevel: opts.zlevel,
+ z: 10001
+ });
+ arc.animateShape(true)
+ .when(1000, {
+ endAngle: PI$1 * 3 / 2
+ })
+ .start('circularInOut');
+ arc.animateShape(true)
+ .when(1000, {
+ startAngle: PI$1 * 3 / 2
+ })
+ .delay(300)
+ .start('circularInOut');
+ group.add(arc);
+ }
// Inject resize
group.resize = function () {
- var cx = api.getWidth() / 2;
+ var textWidth = getWidth(opts.text, font);
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
+ // textDistance needs to be calculated when both animation and text exist
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
+ // only show the text
+ - (opts.showSpinner ? 0 : textWidth / 2);
var cy = api.getHeight() / 2;
- arc.setShape({
+ opts.showSpinner && arc.setShape({
cx: cx,
cy: cy
});
- var r = arc.shape.r;
labelRect.setShape({
x: cx - r,
y: cy - r,
@@ -27092,10 +27155,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType;
-var version = '4.7.0';
+var version = '4.8.0';
var dependencies = {
- zrender: '4.3.0'
+ zrender: '4.3.1'
};
var TEST_FRAME_REMAIN_TIME = 1;
@@ -27514,7 +27577,7 @@ echartsProto.getRenderedCanvas = function (opts) {
* Get svg data url
* @return {string}
*/
-echartsProto.getSvgDataUrl = function () {
+echartsProto.getSvgDataURL = function () {
if (!env$1.svgSupported) {
return;
}
@@ -27526,7 +27589,7 @@ echartsProto.getSvgDataUrl = function () {
el.stopAnimation(true);
});
- return zr.painter.pathToDataUrl();
+ return zr.painter.toDataURL();
};
/**
@@ -27562,7 +27625,7 @@ echartsProto.getDataURL = function (opts) {
});
var url = this._zr.painter.getType() === 'svg'
- ? this.getSvgDataUrl()
+ ? this.getSvgDataURL()
: this.getRenderedCanvas(opts).toDataURL(
'image/' + (opts && opts.type || 'png')
);
@@ -27591,6 +27654,7 @@ echartsProto.getConnectedDataURL = function (opts) {
if (!env$1.canvasSupported) {
return;
}
+ var isSvg = opts.type === 'svg';
var groupId = this.group;
var mathMin = Math.min;
var mathMax = Math.max;
@@ -27605,9 +27669,9 @@ echartsProto.getConnectedDataURL = function (opts) {
each$1(instances, function (chart, id) {
if (chart.group === groupId) {
- var canvas = chart.getRenderedCanvas(
- clone(opts)
- );
+ var canvas = isSvg
+ ? chart.getZr().painter.getSvgDom().innerHTML
+ : chart.getRenderedCanvas(clone(opts));
var boundingRect = chart.getDom().getBoundingClientRect();
left = mathMin(boundingRect.left, left);
top = mathMin(boundingRect.top, top);
@@ -27628,38 +27692,61 @@ echartsProto.getConnectedDataURL = function (opts) {
var width = right - left;
var height = bottom - top;
var targetCanvas = createCanvas();
- targetCanvas.width = width;
- targetCanvas.height = height;
- var zr = init$1(targetCanvas);
+ var zr = init$1(targetCanvas, {
+ renderer: isSvg ? 'svg' : 'canvas'
+ });
+ zr.resize({
+ width: width,
+ height: height
+ });
- // Background between the charts
- if (opts.connectedBackgroundColor) {
- zr.add(new Rect({
- shape: {
- x: 0,
- y: 0,
- width: width,
- height: height
- },
- style: {
- fill: opts.connectedBackgroundColor
- }
- }));
+ if (isSvg) {
+ var content = '';
+ each(canvasList, function (item) {
+ var x = item.left - left;
+ var y = item.top - top;
+ content += '<g transform="translate(' + x + ','
+ + y + ')">' + item.dom + '</g>';
+ });
+ zr.painter.getSvgRoot().innerHTML = content;
+
+ if (opts.connectedBackgroundColor) {
+ zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
+ }
+
+ zr.refreshImmediately();
+ return zr.painter.toDataURL();
}
+ else {
+ // Background between the charts
+ if (opts.connectedBackgroundColor) {
+ zr.add(new Rect({
+ shape: {
+ x: 0,
+ y: 0,
+ width: width,
+ height: height
+ },
+ style: {
+ fill: opts.connectedBackgroundColor
+ }
+ }));
+ }
- each(canvasList, function (item) {
- var img = new ZImage({
- style: {
- x: item.left * dpr - left,
- y: item.top * dpr - top,
- image: item.dom
- }
+ each(canvasList, function (item) {
+ var img = new ZImage({
+ style: {
+ x: item.left * dpr - left,
+ y: item.top * dpr - top,
+ image: item.dom
+ }
+ });
+ zr.add(img);
});
- zr.add(img);
- });
- zr.refreshImmediately();
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ zr.refreshImmediately();
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
+ }
}
else {
return this.getDataURL(opts);
@@ -33517,7 +33604,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var itemStyle = seriesScope && seriesScope.itemStyle;
var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
var symbolOffset = seriesScope && seriesScope.symbolOffset;
var labelModel = seriesScope && seriesScope.labelModel;
var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -33533,7 +33619,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
- symbolRotate = itemModel.getShallow('symbolRotate');
symbolOffset = itemModel.getShallow('symbolOffset');
labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -33547,6 +33632,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
var elStyle = symbolPath.style;
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
+
symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
if (symbolOffset) {
@@ -34602,6 +34689,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
width += lineWidth;
height += lineWidth;
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
+ x = Math.floor(x);
+ width = Math.round(width);
+
var clipPath = new Rect({
shape: {
x: x,
@@ -34699,6 +34790,26 @@ function isPointsSame(points1, points2) {
return true;
}
+function getBoundingDiff(points1, points2) {
+ var min1 = [];
+ var max1 = [];
+
+ var min2 = [];
+ var max2 = [];
+
+ fromPoints(points1, min1, max1);
+ fromPoints(points2, min2, max2);
+
+ // Get a max value from each corner of two boundings.
+ 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])
+ );
+}
+
function getSmooth(smooth) {
return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
}
@@ -35311,6 +35422,24 @@ Chart.extend({
next = turnPointsIntoStep(diff.next, coordSys, step);
stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
}
+ // Don't apply animation if diff is large.
+ // For better result and avoid memory explosion problems like
+ // https://github.com/apache/incubator-echarts/issues/12229
+ if (getBoundingDiff(current, next) > 3000
+ || (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
+ ) {
+ polyline.setShape({
+ points: next
+ });
+ if (polygon) {
+ polygon.setShape({
+ points: next,
+ stackedOnPoints: stackedOnNext
+ });
+ }
+ return;
+ }
+
// `diff.current` is subset of `current` (which should be ensured by
// turnPointsIntoStep), so points in `__points` can be updated when
// points in `current` are update during animation.
@@ -35417,13 +35546,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var symbolType = seriesModel.get('symbol');
var symbolSize = seriesModel.get('symbolSize');
var keepAspect = seriesModel.get('symbolKeepAspect');
+ var symbolRotate = seriesModel.get('symbolRotate');
var hasSymbolTypeCallback = isFunction$1(symbolType);
var hasSymbolSizeCallback = isFunction$1(symbolSize);
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
-
data.setVisual({
legendSymbol: legendSymbol || seriesSymbol,
// If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -35432,7 +35562,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// some cases but generally it is not recommanded.
symbol: seriesSymbol,
symbolSize: seriesSymbolSize,
- symbolKeepAspect: keepAspect
+ symbolKeepAspect: keepAspect,
+ symbolRotate: symbolRotate
});
// Only visible series has each data be visual encoded
@@ -35446,12 +35577,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
var params = seriesModel.getDataParams(idx);
hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
}
if (data.hasItemOption) {
var itemModel = data.getItemModel(idx);
var itemSymbolType = itemModel.getShallow('symbol', true);
var itemSymbolSize = itemModel.getShallow('symbolSize', true);
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
// If has item symbol
@@ -35462,6 +35595,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
// PENDING Transform symbolSize ?
data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
}
+ if (itemSymbolRotate != null) {
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
+ }
if (itemSymbolKeepAspect != null) {
data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
}
@@ -36970,9 +37106,11 @@ var largeLayout = {
coord = cartesian.dataToPoint(valuePair, null, coord);
// Data index might not be in order, depends on `progressiveChunkMode`.
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coordLayout.x + coordLayout.width : coord[0];
largePoints[pointsOffset++] = coord[0];
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
+ ? coord[1] : coordLayout.y + coordLayout.height;
largePoints[pointsOffset++] = coord[1];
largeDataIndices[idxOffset++] = dataIndex;
}
@@ -37462,8 +37600,6 @@ function getScaleExtent(scale, model) {
var min = model.getMin();
var max = model.getMax();
- var fixMin = min != null;
- var fixMax = max != null;
var originalExtent = scale.getExtent();
var axisDataLen;
@@ -37507,17 +37643,6 @@ function getScaleExtent(scale, model) {
// (2) When `needCrossZero` and all data is positive/negative, should it be ensured
// that the results processed by boundaryGap are positive/negative?
- if (min == null) {
- min = scaleType === 'ordinal'
- ? (axisDataLen ? 0 : NaN)
- : originalExtent[0] - boundaryGap[0] * span;
- }
- if (max == null) {
- max = scaleType === 'ordinal'
- ? (axisDataLen ? axisDataLen - 1 : NaN)
- : originalExtent[1] + boundaryGap[1] * span;
- }
-
if (min === 'dataMin') {
min = originalExtent[0];
}
@@ -37538,6 +37663,20 @@ function getScaleExtent(scale, model) {
});
}
+ var fixMin = min != null;
+ var fixMax = max != null;
+
+ if (min == null) {
+ min = scaleType === 'ordinal'
+ ? (axisDataLen ? 0 : NaN)
+ : originalExtent[0] - boundaryGap[0] * span;
+ }
+ if (max == null) {
+ max = scaleType === 'ordinal'
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
+ : originalExtent[1] + boundaryGap[1] * span;
+ }
+
(min == null || !isFinite(min)) && (min = NaN);
(max == null || !isFinite(max)) && (max = NaN);
@@ -37588,7 +37727,13 @@ function getScaleExtent(scale, model) {
}
}
- return [min, max];
+ return {
+ extent: [min, max],
+ // "fix" means "fixed", the value should not be
+ // changed in the subsequent steps.
+ fixMin: fixMin,
+ fixMax: fixMax
+ };
}
function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -37627,9 +37772,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
}
function niceScaleExtent(scale, model) {
- var extent = getScaleExtent(scale, model);
- var fixMin = model.getMin() != null;
- var fixMax = model.getMax() != null;
+ var extentInfo = getScaleExtent(scale, model);
+ var extent = extentInfo.extent;
+
var splitNumber = model.get('splitNumber');
if (scale.type === 'log') {
@@ -37640,8 +37785,8 @@ function niceScaleExtent(scale, model) {
scale.setExtent(extent[0], extent[1]);
scale.niceExtent({
splitNumber: splitNumber,
- fixMin: fixMin,
- fixMax: fixMax,
+ fixMin: extentInfo.fixMin,
+ fixMax: extentInfo.fixMax,
minInterval: (scaleType === 'interval' || scaleType === 'time')
? model.get('minInterval') : null,
maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -42081,6 +42226,7 @@ extendChartView({
var drawBackground = seriesModel.get('showBackground', true);
var backgroundModel = seriesModel.getModel('backgroundStyle');
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
var bgEls = [];
var oldBgEls = this._backgroundEls || [];
@@ -42091,8 +42237,13 @@ extendChartView({
var layout = getLayout[coord.type](data, dataIndex, itemModel);
if (drawBackground) {
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
+ var bgLayout = getLayout[coord.type](data, dataIndex);
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[dataIndex] = bgEl;
}
@@ -42129,9 +42280,14 @@ extendChartView({
if (drawBackground) {
var bgEl = oldBgEls[oldIndex];
bgEl.useStyle(backgroundModel.getBarItemStyle());
+ // Only cartesian2d support borderRadius.
+ if (coord.type === 'cartesian2d') {
+ bgEl.setShape('r', barBorderRadius);
+ }
bgEls[newIndex] = bgEl;
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
+ var bgLayout = getLayout[coord.type](data, newIndex);
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
updateProps(bgEl, { shape: shape }, animationModel, newIndex);
}
@@ -42381,9 +42537,11 @@ function removeSector(dataIndex, animationModel, el) {
}
var getLayout = {
+ // itemModel is only used to get borderWidth, which is not needed
+ // when calculating bar background layout.
cartesian2d: function (data, dataIndex, itemModel) {
var layout = data.getItemLayout(dataIndex);
- var fixedLineWidth = getLineWidth(itemModel, layout);
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
// fix layout with lineWidth
var signX = layout.width > 0 ? 1 : -1;
@@ -43257,31 +43415,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
this._updateLabel(data, idx, withAnimation);
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
+ this.highDownOnUpdate = !seriesModel.get('silent')
? function (fromState, toState) {
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
if (toState === 'emphasis') {
labelLine.ignore = labelLine.hoverIgnore;
labelText.ignore = labelText.hoverIgnore;
// Sector may has animation of updating data. Force to move to the last frame
// Or it may stopped on the wrong shape
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r + seriesModel.get('hoverOffset')
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r + seriesModel.get('hoverOffset')
+ }
+ }, 300, 'elasticOut');
+ }
}
else {
labelLine.ignore = labelLine.normalIgnore;
labelText.ignore = labelText.normalIgnore;
- sector.stopAnimation(true);
- sector.animateTo({
- shape: {
- r: layout.r
- }
- }, 300, 'elasticOut');
+ if (hasAnimation) {
+ sector.stopAnimation(true);
+ sector.animateTo({
+ shape: {
+ r: layout.r
+ }
+ }, 300, 'elasticOut');
+ }
}
}
: null;
diff --git a/dist/echarts.simple.min.js b/dist/echarts.simple.min.js
index ca23401..7e2efe8 100644
--- a/dist/echarts.simple.min.js
+++ b/dist/echarts.simple.min.js
@@ -19,4 +19,4 @@
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,n=function(){return e++},m="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";var e=2311,n=function(){return e++},m="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasS [...]
diff --git a/dist/extension/bmap.js b/dist/extension/bmap.js
index e60ea12..e3bd8a2 100644
--- a/dist/extension/bmap.js
+++ b/dist/extension/bmap.js
@@ -270,6 +270,340 @@ echarts.extendComponentModel({
}
});
+/**
+ * @module zrender/core/util
+ */
+
+// 用于处理merge时无法遍历Date等对象的问题
+var BUILTIN_OBJECT = {
+ '[object Function]': 1,
+ '[object RegExp]': 1,
+ '[object Date]': 1,
+ '[object Error]': 1,
+ '[object CanvasGradient]': 1,
+ '[object CanvasPattern]': 1,
+ // For node-canvas
+ '[object Image]': 1,
+ '[object Canvas]': 1
+};
+
+var TYPED_ARRAY = {
+ '[object Int8Array]': 1,
+ '[object Uint8Array]': 1,
+ '[object Uint8ClampedArray]': 1,
+ '[object Int16Array]': 1,
+ '[object Uint16Array]': 1,
+ '[object Int32Array]': 1,
+ '[object Uint32Array]': 1,
+ '[object Float32Array]': 1,
+ '[object Float64Array]': 1
+};
+
+var objToString = Object.prototype.toString;
+
+
+
+/**
+ * Those data types can be cloned:
+ * Plain object, Array, TypedArray, number, string, null, undefined.
+ * Those data types will be assgined using the orginal data:
+ * BUILTIN_OBJECT
+ * Instance of user defined class will be cloned to a plain object, without
+ * properties in prototype.
+ * Other data types is not supported (not sure what will happen).
+ *
+ * Caution: do not support clone Date, for performance consideration.
+ * (There might be a large number of date in `series.data`).
+ * So date should not be modified in and out of echarts.
+ *
+ * @param {*} source
+ * @return {*} new
+ */
+function clone(source) {
+ if (source == null || typeof source !== 'object') {
+ return source;
+ }
+
+ var result = source;
+ var typeStr = objToString.call(source);
+
+ if (typeStr === '[object Array]') {
+ if (!isPrimitive(source)) {
+ result = [];
+ for (var i = 0, len = source.length; i < len; i++) {
+ result[i] = clone(source[i]);
+ }
+ }
+ }
+ else if (TYPED_ARRAY[typeStr]) {
+ if (!isPrimitive(source)) {
+ var Ctor = source.constructor;
+ if (source.constructor.from) {
+ result = Ctor.from(source);
+ }
+ else {
+ result = new Ctor(source.length);
+ for (var i = 0, len = source.length; i < len; i++) {
+ result[i] = clone(source[i]);
+ }
+ }
+ }
+ }
+ else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {
+ result = {};
+ for (var key in source) {
+ if (source.hasOwnProperty(key)) {
+ result[key] = clone(source[key]);
+ }
+ }
+ }
+
+ return result;
+}
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {*} target
+ * @param {*} source
+ * @param {boolean} [overwrite=false]
+ */
+
+
+/**
+ * @param {Array} targetAndSources The first item is target, and the rests are source.
+ * @param {boolean} [overwrite=false]
+ * @return {*} target
+ */
+
+
+/**
+ * @param {*} target
+ * @param {*} source
+ * @memberOf module:zrender/core/util
+ */
+
+
+/**
+ * @param {*} target
+ * @param {*} source
+ * @param {boolean} [overlay=false]
+ * @memberOf module:zrender/core/util
+ */
+
+
+
+
+
+
+/**
+ * 查询数组中元素的index
+ * @memberOf module:zrender/core/util
+ */
+
+
+/**
+ * 构造类继承关系
+ *
+ * @memberOf module:zrender/core/util
+ * @param {Function} clazz 源类
+ * @param {Function} baseClazz 基类
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {Object|Function} target
+ * @param {Object|Function} sorce
+ * @param {boolean} overlay
+ */
+
+
+/**
+ * Consider typed array.
+ * @param {Array|TypedArray} data
+ */
+
+
+/**
+ * 数组或对象遍历
+ * @memberOf module:zrender/core/util
+ * @param {Object|Array} obj
+ * @param {Function} cb
+ * @param {*} [context]
+ */
+
+
+/**
+ * 数组映射
+ * @memberOf module:zrender/core/util
+ * @param {Array} obj
+ * @param {Function} cb
+ * @param {*} [context]
+ * @return {Array}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {Array} obj
+ * @param {Function} cb
+ * @param {Object} [memo]
+ * @param {*} [context]
+ * @return {Array}
+ */
+
+
+/**
+ * 数组过滤
+ * @memberOf module:zrender/core/util
+ * @param {Array} obj
+ * @param {Function} cb
+ * @param {*} [context]
+ * @return {Array}
+ */
+
+
+/**
+ * 数组项查找
+ * @memberOf module:zrender/core/util
+ * @param {Array} obj
+ * @param {Function} cb
+ * @param {*} [context]
+ * @return {*}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {Function} func
+ * @param {*} context
+ * @return {Function}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {Function} func
+ * @return {Function}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {*} value
+ * @return {boolean}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {*} value
+ * @return {boolean}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {*} value
+ * @return {boolean}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {*} value
+ * @return {boolean}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {*} value
+ * @return {boolean}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {*} value
+ * @return {boolean}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {*} value
+ * @return {boolean}
+ */
+function isDom(value) {
+ return typeof value === 'object'
+ && typeof value.nodeType === 'number'
+ && typeof value.ownerDocument === 'object';
+}
+
+/**
+ * Whether is exactly NaN. Notice isNaN('a') returns true.
+ * @param {*} value
+ * @return {boolean}
+ */
+
+
+/**
+ * If value1 is not null, then return value1, otherwise judget rest of values.
+ * Low performance.
+ * @memberOf module:zrender/core/util
+ * @return {*} Final value
+ */
+
+
+
+
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {Array} arr
+ * @param {number} startIndex
+ * @param {number} endIndex
+ * @return {Array}
+ */
+
+
+/**
+ * Normalize css liked array configuration
+ * e.g.
+ * 3 => [3, 3, 3, 3]
+ * [4, 2] => [4, 2, 4, 2]
+ * [4, 3, 2] => [4, 3, 2, 3]
+ * @param {number|Array.<number>} val
+ * @return {Array.<number>}
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {boolean} condition
+ * @param {string} message
+ */
+
+
+/**
+ * @memberOf module:zrender/core/util
+ * @param {string} str string to be trimed
+ * @return {string} trimed string
+ */
+
+
+var primitiveKey = '__ec_primitive__';
+/**
+ * Set an object as primitive to be ignored traversing children in clone or merge
+ */
+
+
+function isPrimitive(obj) {
+ return obj[primitiveKey];
+}
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -366,7 +700,7 @@ echarts.extendComponentView({
if (JSON.stringify(originalStyle) !== mapStyleStr) {
// FIXME May have blank tile when dragging if setMapStyle
if (Object.keys(newMapStyle).length) {
- bmap.setMapStyle(newMapStyle);
+ bmap.setMapStyle(clone(newMapStyle));
}
bMapModel.__mapStyle = JSON.parse(mapStyleStr);
}
@@ -380,7 +714,7 @@ echarts.extendComponentView({
if (JSON.stringify(originalStyle2) !== mapStyleStr2) {
// FIXME May have blank tile when dragging if setMapStyle
if (Object.keys(newMapStyle2).length) {
- bmap.setMapStyleV2(newMapStyle2);
+ bmap.setMapStyleV2(clone(newMapStyle2));
}
bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
}
diff --git a/dist/extension/bmap.js.map b/dist/extension/bmap.js.map
index f4a67c9..21dbc5e 100644
--- a/dist/extension/bmap.js.map
+++ b/dist/extension/bmap.js.map
@@ -1 +1 @@
-{"version":3,"file":"bmap.js","sources":["../../extension-src/bmap/BMapCoordSys.js","../../extension-src/bmap/BMapModel.js","../../extension-src/bmap/BMapView.js","../../extension-src/bmap/bmap.js"],"sourcesContent":["/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache [...]
\ No newline at end of file
+{"version":3,"file":"bmap.js","sources":["../../extension-src/bmap/BMapCoordSys.js","../../extension-src/bmap/BMapModel.js","../../../zrender/src/core/util.js","../../extension-src/bmap/BMapView.js","../../extension-src/bmap/bmap.js"],"sourcesContent":["/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses [...]
\ No newline at end of file
diff --git a/dist/extension/bmap.min.js b/dist/extension/bmap.min.js
index 7f8893b..00f6917 100644
--- a/dist/extension/bmap.min.js
+++ b/dist/extension/bmap.min.js
@@ -19,4 +19,4 @@
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(t.bmap={},t.echarts)}(this,function(t,o){"use strict";function l(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(a,r){return r=r||[0,0],o.util.map([0,1],function(t){var e=r[t],o=a[t]/2,n=[],i=[];return n[t]=e-o,i[t]=e+o,n[1-t]=i[1-t [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(t.bmap={},t.echarts)}(this,function(t,o){"use strict";function l(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(i,a){return a=a||[0,0],o.util.map([0,1],function(t){var e=a[t],o=i[t]/2,n=[],r=[];return n[t]=e-o,r[t]=e+o,n[1-t]=r[1-t [...]
diff --git a/extension/bmap/BMapView.js b/extension/bmap/BMapView.js
index cca8d3b..0ea19d8 100644
--- a/extension/bmap/BMapView.js
+++ b/extension/bmap/BMapView.js
@@ -20,6 +20,10 @@
var echarts = require("echarts");
+var _util = require("zrender/lib/core/util");
+
+var clone = _util.clone;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -110,7 +114,7 @@ var _default = echarts.extendComponentView({
if (JSON.stringify(originalStyle) !== mapStyleStr) {
// FIXME May have blank tile when dragging if setMapStyle
if (Object.keys(newMapStyle).length) {
- bmap.setMapStyle(newMapStyle);
+ bmap.setMapStyle(clone(newMapStyle));
}
bMapModel.__mapStyle = JSON.parse(mapStyleStr);
@@ -126,7 +130,7 @@ var _default = echarts.extendComponentView({
if (JSON.stringify(originalStyle2) !== mapStyleStr2) {
// FIXME May have blank tile when dragging if setMapStyle
if (Object.keys(newMapStyle2).length) {
- bmap.setMapStyleV2(newMapStyle2);
+ bmap.setMapStyleV2(clone(newMapStyle2));
}
bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
diff --git a/package.json b/package.json
index 8111384..4813e38 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "echarts",
- "version": "4.7.0",
+ "version": "4.8.0",
"description": "A powerful charting and visualization library for browser",
"license": "Apache-2.0",
"keywords": [
@@ -27,7 +27,7 @@
"lint:dist": "echo 'It might take a while. Please wait ...' && ./node_modules/.bin/jshint --config .jshintrc-dist dist/echarts.js"
},
"dependencies": {
- "zrender": "4.3.0"
+ "zrender": "4.3.1"
},
"devDependencies": {
"@babel/core": "7.3.4",
diff --git a/src/echarts.js b/src/echarts.js
index ba17360..de90195 100644
--- a/src/echarts.js
+++ b/src/echarts.js
@@ -51,10 +51,10 @@ var isFunction = zrUtil.isFunction;
var isObject = zrUtil.isObject;
var parseClassType = ComponentModel.parseClassType;
-export var version = '4.7.0';
+export var version = '4.8.0';
export var dependencies = {
- zrender: '4.3.0'
+ zrender: '4.3.1'
};
var TEST_FRAME_REMAIN_TIME = 1;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org