changeset 7735:798a93a61616

RT-38285 [Axis] Y-Axis can not handle big values (cont.): follow-up fix
author Martin Sladecek <martin.sladecek@oracle.com>
date Wed, 20 Aug 2014 15:53:46 +0200
parents adba413b52d3
children 3d879a4dab44
files modules/controls/src/main/java/javafx/scene/chart/NumberAxis.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/javafx/scene/chart/NumberAxis.java	Wed Aug 20 15:21:06 2014 +0200
+++ b/modules/controls/src/main/java/javafx/scene/chart/NumberAxis.java	Wed Aug 20 15:53:46 2014 +0200
@@ -390,9 +390,11 @@
             } else if (exp == 1) {
                 formatter = "0";
             } else {
-                final StringBuilder formatterB = new StringBuilder("0.");
                 final boolean ratioHasFrac = Math.rint(ratio) != ratio;
-                for (int i = 0, n = (ratioHasFrac ? Math.abs(exp) + 1 : Math.abs(exp)); i < n; ++i) {
+                final StringBuilder formatterB = new StringBuilder("0");
+                int n = ratioHasFrac ? Math.abs(exp) + 1 : Math.abs(exp);
+                if (n > 0) formatterB.append(".");
+                for (int i = 0; i < n; ++i) {
                     formatterB.append("0");
                 }
                 formatter = formatterB.toString();