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 2021/08/24 05:41:07 UTC

[echarts] 01/01: fix(polar): wrong sector clockwise when previous data is 0 #15517

This is an automated email from the ASF dual-hosted git repository.

ovilia pushed a commit to branch fix-polar
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 090efb2bd120dc0157478cdd8444f3f879152247
Author: Ovilia <zw...@gmail.com>
AuthorDate: Tue Aug 24 13:40:07 2021 +0800

    fix(polar): wrong sector clockwise when previous data is 0 #15517
---
 src/chart/bar/BarView.ts |  2 +-
 test/line-animation.html | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/src/chart/bar/BarView.ts b/src/chart/bar/BarView.ts
index e4be916..e790bbc 100644
--- a/src/chart/bar/BarView.ts
+++ b/src/chart/bar/BarView.ts
@@ -750,7 +750,7 @@ const elementCreator: {
         // direction. Notice that if clockwise is true (by default), the sector
         // will always draw clockwisely, no matter whether endAngle is greater
         // or less than startAngle.
-        const clockwise = layout.startAngle < layout.endAngle;
+        const clockwise = layout.startAngle <= layout.endAngle;
 
         const ShapeClass = (!isRadial && roundCap) ? Sausage : Sector;
 
diff --git a/test/line-animation.html b/test/line-animation.html
index 011fd69..fd9cdec 100644
--- a/test/line-animation.html
+++ b/test/line-animation.html
@@ -49,6 +49,8 @@ under the License.
             }
         </style>
 
+        <div class="chart" id="main3"></div>
+
         <button onclick="change()">CHANGE</button>
         <div class="chart" id="main2"></div>
 
@@ -400,6 +402,66 @@ under the License.
         </script>
 
 
+        <script>
+
+            require([
+                'echarts'
+            ], function (echarts) {
+                var chart = echarts.init(document.getElementById('main3'), null, {
+                    renderer: 'svg'
+                });
+                option = {
+                    title: [
+                        {
+                            text: '0',
+                            x: 'center',
+                            top: '48%',
+                        },
+                    ],
+                    polar: {
+                        radius: ['65%', '80%'],
+                        center: ['50%', '50%'],
+                    },
+                    angleAxis: {
+                        max: 100,
+                        clockwise: true,
+                        axisLine: {
+                            show: true,
+                        },
+                    },
+                    radiusAxis: {
+                        type: 'category',
+                        show: true,
+                    },
+                    series: [
+                        {
+                            name: '',
+                            type: 'bar',
+                            roundCap: true,
+
+                            showBackground: true,
+                            backgroundStyle: {
+                                color: 'rgba(180, 180, 180, 0.2)',
+                            },
+                            data: [0],
+                            coordinateSystem: 'polar',
+                        },
+                    ],
+                    animation: 0
+                };
+
+                chart.setOption(option);
+
+                setTimeout(function() {
+                    option.series[0].data[0] = 30;
+                    option.title[0].text = option.series[0].data[0];
+                    chart.setOption(option, true);
+                }, 0);
+
+            });
+
+        </script>
+
 
     </body>
 </html>
\ No newline at end of file

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org