Skip to content
Snippets Groups Projects
Commit 1aabc057 authored by Tim Molter's avatar Tim Molter Committed by Niklas Polke
Browse files

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

parent 98dfa429
No related branches found
No related tags found
No related merge requests found
......@@ -75,7 +75,7 @@ public class AxisTickNumericalCalculator extends AxisTickCalculator {
double absoluteMaxValue = minValue <= maxValue ? maxValue : minValue;
for (BigDecimal value = cleanedFirstPosition; value.compareTo(BigDecimal.valueOf(absoluteMaxValue + 2 * cleanedGridStep.doubleValue())) < 0; value = value.add(cleanedGridStep)) {
// System.out.println(tickPosition);
// System.out.println(value);
String tickLabel = numberFormatter.formatNumber(value, minValue, maxValue, axisDirection);
// System.out.println(tickLabel);
tickLabels.add(tickLabel);
......
......@@ -43,6 +43,11 @@ public class NumberFormatter {
// System.out.println("min: " + min);
// System.out.println("max: " + max);
// some special cases first
if (value.compareTo(BigDecimal.ZERO) == 0) {
return "0";
}
double difference = max - min;
int placeOfDifference;
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