Skip to content
Snippets Groups Projects
Commit b93b6008 authored by Tim Molter's avatar Tim Molter
Browse files

another number format tweak

parent f047c643
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@ public class AxisValueFormatterUtil {
BigDecimal absoluteValue = value.abs();
if (absoluteValue.compareTo(new BigDecimal("10000")) == -1 && absoluteValue.compareTo(new BigDecimal(".0001")) == 1 || BigDecimal.ZERO.compareTo(value) == 0) {
if (absoluteValue.compareTo(new BigDecimal("10000.000001")) == -1 && absoluteValue.compareTo(new BigDecimal(".0009999999")) == 1 || BigDecimal.ZERO.compareTo(value) == 0) {
DecimalFormat normalFormat = (DecimalFormat) numberFormat;
normalFormat.applyPattern(normalDecimalPatternOverride == null ? NORMAL_DECIMAL_PATTERN : normalDecimalPatternOverride);
......
......@@ -74,10 +74,18 @@ public class ValueFormatTest {
stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
assertThat(stringValue, equalTo("0.001"));
value = new BigDecimal("0.0012");
stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
assertThat(stringValue, equalTo("0.0012"));
value = new BigDecimal("0.0001");
stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
assertThat(stringValue, equalTo("1E-4"));
value = new BigDecimal(".00012");
stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
assertThat(stringValue, equalTo("1.2E-4"));
value = new BigDecimal("0.0");
stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
assertThat(stringValue, equalTo("0"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment