mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-21 22:31:44 +01:00
Merge pull request #2763 from sqrrm/market-view-precision
Use same precision for all x-axis labels
This commit is contained in:
commit
3a1f69472c
1 changed files with 8 additions and 5 deletions
|
@ -214,15 +214,18 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue