Format fiat currency tick mark label on Y-axis.

Format currency tick values as integers for a more
compact form, without the 4-zeroesfractional part.
This commit is contained in:
Deus Max 2020-11-05 00:24:49 +02:00
parent 9034c780c9
commit 1ab7e26fd1
No known key found for this signature in database
GPG key ID: 99EFAE1719A26B0F

View file

@ -89,6 +89,8 @@ import javafx.collections.transformation.SortedList;
import javafx.util.Callback; import javafx.util.Callback;
import javafx.util.StringConverter; import javafx.util.StringConverter;
import java.text.DecimalFormat;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -349,11 +351,13 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
public String toString(Number object) { public String toString(Number object) {
String currencyCode = model.getCurrencyCode(); String currencyCode = model.getCurrencyCode();
double doubleValue = (double) object; double doubleValue = (double) object;
if (CurrencyUtil.isCryptoCurrency(currencyCode)) { if (CurrencyUtil.isCryptoCurrency(currencyCode)) {
final double value = MathUtils.scaleDownByPowerOf10(doubleValue, 8); final double value = MathUtils.scaleDownByPowerOf10(doubleValue, 8);
return FormattingUtils.formatRoundedDoubleWithPrecision(value, 8); return FormattingUtils.formatRoundedDoubleWithPrecision(value, 8);
} else { } else {
return FormattingUtils.formatPrice(Price.valueOf(currencyCode, MathUtils.doubleToLong(doubleValue))); DecimalFormat df = new DecimalFormat(",###");
return df.format(Double.parseDouble(FormattingUtils.formatPrice(Price.valueOf(currencyCode, MathUtils.doubleToLong(doubleValue)))));
} }
} }