akashsonune commented on code in PR #21524:
URL: https://github.com/apache/echarts/pull/21524#discussion_r2877735183


##########
src/scale/helper.ts:
##########
@@ -128,48 +126,16 @@ export function contain(val: number, extent: [number, 
number]): boolean {
     return val >= extent[0] && val <= extent[1];
 }
 
-export class ScaleCalculator {
-
-    normalize: (val: number, extent: [number, number]) => number = normalize;
-    scale: (val: number, extent: [number, number]) => number = scale;
-
-    updateMethods(brkCtx: ScaleBreakContext) {
-        if (brkCtx.hasBreaks()) {
-            this.normalize = bind(brkCtx.normalize, brkCtx);
-            this.scale = bind(brkCtx.scale, brkCtx);
-        }
-        else {
-            this.normalize = normalize;
-            this.scale = scale;
-        }
-    }
-}
-
-function normalize(
-    val: number,
-    extent: [number, number],
-    // Dont use optional arguments for performance consideration here.
-): number {
+export function normalize(val: number, extent: [number, number]): number {
     if (extent[1] === extent[0]) {
-        return 0.5;
+        // When extent collapses to a single point, only values equal to that 
point
+        // should be normalized to 0.5. All other values should return NaN to 
indicate
+        // they are out of range and should not be rendered.
+        return isNaN(val) || val !== extent[0] ? NaN : 0.5;

Review Comment:
   @Ovilia I added tests for markpoint. also I feel the condition `val !== 
extent[0]` is needed becuase When the range collapses to a single point, only 
the value that matches that point should be drawn. Everything else should be 
ignored (NaN).
   
   Without this check, ALL bars try to draw at the same position, causing the 
visual bug where zoomed single bar looks like it has value of the highest bar 
in the series



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to