You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2020/05/12 18:10:23 UTC

[incubator-echarts] branch next updated: fix: fix interval split area in polor: should go back to the start angle.

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

sushuang pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git


The following commit(s) were added to refs/heads/next by this push:
     new 9db5c3e  fix: fix interval split area in polor: should go back to the start angle.
9db5c3e is described below

commit 9db5c3e1a51255efa3786d43ee83a5746435b526
Author: 100pah <su...@gmail.com>
AuthorDate: Wed May 13 02:09:39 2020 +0800

    fix: fix interval split area in polor: should go back to the start angle.
---
 src/component/axis/AngleAxisView.ts |   7 +-
 test/axis-splitArea.html            | 170 ++++++++++++++++++++++++++++++++++++
 2 files changed, 174 insertions(+), 3 deletions(-)

diff --git a/src/component/axis/AngleAxisView.ts b/src/component/axis/AngleAxisView.ts
index 3a95368..0518754 100644
--- a/src/component/axis/AngleAxisView.ts
+++ b/src/component/axis/AngleAxisView.ts
@@ -359,7 +359,8 @@ const angelAxisElementsBuilders: Record<typeof elementList[number], AngleAxisEle
 
         const clockwise = angleAxisModel.get('clockwise');
 
-        for (let i = 1; i < ticksAngles.length; i++) {
+        for (let i = 1, len = ticksAngles.length; i <= len; i++) {
+            const coord = i === len ? ticksAngles[0].coord : ticksAngles[i].coord;
             const colorIndex = (lineCount++) % areaColors.length;
             splitAreas[colorIndex] = splitAreas[colorIndex] || [];
             splitAreas[colorIndex].push(new graphic.Sector({
@@ -369,12 +370,12 @@ const angelAxisElementsBuilders: Record<typeof elementList[number], AngleAxisEle
                     r0: r0,
                     r: r1,
                     startAngle: prevAngle,
-                    endAngle: -ticksAngles[i].coord * RADIAN,
+                    endAngle: -coord * RADIAN,
                     clockwise: clockwise
                 },
                 silent: true
             }));
-            prevAngle = -ticksAngles[i].coord * RADIAN;
+            prevAngle = -coord * RADIAN;
         }
 
         // Simple optimization
diff --git a/test/axis-splitArea.html b/test/axis-splitArea.html
index 2ac8686..dc06c86 100644
--- a/test/axis-splitArea.html
+++ b/test/axis-splitArea.html
@@ -40,6 +40,10 @@ under the License.
         <div id="main0"></div>
         <div id="main1"></div>
         <div id="main2"></div>
+        <div id="polarCategory12"></div>
+        <div id="polarValue12"></div>
+        <div id="cartesianCatetory12"></div>
+        <div id="cartesianValue12"></div>
 
 
 
@@ -177,6 +181,172 @@ under the License.
         });
         </script>
 
+
+
+
+
+
+        <script>
+            require([
+                'echarts'/*, 'map/js/china' */
+            ], function (echarts) {
+                var option = {
+                    angleAxis: {
+                        type: 'category',
+                        data: [0,1,2,3,4,5,6,7,8,9,10,11],
+                        boundaryGap: false,
+                        splitArea: { show: true },
+                        splitLine: { show: true },
+                        axisLabel: { interval: 0 }
+                    },
+                    radiusAxis: {
+                        type: 'value',
+                        axisLine: { show: false },
+                        splitLine: { show: false },
+                    },
+                    polar: {
+                    },
+                    tooltip: {},
+                    series: [{
+                        type: 'scatter',
+                        coordinateSystem: 'polar',
+                        data: []
+                    }]
+                };
+
+                var chart = testHelper.create(echarts, 'polarCategory12', {
+                    title: [
+                        'interval area in "category" angleAxis',
+                    ],
+                    height: 300,
+                    option: option
+                });
+            });
+        </script>
+
+
+
+
+
+
+        <script>
+            require([
+                'echarts'/*, 'map/js/china' */
+            ], function (echarts) {
+                var option = {
+                    angleAxis: {
+                        type: 'value',
+                        // splitLine: { show: false },
+                        splitArea: { show: true },
+                        min: 0,
+                        max: 12
+                    },
+                    radiusAxis: {
+                        type: 'value',
+                        axisLine: { show: false },
+                        splitLine: { show: false },
+                    },
+                    polar: {
+                    },
+                    tooltip: {},
+                    series: [{
+                        type: 'scatter',
+                        coordinateSystem: 'polar',
+                        data: []
+                    }]
+                };
+
+                var chart = testHelper.create(echarts, 'polarValue12', {
+                    title: [
+                        'interval area in "value" angleAxis',
+                    ],
+                    height: 300,
+                    option: option
+                });
+            });
+        </script>
+
+
+
+
+
+
+
+        <script>
+            require([
+                'echarts'/*, 'map/js/china' */
+            ], function (echarts) {
+                var option = {
+                    xAxis: {
+                        type: 'category',
+                        data: [0,1,2,3,4,5,6,7,8,9,10,11,12],
+                        boundaryGap: false,
+                        splitArea: { show: true },
+                        splitLine: { show: true },
+                        axisLabel: { interval: 0 },
+                        min: 0,
+                        max: 12
+                    },
+                    yAxis: {
+                        type: 'value',
+                        splitLine: { show: false }
+                    },
+                    tooltip: {},
+                    series: [{
+                        type: 'scatter',
+                        data: []
+                    }]
+                };
+
+                var chart = testHelper.create(echarts, 'cartesianCatetory12', {
+                    title: [
+                        'interval axisArea in on "category" xAxis',
+                    ],
+                    height: 200,
+                    option: option
+                });
+            });
+        </script>
+
+
+
+
+        <script>
+            require([
+                'echarts'/*, 'map/js/china' */
+            ], function (echarts) {
+                var option = {
+                    xAxis: {
+                        type: 'value',
+                        splitArea: { show: true },
+                        interval: 1,
+                        min: 0,
+                        max: 12
+                    },
+                    yAxis: {
+                        type: 'value',
+                        splitLine: { show: false }
+                    },
+                    tooltip: {},
+                    series: [{
+                        type: 'scatter',
+                        data: []
+                    }]
+                };
+
+                var chart = testHelper.create(echarts, 'cartesianValue12', {
+                    title: [
+                        'interval axisArea in on "value" xAxis',
+                    ],
+                    height: 200,
+                    option: option
+                });
+            });
+        </script>
+
+
+
+
     </body>
 </html>
 


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