plainheart commented on code in PR #17322:
URL: https://github.com/apache/echarts/pull/17322#discussion_r914426970


##########
src/scale/Log.ts:
##########
@@ -86,8 +86,9 @@ class LogScale extends Scale {
 
     setExtent(start: number, end: number): void {
         const base = this.base;
-        start = mathLog(start) / mathLog(base);
-        end = mathLog(end) / mathLog(base);
+        // log(-Infinity) is NaN, so safe guard here
+        start = mathLog(Math.max(0, start)) / mathLog(base);
+        end = mathLog(Math.max(0, end)) / mathLog(base);

Review Comment:
   I just means we can simply tweak the first line to be
   ```js
   const base = mathLog(this.base)
   ```
   It is calculated twice. I think it is unnecessary.



-- 
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