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 2018/10/15 14:10:59 UTC

[incubator-echarts] branch master updated: tweak #8962

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 96b8472  tweak #8962
96b8472 is described below

commit 96b84726dc495f515aed3d1b165002ff9b00d319
Author: sushuang <su...@gmail.com>
AuthorDate: Mon Oct 15 21:05:28 2018 +0800

    tweak #8962
---
 src/chart/radar/radarLayout.js | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/chart/radar/radarLayout.js b/src/chart/radar/radarLayout.js
index c267f04..4185d4e 100644
--- a/src/chart/radar/radarLayout.js
+++ b/src/chart/radar/radarLayout.js
@@ -28,29 +28,27 @@ export default function (ecModel) {
             return;
         }
 
-        function pointsConverter(val, idx) {
-            points[idx] = points[idx] || [];
-            points[idx][i] = coordSys.dataToPoint(val, i);
-        }
         var axes = coordSys.getIndicatorAxes();
-        for (var i = 0; i < axes.length; i++) {
-            data.each(data.mapDimension(axes[i].dim), pointsConverter);
-        }
 
+        zrUtil.each(axes, function (axis, axisIndex) {
+            data.each(data.mapDimension(axes[axisIndex].dim), function (val, dataIndex) {
+                points[dataIndex] = points[dataIndex] || [];
+                points[dataIndex][axisIndex] = coordSys.dataToPoint(val, axisIndex);
+            });
+        });
+
+        // Close polygon
         data.each(function (idx) {
-            // Close polygon
+            // TODO
+            // Is it appropriate to connect to the next data when some data is missing?
+            // Or, should trade it like `connectNull` in line chart?
+            var firstPoint = zrUtil.find(points[idx], function (point) {
+                return !isNaN(point[0]) && !isNaN(point[1]);
+            }) || [NaN, NaN];
 
-            var firstPoint = findFirstActualPoint();
-  
             // Copy the first actual point to the end of the array
             points[idx].push(firstPoint.slice());
             data.setItemLayout(idx, points[idx]);
-
-            function findFirstActualPoint() {
-                return zrUtil.find(points[idx], function (point) {
-                    return !isNaN(point[0]) && !isNaN(point[1]);
-                }) || ['NaN', 'NaN'];
-            }
         });
     });
 }
\ 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