diff --git a/src/main/java/no/ntnu/idatt1002/demo/controller/BudgetController.java b/src/main/java/no/ntnu/idatt1002/demo/controller/BudgetController.java index 1dbd4fedc53b2f48ce3b54009b90ecfd9e4c3630..afb060102df6da01d9eb8bc6de2df322f254db3d 100644 --- a/src/main/java/no/ntnu/idatt1002/demo/controller/BudgetController.java +++ b/src/main/java/no/ntnu/idatt1002/demo/controller/BudgetController.java @@ -165,8 +165,7 @@ public class BudgetController extends FinanceController { //Only adds the budget data for chosen categories to the pie chart for (ExpenseCategory category : chosenCategories) { - budgetData.add(new Data(category.toString().substring(0, 1).toUpperCase() - .concat(category.toString().substring(1)), + budgetData.add(new Data( category.label, general.getBudgetItem(category).getBudgetAmount())); } return budgetData; @@ -177,7 +176,7 @@ public class BudgetController extends FinanceController { */ @Override public void refreshPieChart() { - + this.budgetPieChart.setLabelsVisible(true); this.budgetPieChart.setData(createPieChart()); } diff --git a/src/main/resources/style.css b/src/main/resources/style.css index b763b8690c9801608f74a31865901c35504a5cf3..f798d4ffeb2d8edb01e967a5d783dcb34064cbbf 100644 --- a/src/main/resources/style.css +++ b/src/main/resources/style.css @@ -142,4 +142,31 @@ -fx-border-radius: 30; -fx-border-color: white; -fx-text-fill: white; -} \ No newline at end of file +} + +.chart-pie-label { + -fx-font-size: 20; + //-fx-background-color: white; + //-fx-border-radius: 50; + //-fx-border-width: 10; + -fx-background-color: white; + -fx-font-weight: bold; +} + +.chart-pie-label-line { + -fx-stroke: rgba(0, 0, 0, 0.90); + -fx-fill: rgba(0, 0, 0, 0.90); + -fx-font-weight: 20; + +} + +.chart-pie-label { + -fx-fill: black; + -fx-font-size: 20; +} + +/*.pie-back { + -fx-background-color: white; + -fx-border-radius: 50; + -fx-border-width: 10; +}*/ diff --git a/src/main/resources/view/BudgetNewest.fxml b/src/main/resources/view/BudgetNewest.fxml index 17bae2e97a222a6bfce272fda4683c29ccd7234a..ed27f3c6b9eb067434e39983d658577627e757c7 100644 --- a/src/main/resources/view/BudgetNewest.fxml +++ b/src/main/resources/view/BudgetNewest.fxml @@ -1,29 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> -<?import javafx.geometry.Insets?> -<?import javafx.scene.Cursor?> -<?import javafx.scene.chart.PieChart?> -<?import javafx.scene.control.Button?> -<?import javafx.scene.control.ComboBox?> -<?import javafx.scene.control.ContextMenu?> -<?import javafx.scene.control.DatePicker?> -<?import javafx.scene.control.Label?> -<?import javafx.scene.control.MenuItem?> -<?import javafx.scene.control.TableColumn?> -<?import javafx.scene.control.TableView?> -<?import javafx.scene.image.Image?> -<?import javafx.scene.image.ImageView?> -<?import javafx.scene.layout.AnchorPane?> -<?import javafx.scene.layout.BorderPane?> -<?import javafx.scene.layout.ColumnConstraints?> -<?import javafx.scene.layout.GridPane?> -<?import javafx.scene.layout.HBox?> -<?import javafx.scene.layout.Pane?> -<?import javafx.scene.layout.RowConstraints?> -<?import javafx.scene.layout.VBox?> -<?import javafx.scene.text.Font?> +<?import javafx.geometry.*?> +<?import javafx.scene.*?> +<?import javafx.scene.chart.*?> +<?import javafx.scene.control.*?> +<?import javafx.scene.image.*?> +<?import javafx.scene.layout.*?> +<?import javafx.scene.text.*?> -<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="695.0" prefWidth="1130.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="no.ntnu.idatt1002.demo.controller.BudgetController"> +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="695.0" prefWidth="1130.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="no.ntnu.idatt1002.demo.controller.BudgetController"> <children> <ImageView fitHeight="695.0" fitWidth="1130.0" pickOnBounds="true"> <image> @@ -192,7 +177,7 @@ </VBox> <Pane GridPane.columnIndex="1"> <children> - <PieChart fx:id="budgetPieChart" labelsVisible="false" layoutX="105.0" layoutY="33.0" legendSide="RIGHT" maxHeight="444.0" maxWidth="512.0" prefHeight="302.0" prefWidth="354.0" /> + <PieChart fx:id="budgetPieChart" labelsVisible="false" layoutX="16.0" layoutY="33.0" legendSide="RIGHT" maxHeight="444.0" maxWidth="512.0" prefHeight="405.0" prefWidth="479.0" stylesheets="@../style.css" /> </children> </Pane> </children>