diff --git a/src/main/java/es/kauron/estraba/controller/DashboardController.java b/src/main/java/es/kauron/estraba/controller/DashboardController.java index f4adbf7..0d729eb 100644 --- a/src/main/java/es/kauron/estraba/controller/DashboardController.java +++ b/src/main/java/es/kauron/estraba/controller/DashboardController.java @@ -46,12 +46,13 @@ import javafx.scene.chart.AreaChart; import javafx.scene.chart.LineChart; import javafx.scene.chart.PieChart; import javafx.scene.chart.XYChart; +import javafx.scene.control.ChoiceBox; import javafx.scene.control.Label; import javafx.scene.control.Tab; import javafx.scene.image.Image; import javafx.scene.image.ImageView; -import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.StackPane; import javafx.stage.Stage; import jgpx.model.analysis.Chunk; @@ -66,8 +67,8 @@ import java.util.ResourceBundle; public class DashboardController implements Initializable, MapComponentInitializedListener { - final int N = 0, S = 1, E = 2, W = 3; - final double[] coord = new double[4]; + private final int N = 0, S = 1, E = 2, W = 3; + private final double[] coord = new double[4]; @FXML private AnchorPane root; @FXML @@ -101,6 +102,12 @@ public class DashboardController implements Initializable, MapComponentInitializ @FXML private LineChart speedTChart, hrTChart, cadenceTChart; + @FXML + private ChoiceBox choiceBox; + + @FXML + private StackPane charts; + @Override public void initialize(URL location, ResourceBundle resources) { mapView.setVisible(false); @@ -117,12 +124,14 @@ public class DashboardController implements Initializable, MapComponentInitializ imgDate.setImage(new Image(App.class.getResourceAsStream("img/date.png"))); imgDistance.setImage(new Image(App.class.getResourceAsStream("img/distance.png"))); imgElevation.setImage(new Image(App.class.getResourceAsStream("img/elevation.png"))); - } - @FXML - private void toggleChart(MouseEvent e) { - for (Node n : ((Node) e.getSource()).getParent().getChildrenUnmodifiable()) - n.setVisible(!n.isVisible()); + choiceBox.getItems().add(App.GENERAL_BUNDLE.getString("label.distance")); + choiceBox.getItems().add(App.GENERAL_BUNDLE.getString("label.time")); + choiceBox.setValue(choiceBox.getItems().get(0)); + choiceBox.valueProperty().addListener((observableValue, s, t1) -> { + for (Node n : charts.getChildrenUnmodifiable()) + n.setVisible(!n.isVisible()); + }); } @FXML diff --git a/src/main/resources/es/kauron/estraba/fxml/Dashboard.fxml b/src/main/resources/es/kauron/estraba/fxml/Dashboard.fxml index c050952..2f77892 100644 --- a/src/main/resources/es/kauron/estraba/fxml/Dashboard.fxml +++ b/src/main/resources/es/kauron/estraba/fxml/Dashboard.fxml @@ -25,17 +25,27 @@ ~ --> - + + + - - - - - - - - + + + + + + + + + + + + + + + + + @@ -50,8 +60,8 @@ - - + + @@ -63,8 +73,7 @@ - + @@ -98,9 +107,9 @@ - - - + + + - + - + @@ -219,8 +226,8 @@ - - + + @@ -234,8 +241,8 @@ - - + + - + @@ -276,8 +282,8 @@ - - + + - + @@ -305,8 +310,8 @@ - - + + @@ -328,9 +333,9 @@ - - - + + + - + @@ -419,96 +423,85 @@ - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/general.properties b/src/main/resources/general.properties index d0c31b1..fff17c3 100644 --- a/src/main/resources/general.properties +++ b/src/main/resources/general.properties @@ -37,6 +37,7 @@ label.loadGPX=Load GPX file label.maxHR=Max. heart rate label.motivation=Welcome! label.speed=Speed +label.time=Time label.welcome=Welcome! tab.dashboard=Dashboard tab.graph=Stats diff --git a/src/main/resources/general_ca.properties b/src/main/resources/general_ca.properties index 6c05642..87795fe 100644 --- a/src/main/resources/general_ca.properties +++ b/src/main/resources/general_ca.properties @@ -37,6 +37,7 @@ label.loadGPX=Obrir arxiu GPX label.maxHR=Max. pulsacions/min label.motivation=\u00a1Benvinguts! label.speed=Speed +label.time=Temps label.welcome=Benvingut! tab.dashboard=Sumari tab.graph=Estad\u00edstiques diff --git a/src/main/resources/general_es.properties b/src/main/resources/general_es.properties index 6d68538..5d6c81d 100644 --- a/src/main/resources/general_es.properties +++ b/src/main/resources/general_es.properties @@ -37,6 +37,7 @@ label.loadGPX=Abrir archivo GPX label.maxHR=Max. pulsaciones/min label.motivation=\u00a1Bienvenido! label.speed=Velocidad +label.time=Tiempo label.welcome=¡Bienvenido! tab.dashboard=Res\u00famen tab.graph=Estad\u00edsticas