You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2019/02/15 03:21:53 UTC
[incubator-echarts] branch fix/pie-animation updated: fix(pie):
loop to find first non-NaN angle for clipPath
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch fix/pie-animation
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/fix/pie-animation by this push:
new 7bf545f fix(pie): loop to find first non-NaN angle for clipPath
7bf545f is described below
commit 7bf545f28dfd93d8acd0f07facd60fb037ea0b09
Author: Ovilia <zw...@gmail.com>
AuthorDate: Fri Feb 15 11:20:23 2019 +0800
fix(pie): loop to find first non-NaN angle for clipPath
---
src/chart/pie/PieView.js | 4 ++++
src/chart/pie/labelLayout.js | 2 +-
src/chart/pie/pieLayout.js | 14 +++++++++++++-
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/chart/pie/PieView.js b/src/chart/pie/PieView.js
index 2f03f0d..4c217b6 100644
--- a/src/chart/pie/PieView.js
+++ b/src/chart/pie/PieView.js
@@ -353,6 +353,10 @@ var PieView = ChartView.extend({
&& animationType !== 'scale'
) {
var shape = data.getItemLayout(0);
+ for (let s = 1; isNaN(shape.endAngle) && s < data.count(); ++s) {
+ shape = data.getItemLayout(s);
+ }
+
var r = Math.max(api.getWidth(), api.getHeight()) / 2;
var removeClipPath = zrUtil.bind(group.removeClipPath, group);
diff --git a/src/chart/pie/labelLayout.js b/src/chart/pie/labelLayout.js
index 95a2210..69298d8 100644
--- a/src/chart/pie/labelLayout.js
+++ b/src/chart/pie/labelLayout.js
@@ -176,7 +176,7 @@ export default function (seriesModel, r, viewWidth, viewHeight, sum) {
var labelLineLen = labelLineModel.get('length');
var labelLineLen2 = labelLineModel.get('length2');
- if (layout.angle < minShowLabelRadian || !data.hasValue(idx)) {
+ if (layout.angle < minShowLabelRadian) {
return;
}
diff --git a/src/chart/pie/pieLayout.js b/src/chart/pie/pieLayout.js
index 8cf4b04..e72c218 100644
--- a/src/chart/pie/pieLayout.js
+++ b/src/chart/pie/pieLayout.js
@@ -80,7 +80,19 @@ export default function (seriesType, ecModel, api, payload) {
data.each(valueDim, function (value, idx) {
var angle;
if (isNaN(value)) {
- value = 0;
+ data.setItemLayout(idx, {
+ angle: NaN,
+ startAngle: NaN,
+ endAngle: NaN,
+ clockwise: clockwise,
+ cx: cx,
+ cy: cy,
+ r0: r0,
+ r: roseType
+ ? NaN
+ : r
+ });
+ return;
}
// FIXME 兼容 2.0 但是 roseType 是 area 的时候才是这样?
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org