Skip to content
Snippets Groups Projects
Commit af8bde99 authored by Salles Coralie's avatar Salles Coralie
Browse files

Graph axes

parent 90b9573c
No related branches found
No related tags found
No related merge requests found
...@@ -134,6 +134,43 @@ ...@@ -134,6 +134,43 @@
<Insets bottom="10.0" left="10.0" right="10.0" /> <Insets bottom="10.0" left="10.0" right="10.0" />
</GridPane.margin> </GridPane.margin>
</GridPane> </GridPane>
<GridPane fx:id="data" visible="false" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="270.3333435058594" minHeight="10.0" prefHeight="231.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="138.33331298828125" minHeight="10.0" prefHeight="55.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="138.33331298828125" minHeight="10.0" prefHeight="55.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<LineChart fx:id="graph" alternativeColumnFillVisible="true">
<xAxis>
<CategoryAxis fx:id="axisXGraph" side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis fx:id="axisYGraph" side="LEFT" />
</yAxis>
</LineChart>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
<children>
<RadioButton fx:id="dayGranulation" mnemonicParsing="false" selected="true" text="Jour">
<toggleGroup>
<ToggleGroup fx:id="granulation" />
</toggleGroup>
</RadioButton>
<RadioButton fx:id="weekGranulation" mnemonicParsing="false" text="Semaine" toggleGroup="$granulation" />
<RadioButton fx:id="monthGranulation" mnemonicParsing="false" text="Mois" toggleGroup="$granulation" />
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
<children>
<Label text="Visualiser la donnée : " />
<ComboBox fx:id="dataGraph" prefWidth="150.0" />
</children>
</HBox>
</children>
</GridPane>
<GridPane fx:id="configuration" style="-fx-background-color: white;" visible="false" GridPane.rowIndex="1"> <GridPane fx:id="configuration" style="-fx-background-color: white;" visible="false" GridPane.rowIndex="1">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
...@@ -197,42 +234,5 @@ ...@@ -197,42 +234,5 @@
<Insets bottom="5.0" top="5.0" /> <Insets bottom="5.0" top="5.0" />
</GridPane.margin> </GridPane.margin>
</HBox> </HBox>
<GridPane fx:id="data" visible="false" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="270.3333435058594" minHeight="10.0" prefHeight="231.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="138.33331298828125" minHeight="10.0" prefHeight="55.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="138.33331298828125" minHeight="10.0" prefHeight="55.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<LineChart fx:id="graph" alternativeColumnFillVisible="true">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
<children>
<RadioButton mnemonicParsing="false" selected="true" text="Jour">
<toggleGroup>
<ToggleGroup fx:id="granulation" />
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" text="Semaine" toggleGroup="$granulation" />
<RadioButton mnemonicParsing="false" text="Mois" toggleGroup="$granulation" />
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
<children>
<Label text="Visualiser la donnée : " />
<ComboBox fx:id="dataGraph" prefWidth="150.0" />
</children>
</HBox>
</children>
</GridPane>
</children> </children>
</GridPane> </GridPane>
...@@ -18,11 +18,15 @@ import javafx.beans.value.ObservableValue; ...@@ -18,11 +18,15 @@ import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.LineChart; import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.CheckBox; import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox; import javafx.scene.control.ComboBox;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup; import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
...@@ -75,6 +79,16 @@ public class FXMLVueController implements Initializable, Observer { ...@@ -75,6 +79,16 @@ public class FXMLVueController implements Initializable, Observer {
private ToggleGroup granulation; private ToggleGroup granulation;
@FXML @FXML
private ComboBox<String> dataGraph; private ComboBox<String> dataGraph;
@FXML
private NumberAxis axisYGraph;
@FXML
private CategoryAxis axisXGraph;
@FXML
private RadioButton dayGranulation;
@FXML
private RadioButton weekGranulation;
@FXML
private RadioButton monthGranulation;
//Barre de menu avec les boutons //Barre de menu avec les boutons
@FXML @FXML
...@@ -89,20 +103,21 @@ public class FXMLVueController implements Initializable, Observer { ...@@ -89,20 +103,21 @@ public class FXMLVueController implements Initializable, Observer {
private boolean alert; private boolean alert;
private boolean isConnected = false; private boolean isConnected = false;
private BluetoothManager bluetoothManager; private BluetoothManager bluetoothManager;
/** /**
* Initializes the controller class. * Initializes the controller class.
*/ */
@Override @Override
public void initialize(URL url, ResourceBundle rb) { public void initialize(URL url, ResourceBundle rb) {
bluetoothManager = new BluetoothManager(this); //bluetoothManager = new BluetoothManager(this);
alert = false; alert = false;
//Put the gridPane Accueil visible //Put the gridPane Accueil visible
accueil.setVisible(true);
currentGridPane = accueil; currentGridPane = accueil;
currentButton = buttonAccueil; currentButton = buttonAccueil;
currentButton.setStyle("-fx-background-color: #7fca5eff"); openPage(accueil, buttonAccueil);
//Only allow integers as a value for the seuil //Only allow integers as a value for the seuil
seuil.textProperty().addListener(new ChangeListener<String>() { seuil.textProperty().addListener(new ChangeListener<String>() {
...@@ -130,41 +145,20 @@ public class FXMLVueController implements Initializable, Observer { ...@@ -130,41 +145,20 @@ public class FXMLVueController implements Initializable, Observer {
else if(alert){ else if(alert){
changeImagePlante(false); changeImagePlante(false);
} }
}
}
}); });
//Graph
axisYGraph.setLabel("données");
axisXGraph.setLabel("temps");
XYChart.Series serieLine = new XYChart.Series();
serieLine.getData().add(new XYChart.Data<>(14+"", 12));
graph.getData().add(serieLine);
graph.setLegendVisible(false);
} }
/**
* Change the page for the accueil page when clicking on accueil button
* @param event
*/
@FXML
private void clickAccueil(ActionEvent event) {
currentGridPane.setVisible(false);
accueil.setVisible(true);
currentGridPane = accueil;
currentButton.setStyle("-fx-background-color: #d5d5d5ff");
currentButton = buttonAccueil;
currentButton.setStyle("-fx-background-color: #7fca5eff");
}
/**
* Change the page for the configuration page when clicking on configuration button
* @param event
*/
@FXML
private void clickConfig(ActionEvent event) {
currentGridPane.setVisible(false);
configuration.setVisible(true);
currentGridPane = configuration;
currentButton.setStyle("-fx-background-color: #d5d5d5ff");
currentButton = buttonConfig;
currentButton.setStyle("-fx-background-color: #7fca5eff");
}
/** /**
* Change the text for activate or desactivate according to the checkbox * Change the text for activate or desactivate according to the checkbox
* @param event * @param event
...@@ -183,7 +177,6 @@ public class FXMLVueController implements Initializable, Observer { ...@@ -183,7 +177,6 @@ public class FXMLVueController implements Initializable, Observer {
*/ */
@FXML @FXML
private void clickActivationBluetooth(ActionEvent event) { private void clickActivationBluetooth(ActionEvent event) {
if(!this.isConnected){ if(!this.isConnected){
isConnected = bluetoothManager.launch(); isConnected = bluetoothManager.launch();
} }
...@@ -227,17 +220,41 @@ public class FXMLVueController implements Initializable, Observer { ...@@ -227,17 +220,41 @@ public class FXMLVueController implements Initializable, Observer {
} }
} }
/** /**
* Change the page for the grah page when clicking on data button * Change the page for the grah page when clicking on data button
* @param event * @param event
*/ */
@FXML @FXML
private void clickData(ActionEvent event) { private void clickData(ActionEvent event) {
openPage(data, buttonData);
}
/**
* Change the page for the accueil page when clicking on accueil button
* @param event
*/
@FXML
private void clickAccueil(ActionEvent event) {
openPage(accueil, buttonAccueil);
}
/**
* Change the page for the configuration page when clicking on configuration button
* @param event
*/
@FXML
private void clickConfig(ActionEvent event) {
openPage(configuration, buttonConfig);
}
private void openPage(GridPane open, Button justClicked){
currentGridPane.setVisible(false); currentGridPane.setVisible(false);
data.setVisible(true); open.setVisible(true);
currentGridPane = data; currentGridPane = open;
currentButton.setStyle("-fx-background-color: #d5d5d5ff"); currentButton.setStyle("-fx-background-color: #d5d5d5ff");
currentButton = buttonData; currentButton = justClicked;
currentButton.setStyle("-fx-background-color: #7fca5eff"); currentButton.setStyle("-fx-background-color: #7fca5eff");
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment