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/08/09 04:10:38 UTC

[GitHub] [echarts] Ovilia commented on a diff in pull request #17061: fix: log axis extent display incorrectly

Ovilia commented on code in PR #17061:
URL: https://github.com/apache/echarts/pull/17061#discussion_r940875871


##########
src/scale/Log.ts:
##########
@@ -97,15 +109,17 @@ class LogScale extends Scale {
     getExtent() {
         const base = this.base;
         const extent = scaleProto.getExtent.call(this);
-        extent[0] = mathPow(base, extent[0]);
-        extent[1] = mathPow(base, extent[1]);
 
         // Fix #4158
         const originalScale = this._originalScale;
         const originalExtent = originalScale.getExtent();
-        this._fixMin && (extent[0] = fixRoundingError(extent[0], originalExtent[0]));
-        this._fixMax && (extent[1] = fixRoundingError(extent[1], originalExtent[1]));
-
+        // To get extent without precision problem, get the original extent directly
+        extent[0] = (extent[0] === mathLog(originalExtent[0]) / mathLog(base))

Review Comment:
   Comparing floating number with `extent[0] === mathLog(originalExtent[0]` may cause precision problems. And can you explain why do you remove `this._fixMin` here?



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