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/11/08 16:23:37 UTC

[incubator-echarts] 01/01: fix: markLine (horizontal or vertical) can not be displayed by the optimize.

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

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

commit fee4578e3a2bf95f2209594cfce4b988ed8e3534
Author: 100pah <su...@gmail.com>
AuthorDate: Mon Nov 9 00:22:41 2020 +0800

    fix: markLine (horizontal or vertical) can not be displayed by the optimize.
---
 src/coord/cartesian/Cartesian2D.ts | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/coord/cartesian/Cartesian2D.ts b/src/coord/cartesian/Cartesian2D.ts
index 6ce9603..9dc27d8 100644
--- a/src/coord/cartesian/Cartesian2D.ts
+++ b/src/coord/cartesian/Cartesian2D.ts
@@ -107,14 +107,22 @@ class Cartesian2D extends Cartesian<Axis2D> implements CoordinateSystem {
 
     dataToPoint(data: ScaleDataValue[], reserved?: unknown, out?: number[]): number[] {
         out = out || [];
-        if (this._transform && !isNaN(data[0] as number) && !isNaN(data[1] as number)) {
-            // Fast path
+        const xVal = data[0];
+        const yVal = data[1];
+        // Fast path
+        if (this._transform
+            // It's supported that if data is like `[Inifity, 123]`, where only Y pixel calculated.
+            && xVal != null
+            && isFinite(xVal as number)
+            && yVal != null
+            && isFinite(yVal as number)
+        ) {
             return applyTransform(out, data as number[], this._transform);
         }
         const xAxis = this.getAxis('x');
         const yAxis = this.getAxis('y');
-        out[0] = xAxis.toGlobalCoord(xAxis.dataToCoord(data[0]));
-        out[1] = yAxis.toGlobalCoord(yAxis.dataToCoord(data[1]));
+        out[0] = xAxis.toGlobalCoord(xAxis.dataToCoord(xVal));
+        out[1] = yAxis.toGlobalCoord(yAxis.dataToCoord(yVal));
         return out;
     }
 


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