Skip to content

Commit

Permalink
Fix exception when there's no balance data
Browse files Browse the repository at this point in the history
  • Loading branch information
Bios-Marcel committed Jul 12, 2024
1 parent 718d05a commit 11a67a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/link/biosmarcel/baka/view/EvaluationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,18 @@ private void updateCharts() {
Tooltip.install(dataPoint.getNode(), tooltip);
}

balanceLowerBound.setValue(Math.floor(balanceSeries.getData().getFirst().getXValue().doubleValue()));
balanceUpperBound.setValue(Math.ceil(balanceSeries.getData().getLast().getXValue().doubleValue()));
if (!balanceSeries.getData().isEmpty()) {
balanceLowerBound.setValue(Math.floor(balanceSeries.getData().getFirst().getXValue().doubleValue()));
balanceUpperBound.setValue(Math.ceil(balanceSeries.getData().getLast().getXValue().doubleValue()));
}

final List<XYChart.Series<String, Number>> fragments = new ArrayList<>();
for (final var category : classificationToMonthToMoney.entrySet()) {
final XYChart.Series<String, Number> categorySeries = new XYChart.Series<>();
categorySeries.setName(category.getKey());

for (final var monthToAmount : Objects.requireNonNull(category.getValue()).entrySet()) {
categorySeries.getData().add(new XYChart.Data<String, Number>(
categorySeries.getData().add(new XYChart.Data<>(
renderMonth(monthToAmount.getKey()),
// We render positive values for now on, as the chart renders a 1 pixel gap between the series otherwise.
monthToAmount.getValue().abs()
Expand Down

0 comments on commit 11a67a6

Please sign in to comment.