You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/02/10 03:25:30 UTC

[GitHub] [echarts] pissang commented on a change in pull request #16435: fix(line): 过滤空节点, 避免阶梯线条变为斜线

pissang commented on a change in pull request #16435:
URL: https://github.com/apache/echarts/pull/16435#discussion_r803271225



##########
File path: src/chart/line/LineView.ts
##########
@@ -160,7 +160,14 @@ function turnPointsIntoStep(
     const stepPt: number[] = [];
     const pt: number[] = [];
     const nextPt: number[] = [];
-    for (; i < points.length - 2; i += 2) {
+    const points_ = [];
+    for (i = 0; i < points.length; i += 2) {
+        if (!isNaN(points[i]) && !isNaN(points[i + 1])) {
+            points_.push(points[i], points[i + 1]);
+        }
+    }
+    points = points_;
+    for (i = 0; i < points.length - 2; i += 2) {

Review comment:
       Filter `NaN` point can be done in this loop directly.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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