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 2020/03/06 08:36:54 UTC
[incubator-echarts] 01/01: fix(pie): label not show when animation
is disabled. fix #12110
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch fix-12110
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 658d01a903922f18f403bcc951f7150690877759
Author: Ovilia <zw...@gmail.com>
AuthorDate: Fri Mar 6 16:34:11 2020 +0800
fix(pie): label not show when animation is disabled. fix #12110
---
src/chart/pie/PieView.js | 31 +++++++++++++++++-------------
test/pie-animation.html | 49 ++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 65 insertions(+), 15 deletions(-)
diff --git a/src/chart/pie/PieView.js b/src/chart/pie/PieView.js
index dc9f635..78cc722 100644
--- a/src/chart/pie/PieView.js
+++ b/src/chart/pie/PieView.js
@@ -180,31 +180,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) {
+ const hasAnimation = seriesModel.isAnimationEnabled();
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/test/pie-animation.html b/test/pie-animation.html
index 679b50b..fe72d66 100644
--- a/test/pie-animation.html
+++ b/test/pie-animation.html
@@ -31,7 +31,8 @@ under the License.
html,
body,
#main1,
- #main2 {
+ #main2,
+ #main3 {
width: 100%;
height: 250px;
margin: 0;
@@ -57,7 +58,10 @@ under the License.
<button id="btn2">Go</button>
<div id="main2"></div>
- <script>
+ <div class="test-title">Should display labels on emphasis if no animation</div>
+ <div id="main3"></div>
+
+ <!-- <script>
require([
'echarts'
@@ -163,6 +167,47 @@ under the License.
});
});
+ </script> -->
+
+
+
+ <script>
+
+ require([
+ 'echarts'
+ ], function (echarts) {
+ var chart = echarts.init(
+ document.getElementById('main3'),
+ null,
+ {
+ renderer: 'svg'
+ }
+ );
+
+ var option = {
+ "series": [
+ {
+ "type": "pie",
+ "radius": ["40%", "70%"],
+ "animation": false,
+ "label": {
+ "show": false,
+ "emphasis": {
+ "show": true,
+ "textStyle": {
+ "fontSize": "50"
+ }
+ }
+ },
+ "data": [
+ {"value": 335, "name": "A"}
+ ]
+ }
+ ]
+ };
+ chart.setOption(option);
+ });
+
</script>
</body>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org