mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Merge pull request #5855 from chimp1984/fix-dao-charts
Fix missing update of time line in dao charts
This commit is contained in:
commit
7280b66553
@ -110,7 +110,6 @@ public abstract class ChartView<T extends ChartViewModel<? extends ChartDataMode
|
||||
private EventHandler<MouseEvent> dividerMouseDraggedEventHandler;
|
||||
private final StringProperty fromProperty = new SimpleStringProperty();
|
||||
private final StringProperty toProperty = new SimpleStringProperty();
|
||||
private boolean dataApplied;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -569,6 +568,8 @@ public abstract class ChartView<T extends ChartViewModel<? extends ChartDataMode
|
||||
long ts2 = System.currentTimeMillis();
|
||||
updateChartAfterDataChange();
|
||||
log.debug("updateChartAfterDataChange took {}", System.currentTimeMillis() - ts2);
|
||||
|
||||
onDataApplied();
|
||||
});
|
||||
}
|
||||
|
||||
@ -776,21 +777,13 @@ public abstract class ChartView<T extends ChartViewModel<? extends ChartDataMode
|
||||
}
|
||||
|
||||
protected void mapToUserThread(Runnable command) {
|
||||
UserThread.execute(() -> {
|
||||
command.run();
|
||||
onDataApplied();
|
||||
});
|
||||
UserThread.execute(command);
|
||||
}
|
||||
|
||||
// For the async handling we need to wait until we get the data applied and then still delay a bit otherwise
|
||||
// the UI does not get rendered at first start
|
||||
protected void onDataApplied() {
|
||||
if (!dataApplied) {
|
||||
dataApplied = true;
|
||||
UserThread.execute(() -> {
|
||||
applyTimeLineNavigationLabels();
|
||||
updateTimeLinePositions();
|
||||
});
|
||||
// Once we have data applied we need to call initBoundsForTimelineNavigation again
|
||||
if (model.upperBound.longValue() == 0) {
|
||||
initBoundsForTimelineNavigation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,8 +247,9 @@ public abstract class ChartViewModel<T extends ChartDataModel> extends Activatab
|
||||
private Tuple2<Double, Double> getMinMax(List<XYChart.Data<Number, Number>> chartData) {
|
||||
long min = Long.MAX_VALUE, max = 0;
|
||||
for (XYChart.Data<Number, ?> data : chartData) {
|
||||
min = Math.min(data.getXValue().longValue(), min);
|
||||
max = Math.max(data.getXValue().longValue(), max);
|
||||
long value = data.getXValue().longValue();
|
||||
min = Math.min(value, min);
|
||||
max = Math.max(value, max);
|
||||
}
|
||||
return new Tuple2<>((double) min, (double) max);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user