mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Add nr of trades label to trade stats
This commit is contained in:
parent
8019d1c8f6
commit
f298201964
@ -76,11 +76,11 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
|
||||
private final StringProperty priceColumnLabel = new SimpleStringProperty();
|
||||
private ChangeListener<Toggle> toggleChangeListener;
|
||||
private ToggleGroup toggleGroup;
|
||||
|
||||
private final ListChangeListener<XYChart.Data<Number, Number>> itemsChangeListener;
|
||||
private Subscription tradeCurrencySubscriber;
|
||||
|
||||
private SortedList<TradeStatistics> sortedList;
|
||||
private Label nrOfTradeStatisticsLabel;
|
||||
private ListChangeListener<TradeStatistics> tradeStatisticsByCurrencyListener;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -101,7 +101,10 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
|
||||
HBox toolBox = getToolBox();
|
||||
createCharts();
|
||||
createTable();
|
||||
root.getChildren().addAll(toolBox, priceChart, volumeChart, tableView);
|
||||
nrOfTradeStatisticsLabel = new Label("");
|
||||
nrOfTradeStatisticsLabel.setId("num-offers");
|
||||
nrOfTradeStatisticsLabel.setPadding(new Insets(-5, 0, -10, 5));
|
||||
root.getChildren().addAll(toolBox, priceChart, volumeChart, tableView, nrOfTradeStatisticsLabel);
|
||||
|
||||
toggleChangeListener = (observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
@ -118,6 +121,7 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
|
||||
volumeAxisYWidth = (double) newValue;
|
||||
layoutChart();
|
||||
};
|
||||
tradeStatisticsByCurrencyListener = c -> nrOfTradeStatisticsLabel.setText("Nr. of trades: " + model.tradeStatisticsByCurrency.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -153,6 +157,9 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
|
||||
updateChartData();
|
||||
priceAxisX.setTickLabelFormatter(getTimeAxisStringConverter());
|
||||
volumeAxisX.setTickLabelFormatter(getTimeAxisStringConverter());
|
||||
|
||||
model.tradeStatisticsByCurrency.addListener(tradeStatisticsByCurrencyListener);
|
||||
nrOfTradeStatisticsLabel.setText("Nr. of trades: " + model.tradeStatisticsByCurrency.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -161,12 +168,12 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
|
||||
toggleGroup.selectedToggleProperty().removeListener(toggleChangeListener);
|
||||
priceAxisY.widthProperty().removeListener(priceAxisYWidthListener);
|
||||
volumeAxisY.widthProperty().removeListener(volumeAxisYWidthListener);
|
||||
model.tradeStatisticsByCurrency.removeListener(tradeStatisticsByCurrencyListener);
|
||||
tradeCurrencySubscriber.unsubscribe();
|
||||
currencyComboBox.setOnAction(null);
|
||||
priceAxisY.labelProperty().unbind();
|
||||
priceSeries.getData().clear();
|
||||
priceChart.getData().clear();
|
||||
|
||||
sortedList.comparatorProperty().unbind();
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||
paymentMethodColumn.setComparator((o1, o2) -> o1.getOffer().getPaymentMethod().compareTo(o2.getOffer().getPaymentMethod()));
|
||||
avatarColumn.setComparator((o1, o2) -> o1.getOffer().getOwnerNodeAddress().hostName.compareTo(o2.getOffer().getOwnerNodeAddress().hostName));
|
||||
|
||||
nrOfOffersLabel = new Label("Nr. of offers: -");
|
||||
nrOfOffersLabel = new Label("");
|
||||
nrOfOffersLabel.setId("num-offers");
|
||||
GridPane.setHalignment(nrOfOffersLabel, HPos.LEFT);
|
||||
GridPane.setVgrow(nrOfOffersLabel, Priority.NEVER);
|
||||
@ -209,6 +209,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||
GridPane.setHalignment(createOfferButton, HPos.RIGHT);
|
||||
GridPane.setVgrow(createOfferButton, Priority.NEVER);
|
||||
GridPane.setValignment(createOfferButton, VPos.TOP);
|
||||
offerListListener = c -> nrOfOffersLabel.setText("Nr. of offers: " + model.getOfferList().size());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -254,7 +255,6 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||
tableView.setItems(model.getOfferList());
|
||||
priceColumn.setSortType((model.getDirection() == Offer.Direction.BUY) ? TableColumn.SortType.ASCENDING : TableColumn.SortType.DESCENDING);
|
||||
|
||||
offerListListener = c -> nrOfOffersLabel.setText("Nr. of offers: " + model.getOfferList().size());
|
||||
model.getOfferList().addListener(offerListListener);
|
||||
nrOfOffersLabel.setText("Nr. of offers: " + model.getOfferList().size());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user