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

add formatting check to always print the value zero as "0"

parent 4ed0bd8e
No related branches found
No related tags found
No related merge requests found
...@@ -74,7 +74,7 @@ public class AxisTickNumericalCalculator extends AxisTickCalculator { ...@@ -74,7 +74,7 @@ public class AxisTickNumericalCalculator extends AxisTickCalculator {
// generate all tickLabels and tickLocations from the first to last position // generate all tickLabels and tickLocations from the first to last position
for (BigDecimal value = cleanedFirstPosition; value.compareTo(BigDecimal.valueOf(maxValue + 2 * cleanedGridStep.doubleValue())) < 0; value = value.add(cleanedGridStep)) { for (BigDecimal value = cleanedFirstPosition; value.compareTo(BigDecimal.valueOf(maxValue + 2 * cleanedGridStep.doubleValue())) < 0; value = value.add(cleanedGridStep)) {
// System.out.println(tickPosition); // System.out.println(value);
String tickLabel = numberFormatter.formatNumber(value, minValue, maxValue, axisDirection); String tickLabel = numberFormatter.formatNumber(value, minValue, maxValue, axisDirection);
// System.out.println(tickLabel); // System.out.println(tickLabel);
tickLabels.add(tickLabel); tickLabels.add(tickLabel);
......
...@@ -43,6 +43,11 @@ public class NumberFormatter { ...@@ -43,6 +43,11 @@ public class NumberFormatter {
// System.out.println("min: " + min); // System.out.println("min: " + min);
// System.out.println("max: " + max); // System.out.println("max: " + max);
// some special cases first
if (value.compareTo(BigDecimal.ZERO) == 0) {
return "0";
}
double difference = max - min; double difference = max - min;
int placeOfDifference; int placeOfDifference;
if (difference == 0.0) { if (difference == 0.0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment