You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2022/09/06 09:43:54 UTC

[echarts] branch fix-13128 created (now e8bfbd358)

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

ovilia pushed a change to branch fix-13128
in repository https://gitbox.apache.org/repos/asf/echarts.git


      at e8bfbd358 fix(bar): fix bar axis range when maximum data is small #13128

This branch includes the following new commits:

     new e8bfbd358 fix(bar): fix bar axis range when maximum data is small #13128

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[echarts] 01/01: fix(bar): fix bar axis range when maximum data is small #13128

Posted by ov...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e8bfbd35817b71b2db28bd05d34e96debec5beb3
Author: Ovilia <zw...@gmail.com>
AuthorDate: Tue Sep 6 17:42:43 2022 +0800

    fix(bar): fix bar axis range when maximum data is small #13128
---
 src/util/number.ts | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/number.ts b/src/util/number.ts
index bf5b2562f..47c574ba6 100644
--- a/src/util/number.ts
+++ b/src/util/number.ts
@@ -138,10 +138,12 @@ export function round(x: number | string, precision: number, returnStr: false):
 export function round(x: number | string, precision: number, returnStr: true): string;
 export function round(x: number | string, precision?: number, returnStr?: boolean): string | number {
     if (precision == null) {
-        precision = 10;
+        precision = ROUND_SUPPORTED_PRECISION_MAX;
+    }
+    else {
+        // Avoid range error
+        precision = Math.min(Math.max(0, precision), ROUND_SUPPORTED_PRECISION_MAX);
     }
-    // Avoid range error
-    precision = Math.min(Math.max(0, precision), ROUND_SUPPORTED_PRECISION_MAX);
     // PENDING: 1.005.toFixed(2) is '1.00' rather than '1.01'
     x = (+x).toFixed(precision);
     return (returnStr ? x : +x);


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