'How to eliminate the empty space of a dialog/pie chart in JavaFX?

I'm new to JavaFX and encountering this problem. Pie chart/dialog with extra dead space.

My code is

Dialog dialog = new Dialog();

ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
pieChartData.addAll(new PieChart.Data("Win", 45), new PieChart.Data("Loss", 55));
PieChart chart = new PieChart(pieChartData);
dialog.setGraphic(chart);

How can I eliminate this space? Any help would be appreciated.



Solution 1:[1]

dialog.getDialogPane().setMaxWidth(500); to set a fixed width of the dialog. But I haven't figured out why the pie chart has this extra space.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 WYW