mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Add total issuance and total burned series
This commit is contained in:
parent
7c82271ac1
commit
9dab4fd65a
9 changed files with 141 additions and 132 deletions
|
@ -2443,6 +2443,8 @@ dao.factsAndFigures.supply.reimbursement=Reimbursement requests
|
|||
dao.factsAndFigures.supply.genesisIssueAmount=BSQ issued at genesis transaction
|
||||
dao.factsAndFigures.supply.compRequestIssueAmount=BSQ issued for compensation requests
|
||||
dao.factsAndFigures.supply.reimbursementAmount=BSQ issued for reimbursement requests
|
||||
dao.factsAndFigures.supply.totalIssued=Total issues BSQ
|
||||
dao.factsAndFigures.supply.totalBurned=Total burned BSQ
|
||||
|
||||
dao.factsAndFigures.supply.chart.tradeFee.toolTip={0}\n{1}
|
||||
|
||||
|
|
|
@ -1744,6 +1744,9 @@ textfield */
|
|||
#charts-dao .default-color4.chart-series-line { -fx-stroke: -bs-chart-dao-line5; }
|
||||
#charts-dao .default-color4.chart-line-symbol { -fx-background-color: -bs-chart-dao-line5, -bs-chart-dao-line5; }
|
||||
|
||||
#charts-dao .default-color5.chart-series-line { -fx-stroke: -bs-chart-dao-line6; }
|
||||
#charts-dao .default-color5.chart-line-symbol { -fx-background-color: -bs-chart-dao-line6, -bs-chart-dao-line6; }
|
||||
|
||||
#charts-legend-toggle0 {
|
||||
-jfx-toggle-color: -bs-chart-dao-line1
|
||||
}
|
||||
|
@ -1759,6 +1762,9 @@ textfield */
|
|||
#charts-legend-toggle4 {
|
||||
-jfx-toggle-color: -bs-chart-dao-line5;
|
||||
}
|
||||
#charts-legend-toggle5 {
|
||||
-jfx-toggle-color: -bs-chart-dao-line6;
|
||||
}
|
||||
|
||||
#charts-dao .chart-series-line {
|
||||
-fx-stroke-width: 2px;
|
||||
|
@ -1785,11 +1791,15 @@ textfield */
|
|||
}
|
||||
|
||||
#chart-navigation-label {
|
||||
-fx-tick-label-fill: -bs-rd-font-lighter;
|
||||
-fx-text-fill: -bs-rd-font-lighter;
|
||||
-fx-font-size: 0.769em;
|
||||
-fx-alignment: center;
|
||||
}
|
||||
|
||||
#chart-navigation-center-pane {
|
||||
-fx-background-color: -bs-progress-bar-track;
|
||||
}
|
||||
|
||||
/********************************************************************************************************************
|
||||
* *
|
||||
* Highlight buttons *
|
||||
|
|
|
@ -38,6 +38,7 @@ import javafx.scene.layout.Region;
|
|||
import javafx.scene.layout.VBox;
|
||||
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
|
||||
|
@ -47,6 +48,7 @@ import java.text.DateFormat;
|
|||
import java.text.SimpleDateFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -70,7 +72,6 @@ public abstract class ChartView<T extends ChartModel> extends ActivatableView<VB
|
|||
private final HBox timelineLabels;
|
||||
private final List<Node> dividerNodes = new ArrayList<>();
|
||||
private final Double[] dividerPositions = new Double[]{0d, 1d};
|
||||
private HBox legendBox;
|
||||
private boolean pressed;
|
||||
private double x;
|
||||
private ChangeListener<Number> widthListener;
|
||||
|
@ -91,25 +92,35 @@ public abstract class ChartView<T extends ChartModel> extends ActivatableView<VB
|
|||
|
||||
chart = getChart();
|
||||
|
||||
|
||||
addSeries();
|
||||
addLegend();
|
||||
|
||||
HBox legendBox1 = getLegendBox(getSeriesForLegend1());
|
||||
Collection<XYChart.Series<Number, Number>> seriesForLegend2 = getSeriesForLegend2();
|
||||
HBox legendBox2 = null;
|
||||
if (seriesForLegend2 != null && !seriesForLegend2.isEmpty()) {
|
||||
legendBox2 = getLegendBox(seriesForLegend2);
|
||||
}
|
||||
|
||||
timelineLabels = new HBox();
|
||||
|
||||
VBox box = new VBox();
|
||||
int paddingRight = 60;
|
||||
VBox.setMargin(splitPane, new Insets(20, paddingRight, 0, 0));
|
||||
VBox.setMargin(timelineLabels, new Insets(0, paddingRight, 0, 0));
|
||||
VBox.setMargin(legendBox, new Insets(10, paddingRight, 0, 0));
|
||||
box.getChildren().addAll(splitPane, timelineLabels, legendBox);
|
||||
|
||||
VBox vBox = new VBox();
|
||||
vBox.setSpacing(10);
|
||||
vBox.getChildren().addAll(chart, box);
|
||||
|
||||
int paddingRight = 89;
|
||||
int paddingLeft = 15;
|
||||
VBox.setMargin(splitPane, new Insets(0, paddingRight, 0, paddingLeft));
|
||||
VBox.setMargin(timelineLabels, new Insets(0, paddingRight, 0, paddingLeft));
|
||||
VBox.setMargin(legendBox1, new Insets(10, paddingRight, 0, paddingLeft));
|
||||
box.getChildren().addAll(splitPane, timelineLabels, legendBox1);
|
||||
if (legendBox2 != null) {
|
||||
VBox.setMargin(legendBox2, new Insets(-20, paddingRight, 0, paddingLeft));
|
||||
box.getChildren().add(legendBox2);
|
||||
}
|
||||
root.getChildren().addAll(chart, box);
|
||||
}
|
||||
|
||||
protected abstract Collection<XYChart.Series<Number, Number>> getSeriesForLegend1();
|
||||
|
||||
protected abstract Collection<XYChart.Series<Number, Number>> getSeriesForLegend2();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Lifecycle
|
||||
|
@ -117,7 +128,7 @@ public abstract class ChartView<T extends ChartModel> extends ActivatableView<VB
|
|||
|
||||
@Override
|
||||
public void initialize() {
|
||||
center.setStyle("-fx-background-color: #dddddd");
|
||||
center.setId("chart-navigation-center-pane");
|
||||
|
||||
splitPane.setMinHeight(30);
|
||||
splitPane.setDividerPosition(0, dividerPositions[0]);
|
||||
|
@ -191,26 +202,25 @@ public abstract class ChartView<T extends ChartModel> extends ActivatableView<VB
|
|||
|
||||
protected abstract void addSeries();
|
||||
|
||||
protected void addLegend() {
|
||||
legendBox = new HBox();
|
||||
legendBox.setSpacing(10);
|
||||
Region spacer = new Region();
|
||||
HBox.setHgrow(spacer, Priority.ALWAYS);
|
||||
legendBox.getChildren().add(spacer);
|
||||
|
||||
chart.getData().forEach(series -> {
|
||||
protected HBox getLegendBox(Collection<XYChart.Series<Number, Number>> data) {
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
data.forEach(series -> {
|
||||
AutoTooltipSlideToggleButton toggle = new AutoTooltipSlideToggleButton();
|
||||
toggle.setMinWidth(200);
|
||||
toggle.setAlignment(Pos.TOP_LEFT);
|
||||
String seriesName = series.getName();
|
||||
toggleBySeriesName.put(seriesName, toggle);
|
||||
toggle.setText(seriesName);
|
||||
toggle.setId("charts-legend-toggle" + seriesIndexMap.get(seriesName));
|
||||
toggle.setSelected(true);
|
||||
toggle.setOnAction(e -> onSelectToggle(series, toggle.isSelected()));
|
||||
legendBox.getChildren().add(toggle);
|
||||
hBox.getChildren().add(toggle);
|
||||
});
|
||||
spacer = new Region();
|
||||
Region spacer = new Region();
|
||||
HBox.setHgrow(spacer, Priority.ALWAYS);
|
||||
legendBox.getChildren().add(spacer);
|
||||
hBox.getChildren().add(spacer);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
private void onSelectToggle(XYChart.Series<Number, Number> series, boolean isSelected) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BinaryOperator;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -96,17 +97,6 @@ public class DaoEconomyDataProvider {
|
|||
.sum();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fromDate Epoch in millis
|
||||
* @param toDate Epoch in millis
|
||||
*/
|
||||
/* public long getBtcTradeFeeAmount(long fromDate, long toDate) {
|
||||
return getBurnedBtcByMonth(getPredicate(fromDate, toDate)).values()
|
||||
.stream()
|
||||
.mapToLong(e -> e)
|
||||
.sum();
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @param fromDate Epoch in millis
|
||||
* @param toDate Epoch in millis
|
||||
|
@ -147,49 +137,38 @@ public class DaoEconomyDataProvider {
|
|||
}
|
||||
|
||||
public Map<Long, Long> getMergedCompensationMap(Predicate<Long> predicate) {
|
||||
return getMergedMap(daoStateService.getIssuanceSetForType(IssuanceType.COMPENSATION),
|
||||
DaoEconomyHistoricalData.COMPENSATIONS_BY_CYCLE_DATE,
|
||||
predicate);
|
||||
Map<Long, Long> issuedBsqByMonth = getIssuedBsqByMonth(daoStateService.getIssuanceSetForType(IssuanceType.COMPENSATION), predicate);
|
||||
Map<Long, Long> historicalIssuanceByMonth = getHistoricalIssuanceByMonth(DaoEconomyHistoricalData.COMPENSATIONS_BY_CYCLE_DATE, predicate);
|
||||
return getMergedMap(issuedBsqByMonth, historicalIssuanceByMonth, (daoDataValue, staticDataValue) -> staticDataValue);
|
||||
}
|
||||
|
||||
public Map<Long, Long> getMergedReimbursementMap(Predicate<Long> predicate) {
|
||||
return getMergedMap(daoStateService.getIssuanceSetForType(IssuanceType.REIMBURSEMENT),
|
||||
DaoEconomyHistoricalData.REIMBURSEMENTS_BY_CYCLE_DATE,
|
||||
predicate);
|
||||
Map<Long, Long> issuedBsqByMonth = getIssuedBsqByMonth(daoStateService.getIssuanceSetForType(IssuanceType.REIMBURSEMENT), predicate);
|
||||
Map<Long, Long> historicalIssuanceByMonth = getHistoricalIssuanceByMonth(DaoEconomyHistoricalData.REIMBURSEMENTS_BY_CYCLE_DATE, predicate);
|
||||
return getMergedMap(issuedBsqByMonth, historicalIssuanceByMonth, (daoDataValue, staticDataValue) -> staticDataValue);
|
||||
}
|
||||
|
||||
private Map<Long, Long> getMergedMap(Set<Issuance> issuanceSet,
|
||||
Map<Long, Long> historicalData,
|
||||
Predicate<Long> predicate) {
|
||||
public Map<Long, Long> getMergedMap(Map<Long, Long> map1,
|
||||
Map<Long, Long> map2,
|
||||
BinaryOperator<Long> mergeFunction) {
|
||||
return Stream.concat(map1.entrySet().stream(),
|
||||
map2.entrySet().stream())
|
||||
.collect(Collectors.toMap(Map.Entry::getKey,
|
||||
Map.Entry::getValue,
|
||||
mergeFunction));
|
||||
}
|
||||
|
||||
private Map<Long, Long> getHistoricalIssuanceByMonth(Map<Long, Long> historicalData, Predicate<Long> predicate) {
|
||||
// We did not use the reimbursement requests initially (but the compensation requests) because the limits
|
||||
// have been too low. Over time it got mixed in compensation requests and reimbursement requests.
|
||||
// To reflect that we use static data derived from the Github data. For new data we do not need that anymore
|
||||
// as we have clearly separated that now. In case we have duplicate data for a months we use the static data.
|
||||
Map<Long, Long> historicalDataMap = historicalData.entrySet().stream()
|
||||
return historicalData.entrySet().stream()
|
||||
.filter(e -> predicate.test(e.getKey()))
|
||||
.collect(Collectors.toMap(e -> toStartOfMonth(Instant.ofEpochSecond(e.getKey())),
|
||||
Map.Entry::getValue));
|
||||
|
||||
// We merge both maps.
|
||||
// If we have 2 values at same key we use the staticData as that include the daoData
|
||||
return Stream.concat(getIssuedBsqByMonth(issuanceSet, predicate).entrySet().stream(),
|
||||
historicalDataMap.entrySet().stream())
|
||||
.collect(Collectors.toMap(Map.Entry::getKey,
|
||||
Map.Entry::getValue,
|
||||
(issuedBsqByMonthValue, staticDataValue) -> staticDataValue));
|
||||
}
|
||||
|
||||
// The resulting data are not very useful. We might drop that....
|
||||
/* public Map<Long, Long> getBurnedBtcByMonth(Predicate<Long> predicate) {
|
||||
Map<Long, Long> issuedBsqByMonth = getMergedReimbursementMap(predicate);
|
||||
Map<Long, Long> burnedBsqByMonth = getBurnedBsqByMonth(daoStateService.getProofOfBurnTxs(), predicate);
|
||||
return Stream.concat(issuedBsqByMonth.entrySet().stream(),
|
||||
burnedBsqByMonth.entrySet().stream())
|
||||
.collect(Collectors.toMap(Map.Entry::getKey,
|
||||
Map.Entry::getValue,
|
||||
(issued, burned) -> burned - issued));
|
||||
}*/
|
||||
|
||||
public static long toStartOfMonth(Instant instant) {
|
||||
return instant
|
||||
.atZone(ZONE_ID)
|
||||
|
|
|
@ -58,8 +58,7 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
|
|||
private final BsqFormatter bsqFormatter;
|
||||
|
||||
private TextField genesisIssueAmountTextField, compRequestIssueAmountTextField, reimbursementAmountTextField,
|
||||
totalBurntBsqTradeFeeTextField, /*totalBurntBtcTradeFeeTextField, */
|
||||
totalLockedUpAmountTextField, totalUnlockingAmountTextField,
|
||||
totalBurntBsqTradeFeeTextField, totalLockedUpAmountTextField, totalUnlockingAmountTextField,
|
||||
totalUnlockedAmountTextField, totalConfiscatedAmountTextField, totalProofOfBurnAmountTextField;
|
||||
private int gridRow = 0;
|
||||
private long fromDate, toDate;
|
||||
|
@ -175,14 +174,6 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
|
|||
|
||||
totalProofOfBurnAmountTextField = addTopLabelReadOnlyTextField(root, gridRow, 1,
|
||||
Res.get("dao.factsAndFigures.supply.proofOfBurn"), Layout.COMPACT_FIRST_ROW_AND_COMPACT_GROUP_DISTANCE).second;
|
||||
|
||||
/* totalBurntBtcTradeFeeTextField = addTopLabelReadOnlyTextField(root, gridRow, 1,
|
||||
Res.get("dao.factsAndFigures.supply.btcTradeFee"), Layout.COMPACT_FIRST_ROW_AND_COMPACT_GROUP_DISTANCE).second;
|
||||
|
||||
Tuple3<Label, TextField, VBox> tuple3 = addTopLabelReadOnlyTextField(root, ++gridRow,
|
||||
Res.get("dao.factsAndFigures.supply.proofOfBurn"));
|
||||
totalProofOfBurnAmountTextField = tuple3.second;
|
||||
GridPane.setColumnSpan(tuple3.third, 2);*/
|
||||
}
|
||||
|
||||
private void createLockedBsqFields() {
|
||||
|
@ -224,12 +215,8 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
|
|||
Coin totalBurntTradeFee = Coin.valueOf(daoEconomyDataProvider.getBsqTradeFeeAmount(fromDate, getToDate()));
|
||||
totalBurntBsqTradeFeeTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalBurntTradeFee));
|
||||
|
||||
/* Coin totalBurntBtcTradeFee = Coin.valueOf(daoEconomyDataProvider.getBtcTradeFeeAmount(fromDate, getToDate()));
|
||||
totalBurntBtcTradeFeeTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalBurntBtcTradeFee));
|
||||
*/
|
||||
Coin totalProofOfBurnAmount = Coin.valueOf(daoEconomyDataProvider.getProofOfBurnAmount(fromDate, getToDate()));
|
||||
totalProofOfBurnAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalProofOfBurnAmount));
|
||||
|
||||
}
|
||||
|
||||
private void updateLockedTxData() {
|
||||
|
|
|
@ -56,11 +56,6 @@ public class DaoEconomyChartModel extends ChartModel {
|
|||
return toChartData(daoEconomyDataProvider.getBurnedBsqByMonth(daoStateService.getTradeFeeTxs(), predicate));
|
||||
}
|
||||
|
||||
// The resulting data are not very useful. It causes negative values if burn rate > issuance in selected timeframe
|
||||
/* List<XYChart.Data<Number, Number>> getBtcTradeFeeChartData(Predicate<Long> predicate) {
|
||||
return toChartData(daoEconomyDataProvider.getBurnedBtcByMonth(predicate));
|
||||
}*/
|
||||
|
||||
List<XYChart.Data<Number, Number>> getCompensationChartData(Predicate<Long> predicate) {
|
||||
return toChartData(daoEconomyDataProvider.getMergedCompensationMap(predicate));
|
||||
}
|
||||
|
@ -73,6 +68,20 @@ public class DaoEconomyChartModel extends ChartModel {
|
|||
return toChartData(daoEconomyDataProvider.getMergedReimbursementMap(predicate));
|
||||
}
|
||||
|
||||
List<XYChart.Data<Number, Number>> getTotalIssuedChartData(Predicate<Long> predicate) {
|
||||
Map<Long, Long> compensationMap = daoEconomyDataProvider.getMergedCompensationMap(predicate);
|
||||
Map<Long, Long> reimbursementMap = daoEconomyDataProvider.getMergedReimbursementMap(predicate);
|
||||
Map<Long, Long> sum = daoEconomyDataProvider.getMergedMap(compensationMap, reimbursementMap, Long::sum);
|
||||
return toChartData(sum);
|
||||
}
|
||||
|
||||
List<XYChart.Data<Number, Number>> getTotalBurnedChartData(Predicate<Long> predicate) {
|
||||
Map<Long, Long> tradeFee = daoEconomyDataProvider.getBurnedBsqByMonth(daoStateService.getTradeFeeTxs(), predicate);
|
||||
Map<Long, Long> proofOfBurn = daoEconomyDataProvider.getBurnedBsqByMonth(daoStateService.getProofOfBurnTxs(), predicate);
|
||||
Map<Long, Long> sum = daoEconomyDataProvider.getMergedMap(tradeFee, proofOfBurn, Long::sum);
|
||||
return toChartData(sum);
|
||||
}
|
||||
|
||||
void initBounds(List<XYChart.Data<Number, Number>> tradeFeeChartData,
|
||||
List<XYChart.Data<Number, Number>> compensationRequestsChartData) {
|
||||
Tuple2<Double, Double> xMinMaxTradeFee = getMinMax(tradeFeeChartData);
|
||||
|
|
|
@ -45,6 +45,7 @@ import java.time.Instant;
|
|||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
@ -57,7 +58,7 @@ public class DaoEconomyChartView extends ChartView<DaoEconomyChartModel> {
|
|||
private final BsqFormatter bsqFormatter;
|
||||
|
||||
private XYChart.Series<Number, Number> seriesBsqTradeFee, seriesProofOfBurn, seriesCompensation,
|
||||
seriesReimbursement/*, seriesBtcTradeFee*/;
|
||||
seriesReimbursement, seriesTotalIssued, seriesTotalBurned;
|
||||
private ListChangeListener<Node> nodeListChangeListener;
|
||||
|
||||
@Inject
|
||||
|
@ -76,10 +77,11 @@ public class DaoEconomyChartView extends ChartView<DaoEconomyChartModel> {
|
|||
public void initialize() {
|
||||
super.initialize();
|
||||
|
||||
// Turn off some series
|
||||
// Turn off detail series
|
||||
hideSeries(seriesBsqTradeFee);
|
||||
hideSeries(seriesCompensation);
|
||||
hideSeries(seriesProofOfBurn);
|
||||
hideSeries(seriesReimbursement);
|
||||
/* hideSeries(seriesBtcTradeFee);*/
|
||||
|
||||
nodeListChangeListener = c -> {
|
||||
while (c.next()) {
|
||||
|
@ -171,84 +173,88 @@ public class DaoEconomyChartView extends ChartView<DaoEconomyChartModel> {
|
|||
|
||||
@Override
|
||||
protected void addSeries() {
|
||||
seriesBsqTradeFee = new XYChart.Series<>();
|
||||
seriesBsqTradeFee.setName(Res.get("dao.factsAndFigures.supply.bsqTradeFee"));
|
||||
seriesIndexMap.put(seriesBsqTradeFee.getName(), 0);
|
||||
chart.getData().add(seriesBsqTradeFee);
|
||||
seriesTotalIssued = new XYChart.Series<>();
|
||||
seriesTotalIssued.setName(Res.get("dao.factsAndFigures.supply.totalIssued"));
|
||||
seriesIndexMap.put(seriesTotalIssued.getName(), 0);
|
||||
chart.getData().add(seriesTotalIssued);
|
||||
|
||||
/* seriesBtcTradeFee = new XYChart.Series<>();
|
||||
seriesBtcTradeFee.setName(Res.get("dao.factsAndFigures.supply.btcTradeFee"));
|
||||
seriesIndexMap.put(seriesBtcTradeFee.getName(), 4);
|
||||
chart.getData().add(seriesBtcTradeFee);*/
|
||||
seriesTotalBurned = new XYChart.Series<>();
|
||||
seriesTotalBurned.setName(Res.get("dao.factsAndFigures.supply.totalBurned"));
|
||||
seriesIndexMap.put(seriesTotalBurned.getName(), 1);
|
||||
chart.getData().add(seriesTotalBurned);
|
||||
|
||||
seriesCompensation = new XYChart.Series<>();
|
||||
seriesCompensation.setName(Res.get("dao.factsAndFigures.supply.compReq"));
|
||||
seriesIndexMap.put(seriesCompensation.getName(), 1);
|
||||
seriesIndexMap.put(seriesCompensation.getName(), 2);
|
||||
chart.getData().add(seriesCompensation);
|
||||
|
||||
seriesProofOfBurn = new XYChart.Series<>();
|
||||
seriesProofOfBurn.setName(Res.get("dao.factsAndFigures.supply.proofOfBurn"));
|
||||
seriesIndexMap.put(seriesProofOfBurn.getName(), 2);
|
||||
chart.getData().add(seriesProofOfBurn);
|
||||
|
||||
seriesReimbursement = new XYChart.Series<>();
|
||||
seriesReimbursement.setName(Res.get("dao.factsAndFigures.supply.reimbursement"));
|
||||
seriesIndexMap.put(seriesReimbursement.getName(), 3);
|
||||
chart.getData().add(seriesReimbursement);
|
||||
|
||||
seriesBsqTradeFee = new XYChart.Series<>();
|
||||
seriesBsqTradeFee.setName(Res.get("dao.factsAndFigures.supply.bsqTradeFee"));
|
||||
seriesIndexMap.put(seriesBsqTradeFee.getName(), 4);
|
||||
chart.getData().add(seriesBsqTradeFee);
|
||||
|
||||
seriesProofOfBurn = new XYChart.Series<>();
|
||||
seriesProofOfBurn.setName(Res.get("dao.factsAndFigures.supply.proofOfBurn"));
|
||||
seriesIndexMap.put(seriesProofOfBurn.getName(), 5);
|
||||
chart.getData().add(seriesProofOfBurn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<XYChart.Series<Number, Number>> getSeriesForLegend1() {
|
||||
return List.of(seriesTotalIssued, seriesCompensation, seriesReimbursement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<XYChart.Series<Number, Number>> getSeriesForLegend2() {
|
||||
return List.of(seriesTotalBurned, seriesBsqTradeFee, seriesProofOfBurn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
List<XYChart.Data<Number, Number>> bsqTradeFeeChartData = model.getBsqTradeFeeChartData(e -> true);
|
||||
Predicate<Long> predicate = e -> true;
|
||||
List<XYChart.Data<Number, Number>> bsqTradeFeeChartData = model.getBsqTradeFeeChartData(predicate);
|
||||
seriesBsqTradeFee.getData().setAll(bsqTradeFeeChartData);
|
||||
|
||||
/* List<XYChart.Data<Number, Number>> btcTradeFeeChartData = model.getBtcTradeFeeChartData(e -> true);
|
||||
seriesBtcTradeFee.getData().setAll(btcTradeFeeChartData);*/
|
||||
|
||||
List<XYChart.Data<Number, Number>> compensationRequestsChartData = model.getCompensationChartData(e -> true);
|
||||
List<XYChart.Data<Number, Number>> compensationRequestsChartData = model.getCompensationChartData(predicate);
|
||||
seriesCompensation.getData().setAll(compensationRequestsChartData);
|
||||
|
||||
List<XYChart.Data<Number, Number>> proofOfBurnChartData = model.getProofOfBurnChartData(e -> true);
|
||||
seriesProofOfBurn.getData().setAll(proofOfBurnChartData);
|
||||
|
||||
List<XYChart.Data<Number, Number>> reimbursementChartData = model.getReimbursementChartData(e -> true);
|
||||
seriesReimbursement.getData().setAll(reimbursementChartData);
|
||||
|
||||
applyTooltip();
|
||||
|
||||
// We don't need redundant data like reimbursementChartData as time value from compensationRequestsChartData
|
||||
// will cover it
|
||||
model.initBounds(bsqTradeFeeChartData, compensationRequestsChartData);
|
||||
xAxis.setLowerBound(model.getLowerBound().doubleValue());
|
||||
xAxis.setUpperBound(model.getUpperBound().doubleValue());
|
||||
|
||||
updateOtherSeries(predicate);
|
||||
applyTooltip();
|
||||
|
||||
UserThread.execute(this::setTimeLineLabels);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateData(Predicate<Long> predicate) {
|
||||
List<XYChart.Data<Number, Number>> tradeFeeChartData = model.getBsqTradeFeeChartData(predicate);
|
||||
seriesBsqTradeFee.getData().setAll(tradeFeeChartData);
|
||||
|
||||
/* List<XYChart.Data<Number, Number>> btcTradeFeeChartData = model.getBtcTradeFeeChartData(predicate);
|
||||
seriesBtcTradeFee.getData().setAll(btcTradeFeeChartData);*/
|
||||
|
||||
List<XYChart.Data<Number, Number>> compensationRequestsChartData = model.getCompensationChartData(predicate);
|
||||
seriesCompensation.getData().setAll(compensationRequestsChartData);
|
||||
|
||||
List<XYChart.Data<Number, Number>> proofOfBurnChartData = model.getProofOfBurnChartData(predicate);
|
||||
seriesProofOfBurn.getData().setAll(proofOfBurnChartData);
|
||||
|
||||
List<XYChart.Data<Number, Number>> reimbursementChartData = model.getReimbursementChartData(predicate);
|
||||
seriesReimbursement.getData().setAll(reimbursementChartData);
|
||||
seriesBsqTradeFee.getData().setAll(model.getBsqTradeFeeChartData(predicate));
|
||||
seriesCompensation.getData().setAll(model.getCompensationChartData(predicate));
|
||||
|
||||
updateOtherSeries(predicate);
|
||||
applyTooltip();
|
||||
}
|
||||
|
||||
private void updateOtherSeries(Predicate<Long> predicate) {
|
||||
seriesProofOfBurn.getData().setAll(model.getProofOfBurnChartData(predicate));
|
||||
seriesReimbursement.getData().setAll(model.getReimbursementChartData(predicate));
|
||||
seriesTotalIssued.getData().setAll(model.getTotalIssuedChartData(predicate));
|
||||
seriesTotalBurned.getData().setAll(model.getTotalBurnedChartData(predicate));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyTooltip() {
|
||||
chart.getData().forEach(series -> {
|
||||
String format = series == seriesCompensation || series == seriesReimbursement ?
|
||||
String format = series == seriesCompensation || series == seriesReimbursement || series == seriesTotalIssued ?
|
||||
"dd MMM yyyy" :
|
||||
"MMM yyyy";
|
||||
series.getData().forEach(data -> {
|
||||
|
|
|
@ -135,13 +135,16 @@
|
|||
-bs-white: white;
|
||||
-bs-prompt-text: -bs-color-gray-3;
|
||||
-bs-decimals: #db6300;
|
||||
-bs-soft-red: #680000;
|
||||
-bs-turquoise-light: #BEDB39;
|
||||
|
||||
/* dao chart colors */
|
||||
-bs-chart-dao-line1: -bs-color-green-5;
|
||||
-bs-chart-dao-line2: -bs-color-blue-2;
|
||||
-bs-chart-dao-line3: -bs-turquoise;
|
||||
-bs-chart-dao-line4: -bs-yellow;
|
||||
-bs-chart-dao-line5: -bs-color-blue-0;
|
||||
-bs-chart-dao-line5: -bs-soft-red;
|
||||
-bs-chart-dao-line6: -bs-turquoise-light;
|
||||
|
||||
/* Monero orange color code */
|
||||
-xmr-orange: #f26822;
|
||||
|
|
|
@ -102,13 +102,16 @@
|
|||
-bs-progress-bar-track: #e0e0e0;
|
||||
-bs-white: white;
|
||||
-bs-prompt-text: -fx-control-inner-background;
|
||||
-bs-soft-red: #E74C3B;
|
||||
-bs-turquoise-light: #00DCFF;
|
||||
|
||||
/* dao chart colors */
|
||||
-bs-chart-dao-line1: -bs-color-green-3;
|
||||
-bs-chart-dao-line2: -bs-color-blue-5;
|
||||
-bs-chart-dao-line3: -bs-turquoise;
|
||||
-bs-chart-dao-line4: -bs-yellow;
|
||||
-bs-chart-dao-line5: -bs-color-blue-0;
|
||||
-bs-chart-dao-line5: -bs-soft-red;
|
||||
-bs-chart-dao-line6: -bs-turquoise-light;
|
||||
|
||||
/* Monero orange color code */
|
||||
-xmr-orange: #f26822;
|
||||
|
|
Loading…
Add table
Reference in a new issue