Skip to content
Permalink
Browse files
release 4.8.0
  • Loading branch information
100pah committed May 25, 2020
1 parent d1ed12a commit 3ea6ea2a46fd162712b6801b1d38fe9fa63bea97
Showing 61 changed files with 3,143 additions and 1,232 deletions.
@@ -77,7 +77,7 @@ function initEnv() {
// Update home version each build.
config.homeVersion = +new Date();

config.downloadVersion = '4.7.0';
config.downloadVersion = '4.8.0';

config.envType = envType;

@@ -113,15 +113,22 @@ export default echarts.extendChartView({
var roundCap = seriesModel.get('roundCap', true);
var drawBackground = seriesModel.get('showBackground', true);
var backgroundModel = seriesModel.getModel('backgroundStyle');
var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
var bgEls = [];
var oldBgEls = this._backgroundEls || [];
data.diff(oldData).add(function (dataIndex) {
var itemModel = data.getItemModel(dataIndex);
var layout = getLayout[coord.type](data, dataIndex, itemModel);

if (drawBackground) {
var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
bgEl.useStyle(backgroundModel.getBarItemStyle());
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;
} // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".

@@ -151,9 +158,15 @@ export default echarts.extendChartView({

if (drawBackground) {
var bgEl = oldBgEls[oldIndex];
bgEl.useStyle(backgroundModel.getBarItemStyle());
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);
graphic.updateProps(bgEl, {
shape: shape
}, animationModel, newIndex);
@@ -374,9 +387,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); // fix layout with lineWidth
var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0; // fix layout with lineWidth

var signX = layout.width > 0 ? 1 : -1;
var signY = layout.height > 0 ? 1 : -1;
@@ -140,8 +140,8 @@ export default echarts.extendChartView({
var point = coordSys.dataToPoint([data.get(dataDims[0], idx), data.get(dataDims[1], idx)]);
rect = new graphic.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)
},
@@ -176,7 +176,8 @@ effectSymbolProto.updateData = function (data, idx) {
pos[1] = parsePercent(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 = {};
effectCfg.showEffectOn = seriesModel.get('showEffectOn');
effectCfg.rippleScale = itemModel.get('rippleEffect.scale');
@@ -112,9 +112,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;
}
}
@@ -236,7 +236,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;
@@ -249,7 +248,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);
hoverLabelModel = itemModel.getModel(emphasisLabelAccessPath);
@@ -260,6 +258,7 @@ 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) {
@@ -31,7 +31,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
x -= lineWidth / 2;
y -= lineWidth / 2;
width += lineWidth;
height += lineWidth;
height += lineWidth; // fix: https://github.com/apache/incubator-echarts/issues/11369

x = Math.floor(x);
width = Math.round(width);
var clipPath = new graphic.Rect({
shape: {
x: x,
@@ -19,6 +19,7 @@
// FIXME step not support polar
import { __DEV__ } from '../../config';
import * as zrUtil from 'zrender/src/core/util';
import { fromPoints } from 'zrender/src/core/bbox';
import SymbolDraw from '../helper/SymbolDraw';
import SymbolClz from '../helper/Symbol';
import lineAnimationDiff from './lineAnimationDiff';
@@ -46,6 +47,17 @@ 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;
}
@@ -589,6 +601,24 @@ export default ChartView.extend({
stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step);
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.
@@ -60,7 +60,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);
zrUtil.each(geoSource.regions, function (region) {
var name = region.name;

@@ -221,7 +221,8 @@ var MapSeries = SeriesModel.extend({
itemStyle: {
areaColor: 'rgba(255,215,0,0.8)'
}
}
},
nameProperty: 'name'
}
});
zrUtil.mixin(MapSeries, dataSelectableMixin);
@@ -142,27 +142,34 @@ piePieceProto.updateData = function (data, idx, firstCreate) {

this._updateLabel(data, idx, withAnimation);

this.highDownOnUpdate = itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled() ? function (fromState, toState) {
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;
graphic.setHoverStyle(this);
@@ -431,6 +431,11 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
if (node.outEdges.length) {
var y = sum(node.outEdges, weightedTarget, 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(node, orient)) * alpha;
node.setLayout({
@@ -451,10 +456,18 @@ function weightedTarget(edge, orient) {
return center(edge.node2, orient) * edge.getValue();
}

function centerTarget(edge, orient) {
return center(edge.node2, orient);
}

function weightedSource(edge, orient) {
return center(edge.node1, orient) * edge.getValue();
}

function centerSource(edge, orient) {
return center(edge.node1, orient);
}

function center(node, orient) {
return orient === 'vertical' ? node.getLayout().x + node.getLayout().dx / 2 : node.getLayout().y + node.getLayout().dy / 2;
}
@@ -493,6 +506,11 @@ function relaxLeftToRight(nodesByBreadth, alpha, orient) {
if (node.inEdges.length) {
var y = sum(node.inEdges, weightedSource, 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(node, orient)) * alpha;
node.setLayout({
@@ -127,6 +127,7 @@ SunburstPieceProto.updateData = function (firstCreate, node, state, seriesModel,

this._seriesModel = seriesModel || this._seriesModel;
this._ecModel = ecModel || this._ecModel;
graphic.setHoverStyle(this);
};

SunburstPieceProto.onEmphasis = function (highlightPolicy) {
@@ -87,8 +87,7 @@ export default SeriesModel.extend({
align: 'center',
position: 'inside',
distance: 5,
silent: true,
emphasis: {}
silent: true
},
itemStyle: {
borderWidth: 1,
@@ -98,13 +97,19 @@ export default 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
}
},
// Animation type canbe expansion, scale
@@ -20,6 +20,7 @@ import * as zrUtil from 'zrender/src/core/util';
import ChartView from '../../view/Chart';
import SunburstPiece from './SunburstPiece';
import DataDiffer from '../../data/DataDiffer';
import { windowOpen } from '../../util/format';
var ROOT_TO_NODE_ACTION = 'sunburstRootToNode';
var SunburstView = ChartView.extend({
type: 'sunburst',
@@ -169,7 +170,7 @@ var SunburstView = ChartView.extend({

if (link) {
var linkTarget = itemModel.get('target', true) || '_blank';
window.open(link, linkTarget);
windowOpen(link, linkTarget);
}
}

@@ -19,6 +19,7 @@
import SeriesModel from '../../model/Series';
import Tree from '../../data/Tree';
import { encodeHTML } from '../../util/format';
import Model from '../../model/Model';
export default SeriesModel.extend({
type: 'series.tree',
layoutInfo: null,
@@ -38,14 +39,12 @@ export default SeriesModel.extend({
children: option.data
};
var leaves = option.leaves || {};
var treeOption = {};
treeOption.leaves = leaves;
var tree = Tree.createTree(root, this, treeOption, beforeLink);
var leavesModel = new Model(leaves, this, this.ecModel);
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;

0 comments on commit 3ea6ea2

Please sign in to comment.