Skip to content
Snippets Groups Projects
Commit 4f0432e2 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

Fixed #147 - categories chart suggested height is to small

parent dd7d159b
No related branches found
No related tags found
1 merge request!150merge v1_3_1 into master
...@@ -31,7 +31,8 @@ public class CategoriesChart extends VBox implements ChartExportable ...@@ -31,7 +31,8 @@ public class CategoriesChart extends VBox implements ChartExportable
private double totalIncomes; private double totalIncomes;
private double totalPayments; private double totalPayments;
private LegendType legendType; private LegendType legendType;
private final double CHART_HEIGHT = 200;
private final double FULL_LEGEND_ITEM_HEIGHT = 40;
public CategoriesChart(String titleIncomes, String titlePayments, ArrayList<CategoryInOutSum> categoryInOutSums, String currency, LegendType legendType) public CategoriesChart(String titleIncomes, String titlePayments, ArrayList<CategoryInOutSum> categoryInOutSums, String currency, LegendType legendType)
{ {
...@@ -295,13 +296,16 @@ public class CategoriesChart extends VBox implements ChartExportable ...@@ -295,13 +296,16 @@ public class CategoriesChart extends VBox implements ChartExportable
public WritableImage export(int width, int height) public WritableImage export(int width, int height)
{ {
VBox root = new VBox(); VBox root = new VBox();
root.setStyle("-fx-background-color: transparent;"); root.setStyle("-fx-background-color: transparent;");
root.setPadding(new Insets(25)); root.setPadding(new Insets(25));
root.setSpacing(10);
root.getChildren().add(generate(titleIncomes, true)); root.getChildren().add(generate(titleIncomes, true));
root.getChildren().add(generate(titlePayments, false)); root.getChildren().add(generate(titlePayments, false));
Region spacer = new Region(); Region spacer = new Region();
spacer.setMinHeight(25);
root.getChildren().add(spacer); root.getChildren().add(spacer);
VBox.setVgrow(spacer, Priority.ALWAYS); VBox.setVgrow(spacer, Priority.ALWAYS);
...@@ -329,6 +333,6 @@ public class CategoriesChart extends VBox implements ChartExportable ...@@ -329,6 +333,6 @@ public class CategoriesChart extends VBox implements ChartExportable
@Override @Override
public double getSuggestedHeight() public double getSuggestedHeight()
{ {
return getHeight() + 100; return CHART_HEIGHT + categoryInOutSums.size() * FULL_LEGEND_ITEM_HEIGHT + 50;
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment