Added toggle for time/distance
This commit is contained in:
parent
5c09e8b074
commit
5c6f8db4da
5 changed files with 176 additions and 172 deletions
|
@ -45,12 +45,13 @@ import javafx.scene.Scene;
|
|||
import javafx.scene.chart.AreaChart;
|
||||
import javafx.scene.chart.LineChart;
|
||||
import javafx.scene.chart.PieChart;
|
||||
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;
|
||||
|
||||
|
@ -65,8 +66,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
|
||||
|
@ -100,6 +101,12 @@ public class DashboardController implements Initializable, MapComponentInitializ
|
|||
@FXML
|
||||
private LineChart<Long, Double> speedTChart, hrTChart, cadenceTChart;
|
||||
|
||||
@FXML
|
||||
private ChoiceBox<String> choiceBox;
|
||||
|
||||
@FXML
|
||||
private StackPane charts;
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
mapView.setVisible(false);
|
||||
|
@ -116,13 +123,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) {
|
||||
System.out.println("hi");
|
||||
for (Node n : ((Node) e.getSource()).getParent().getChildrenUnmodifiable())
|
||||
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
|
||||
|
|
|
@ -25,17 +25,27 @@
|
|||
~
|
||||
-->
|
||||
|
||||
<?import com.jfoenix.controls.*?>
|
||||
<?import com.jfoenix.controls.JFXButton?>
|
||||
<?import com.jfoenix.controls.JFXSpinner?>
|
||||
<?import com.jfoenix.controls.JFXTabPane?>
|
||||
<?import com.lynden.gmapsfx.GoogleMapView?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.chart.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import java.lang.*?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="root" xmlns="http://javafx.com/javafx/8.0.76-ea"
|
||||
fx:controller="es.kauron.estraba.controller.DashboardController">
|
||||
<?import java.lang.String?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.chart.AreaChart?>
|
||||
<?import javafx.scene.chart.LineChart?>
|
||||
<?import javafx.scene.chart.NumberAxis?>
|
||||
<?import javafx.scene.chart.PieChart?>
|
||||
<?import javafx.scene.control.ChoiceBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane fx:id="root" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.estraba.controller.DashboardController">
|
||||
<JFXTabPane minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="1000.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<Tab fx:id="tabDashboard" styleClass=".estraba.dashboard" text="%tab.dashboard">
|
||||
<VBox prefHeight="200.0" prefWidth="100.0">
|
||||
|
@ -63,8 +73,7 @@
|
|||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</HBox.margin>
|
||||
<HBox alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||
<ImageView fx:id="imgHR" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true"
|
||||
preserveRatio="true" styleClass="icon">
|
||||
<ImageView fx:id="imgHR" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" styleClass="icon">
|
||||
</ImageView>
|
||||
<VBox alignment="CENTER" HBox.hgrow="ALWAYS">
|
||||
<Label alignment="CENTER_RIGHT" maxWidth="1.7976931348623157E308" text="%label.hr">
|
||||
|
@ -120,8 +129,7 @@
|
|||
</VBox>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||
<ImageView fx:id="imgSpeed" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true"
|
||||
preserveRatio="true" styleClass="icon">
|
||||
<ImageView fx:id="imgSpeed" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" styleClass="icon">
|
||||
</ImageView>
|
||||
<VBox alignment="CENTER" HBox.hgrow="ALWAYS">
|
||||
<Label alignment="CENTER_RIGHT" maxWidth="1.7976931348623157E308" text="%label.speed">
|
||||
|
@ -162,8 +170,7 @@
|
|||
</VBox>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||
<ImageView fx:id="imgCadence" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true"
|
||||
preserveRatio="true" styleClass="icon">
|
||||
<ImageView fx:id="imgCadence" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" styleClass="icon">
|
||||
</ImageView>
|
||||
<VBox alignment="CENTER" HBox.hgrow="ALWAYS">
|
||||
<Label alignment="CENTER_RIGHT" maxWidth="1.7976931348623157E308" text="%label.cadence">
|
||||
|
@ -260,8 +267,7 @@
|
|||
</styleClass>
|
||||
</Label>
|
||||
</VBox>
|
||||
<ImageView fx:id="imgDate" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true"
|
||||
preserveRatio="true" styleClass="icon">
|
||||
<ImageView fx:id="imgDate" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" styleClass="icon">
|
||||
</ImageView>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="200.0" HBox.hgrow="ALWAYS" VBox.vgrow="ALWAYS">
|
||||
|
@ -289,8 +295,7 @@
|
|||
</styleClass>
|
||||
</Label>
|
||||
</VBox>
|
||||
<ImageView fx:id="imgDistance" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true"
|
||||
preserveRatio="true" styleClass="icon">
|
||||
<ImageView fx:id="imgDistance" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" styleClass="icon">
|
||||
</ImageView>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="200.0" HBox.hgrow="ALWAYS" VBox.vgrow="ALWAYS">
|
||||
|
@ -346,8 +351,7 @@
|
|||
</Label>
|
||||
</HBox>
|
||||
</VBox>
|
||||
<ImageView fx:id="imgElevation" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true"
|
||||
preserveRatio="true" styleClass="icon">
|
||||
<ImageView fx:id="imgElevation" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" styleClass="icon">
|
||||
</ImageView>
|
||||
</HBox>
|
||||
</VBox>
|
||||
|
@ -417,14 +421,16 @@
|
|||
</VBox>
|
||||
</Tab>
|
||||
<Tab fx:id="tabGraph" text="%tab.graph">
|
||||
<VBox>
|
||||
<VBox alignment="CENTER">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
<StackPane>
|
||||
<ChoiceBox fx:id="choiceBox" prefWidth="150.0" />
|
||||
<StackPane fx:id="charts">
|
||||
<children>
|
||||
<AreaChart fx:id="elevationChart" createSymbols="false" legendVisible="false" minHeight="100.0"
|
||||
onMouseClicked="#toggleChart">
|
||||
<VBox>
|
||||
<children>
|
||||
<AreaChart fx:id="elevationChart" createSymbols="false" legendVisible="false" minHeight="100.0">
|
||||
<xAxis>
|
||||
<NumberAxis side="BOTTOM" />
|
||||
</xAxis>
|
||||
|
@ -432,8 +438,35 @@
|
|||
<NumberAxis side="LEFT" />
|
||||
</yAxis>
|
||||
</AreaChart>
|
||||
<AreaChart fx:id="elevationTChart" createSymbols="false" layoutX="10.0" layoutY="10.0"
|
||||
legendVisible="false" minHeight="100.0" onMouseClicked="#toggleChart" visible="false">
|
||||
<LineChart fx:id="speedChart" createSymbols="false" legendVisible="false" minHeight="100.0">
|
||||
<xAxis>
|
||||
<NumberAxis />
|
||||
</xAxis>
|
||||
<yAxis>
|
||||
<NumberAxis side="LEFT" />
|
||||
</yAxis>
|
||||
</LineChart>
|
||||
<LineChart fx:id="hrChart" createSymbols="false" legendVisible="false" minHeight="100.0">
|
||||
<xAxis>
|
||||
<NumberAxis side="BOTTOM" />
|
||||
</xAxis>
|
||||
<yAxis>
|
||||
<NumberAxis side="LEFT" />
|
||||
</yAxis>
|
||||
</LineChart>
|
||||
<LineChart fx:id="cadenceChart" createSymbols="false" legendVisible="false" minHeight="100.0">
|
||||
<xAxis>
|
||||
<NumberAxis side="BOTTOM" />
|
||||
</xAxis>
|
||||
<yAxis>
|
||||
<NumberAxis side="LEFT" />
|
||||
</yAxis>
|
||||
</LineChart>
|
||||
</children>
|
||||
</VBox>
|
||||
<VBox visible="false">
|
||||
<children>
|
||||
<AreaChart fx:id="elevationTChart" createSymbols="false" legendVisible="false" minHeight="100.0">
|
||||
<xAxis>
|
||||
<NumberAxis />
|
||||
</xAxis>
|
||||
|
@ -441,12 +474,7 @@
|
|||
<NumberAxis side="LEFT" />
|
||||
</yAxis>
|
||||
</AreaChart>
|
||||
</children>
|
||||
</StackPane>
|
||||
<StackPane>
|
||||
<children>
|
||||
<LineChart fx:id="speedChart" createSymbols="false" legendVisible="false" minHeight="100.0"
|
||||
onMouseClicked="#toggleChart">
|
||||
<LineChart fx:id="speedTChart" createSymbols="false" legendVisible="false" minHeight="100.0">
|
||||
<xAxis>
|
||||
<NumberAxis />
|
||||
</xAxis>
|
||||
|
@ -454,8 +482,15 @@
|
|||
<NumberAxis side="LEFT" />
|
||||
</yAxis>
|
||||
</LineChart>
|
||||
<LineChart fx:id="speedTChart" createSymbols="false" layoutX="10.0" layoutY="10.0"
|
||||
legendVisible="false" minHeight="100.0" onMouseClicked="#toggleChart" visible="false">
|
||||
<LineChart fx:id="hrTChart" createSymbols="false" legendVisible="false" minHeight="100.0">
|
||||
<xAxis>
|
||||
<NumberAxis />
|
||||
</xAxis>
|
||||
<yAxis>
|
||||
<NumberAxis side="LEFT" />
|
||||
</yAxis>
|
||||
</LineChart>
|
||||
<LineChart fx:id="cadenceTChart" createSymbols="false" legendVisible="false" minHeight="100.0">
|
||||
<xAxis>
|
||||
<NumberAxis />
|
||||
</xAxis>
|
||||
|
@ -464,49 +499,7 @@
|
|||
</yAxis>
|
||||
</LineChart>
|
||||
</children>
|
||||
</StackPane>
|
||||
<StackPane>
|
||||
<children>
|
||||
<LineChart fx:id="hrChart" createSymbols="false" legendVisible="false" minHeight="100.0"
|
||||
onMouseClicked="#toggleChart">
|
||||
<xAxis>
|
||||
<NumberAxis side="BOTTOM"/>
|
||||
</xAxis>
|
||||
<yAxis>
|
||||
<NumberAxis side="LEFT"/>
|
||||
</yAxis>
|
||||
</LineChart>
|
||||
<LineChart fx:id="hrTChart" createSymbols="false" layoutX="10.0" layoutY="10.0" legendVisible="false"
|
||||
minHeight="100.0" onMouseClicked="#toggleChart" visible="false">
|
||||
<xAxis>
|
||||
<NumberAxis/>
|
||||
</xAxis>
|
||||
<yAxis>
|
||||
<NumberAxis side="LEFT"/>
|
||||
</yAxis>
|
||||
</LineChart>
|
||||
</children>
|
||||
</StackPane>
|
||||
<StackPane>
|
||||
<children>
|
||||
<LineChart fx:id="cadenceChart" createSymbols="false" legendVisible="false" minHeight="100.0"
|
||||
onMouseClicked="#toggleChart">
|
||||
<xAxis>
|
||||
<NumberAxis side="BOTTOM"/>
|
||||
</xAxis>
|
||||
<yAxis>
|
||||
<NumberAxis side="LEFT"/>
|
||||
</yAxis>
|
||||
</LineChart>
|
||||
<LineChart fx:id="cadenceTChart" createSymbols="false" layoutX="10.0" layoutY="10.0"
|
||||
legendVisible="false" minHeight="100.0" onMouseClicked="#toggleChart" visible="false">
|
||||
<xAxis>
|
||||
<NumberAxis/>
|
||||
</xAxis>
|
||||
<yAxis>
|
||||
<NumberAxis side="LEFT"/>
|
||||
</yAxis>
|
||||
</LineChart>
|
||||
</VBox>
|
||||
</children>
|
||||
</StackPane>
|
||||
</VBox>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in a new issue