From d7e8f527b452cd728600ba334466ad9153ad4182 Mon Sep 17 00:00:00 2001 From: zhangyi Date: Tue, 5 Nov 2019 08:56:07 +0800 Subject: [PATCH 1/3] feat(polar) about ISSUE 11452 --- src/chart/bar/BarView.js | 4 ++-- src/chart/gauge/GaugeSeries.js | 1 - src/coord/polar/polarCreator.js | 2 +- test/polar-rounded.html | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/chart/bar/BarView.js b/src/chart/bar/BarView.js index 80a5185989..c421918ad3 100644 --- a/src/chart/bar/BarView.js +++ b/src/chart/bar/BarView.js @@ -424,8 +424,8 @@ function updateStyle( el.useStyle(zrUtil.defaults( { - fill: color, - opacity: opacity + fill: layout.startAngle === layout.endAngle ? 'transparent' : color, + opacity: layout.startAngle === layout.endAngle ? 0 : opacity }, itemStyleModel.getBarItemStyle() )); diff --git a/src/chart/gauge/GaugeSeries.js b/src/chart/gauge/GaugeSeries.js index 3097bc8606..1b8f10429a 100644 --- a/src/chart/gauge/GaugeSeries.js +++ b/src/chart/gauge/GaugeSeries.js @@ -19,7 +19,6 @@ import createListSimply from '../helper/createListSimply'; import SeriesModel from '../../model/Series'; -import * as zrUtil from 'zrender/src/core/util'; var GaugeSeries = SeriesModel.extend({ diff --git a/src/coord/polar/polarCreator.js b/src/coord/polar/polarCreator.js index 670776b6be..156f97fbae 100644 --- a/src/coord/polar/polarCreator.js +++ b/src/coord/polar/polarCreator.js @@ -50,7 +50,7 @@ function resizePolar(polar, polarModel, api) { var radius = polarModel.get('radius'); if (radius == null) { - radius = [0, "100%"]; + radius = [0, '100%']; } else if (!zrUtil.isArray(radius)) { // r0 = 0 diff --git a/test/polar-rounded.html b/test/polar-rounded.html index d01b492261..cce697b732 100644 --- a/test/polar-rounded.html +++ b/test/polar-rounded.html @@ -186,7 +186,7 @@ }, series: [{ type: 'bar', - data: [1], + data: [0], coordinateSystem: 'polar', name: 'A', roundCap: true, From 89961d189a16b069b3a5ab8e6b3feb57c3000c9b Mon Sep 17 00:00:00 2001 From: zhangyi Date: Wed, 6 Nov 2019 10:56:30 +0800 Subject: [PATCH 2/3] optimize attrs --- src/chart/bar/BarView.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/chart/bar/BarView.js b/src/chart/bar/BarView.js index c421918ad3..3152b4c428 100644 --- a/src/chart/bar/BarView.js +++ b/src/chart/bar/BarView.js @@ -415,6 +415,7 @@ function updateStyle( ) { var color = data.getItemVisual(dataIndex, 'color'); var opacity = data.getItemVisual(dataIndex, 'opacity'); + var stroke = data.getVisual('borderColor'); var itemStyleModel = itemModel.getModel('itemStyle'); var hoverStyle = itemModel.getModel('emphasis.itemStyle').getBarItemStyle(); @@ -424,8 +425,9 @@ function updateStyle( el.useStyle(zrUtil.defaults( { - fill: layout.startAngle === layout.endAngle ? 'transparent' : color, - opacity: layout.startAngle === layout.endAngle ? 0 : opacity + stroke : layout.startAngle === layout.endAngle ? 'none' : stroke, + fill: layout.startAngle === layout.endAngle ? 'none' : color, + opacity: opacity }, itemStyleModel.getBarItemStyle() )); From 0fc6c8dc0fafd4741eac5cdde9180c2be50c08bc Mon Sep 17 00:00:00 2001 From: zhangyi Date: Thu, 21 Nov 2019 09:25:25 +0800 Subject: [PATCH 3/3] switch special value --- src/chart/bar/BarView.js | 6 ++- test/polar-rounded.html | 90 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/src/chart/bar/BarView.js b/src/chart/bar/BarView.js index 3152b4c428..0996c33c7a 100644 --- a/src/chart/bar/BarView.js +++ b/src/chart/bar/BarView.js @@ -425,7 +425,7 @@ function updateStyle( el.useStyle(zrUtil.defaults( { - stroke : layout.startAngle === layout.endAngle ? 'none' : stroke, + stroke: layout.startAngle === layout.endAngle ? 'none' : stroke, fill: layout.startAngle === layout.endAngle ? 'none' : color, opacity: opacity }, @@ -445,7 +445,9 @@ function updateStyle( seriesModel, dataIndex, labelPositionOutside ); } - + if (layout.startAngle === layout.endAngle) { + hoverStyle.fill = hoverStyle.stroke = 'none'; + } graphic.setHoverStyle(el, hoverStyle); } diff --git a/test/polar-rounded.html b/test/polar-rounded.html index cce697b732..3e4f8a8f7c 100644 --- a/test/polar-rounded.html +++ b/test/polar-rounded.html @@ -44,6 +44,7 @@
+
@@ -194,6 +195,11 @@ itemStyle: { borderColor: 'red', borderWidth: 1 + },emphasis:{ + itemStyle:{ + color:'red', + borderColor:'blue' + } } }], legend: { @@ -282,5 +288,89 @@ }); + + +