Skip to content

Commit

Permalink
Merge pull request #2763 from sqrrm/market-view-precision
Browse files Browse the repository at this point in the history
Use same precision for all x-axis labels
  • Loading branch information
ripcurlx authored Apr 24, 2019
2 parents fb59ef6 + 4ed510d commit 3a1f694
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,18 @@ protected void activate() {
String code = tradeCurrency.getCode();
volumeColumnLabel.set(Res.get("shared.amountWithCur", code));
xAxis.setTickLabelFormatter(new StringConverter<>() {
int cryptoPrecision = 3;
@Override
public String toString(Number object) {
final double doubleValue = (double) object;
if (CurrencyUtil.isCryptoCurrency(model.getCurrencyCode())) {
final String withPrecision3 = formatter.formatRoundedDoubleWithPrecision(doubleValue, 3);
if (withPrecision3.equals("0.000"))
return formatter.formatRoundedDoubleWithPrecision(doubleValue, 8);
else
return withPrecision3;
final String withCryptoPrecision = formatter.formatRoundedDoubleWithPrecision(doubleValue, cryptoPrecision);
if (withCryptoPrecision.equals("0.000")) {
cryptoPrecision = 8;
return formatter.formatRoundedDoubleWithPrecision(doubleValue, cryptoPrecision);
} else {
return withCryptoPrecision;
}
} else {
return formatter.formatRoundedDoubleWithPrecision(doubleValue, 2);
}
Expand Down

0 comments on commit 3a1f694

Please sign in to comment.