Skip to content
Snippets Groups Projects
Commit 10c641ac authored by Eilert Tunheim's avatar Eilert Tunheim
Browse files

Merge branch 'Eilerts_branch' into 'master'

Added printGraphs function, should be working correctly, but think after 8...

See merge request mesji/bacheloroppgave_2022!47
parents ea9193d9 44b3fa60
No related branches found
No related tags found
No related merge requests found
Showing
with 621 additions and 106 deletions
......@@ -10,3 +10,4 @@
/doc/
/contacts.log
/addressbook.dat
/src/main/resources/com.application/sf-drying-optimization-1e234ad2b0f4.json
......@@ -45,6 +45,7 @@
<artifactId>jblas</artifactId>
<version>1.2.4</version>
</dependency>
</dependencies>
<properties>
......
......@@ -27,10 +27,13 @@ public final class Constants {
public static int NUMBER_OF_PERIODS = 2;
// Number of seconds to wait before updating live data, in seconds
public static int NUMBER_OF_SECONDS_LIVE_DATA = 10;
public static int NUMBER_OF_SECONDS_LIVE_DATA = 60;
// Confidence interval
public static final double CONFIDENCE_INTERVAL = 0.80;
// Non linear regression
public static final double ADJUST_REGRESSION = 5.5;
public static final double ADJUST_REGRESSION = 5.0;
// Current sawmill settings;
public static final String PROJECT_ID = "sf-drying-optimization";
......
package com.application.DB;
import com.application.GUI.NotificationPopUp;
import com.google.cloud.bigquery.*;
import org.joda.time.DateTime;
......@@ -28,7 +29,7 @@ public class DB {
//getName();
//getZeroPointDate();
//System.out.println(setInputParameters());
getNoOfChambers();
//getNoOfChambers();
}
......
package com.application.GUI;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class NotificationPopUp {
public static void displayNotificationWindow(String message){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Notification window");
Label messageLabel = new Label();
messageLabel.setText(message);
Button close = new Button("Close");
close.setOnAction(event -> window.close());
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.getChildren().addAll(messageLabel,close);
Scene scene = new Scene(layout, 300, 200);
scene.getStylesheets().add(InputPopUpWindow.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
}
}
......@@ -8,6 +8,7 @@ import com.application.GUI.LineChartFunctionality;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.chart.LineChart;
import javafx.scene.control.*;
import javafx.scene.image.Image;
......@@ -16,6 +17,7 @@ import javafx.scene.layout.*;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javax.naming.LimitExceededException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
......@@ -24,7 +26,7 @@ import java.util.logging.Logger;
import static com.application.DB.Constants.*;
import static com.application.DB.HelpingFunctions.*;
import static com.application.DB.HelpingFunctions.isLoadedData;
import static com.application.GUI.LineChartFunctionality.getDataPoints;
import static com.application.GUI.LineChartFunctionality.getDataPointsXAxis;
import static com.application.GUI.LineChartFunctionality.getLiveData;
import static java.util.logging.Level.SEVERE;
......@@ -36,11 +38,13 @@ import static java.util.logging.Level.SEVERE;
*/
public class Main extends Application {
private LineChartFunctionality lineChartFunctionality;
private BorderPane topBar;
private HBox logoBar;
private VBox sideBar;
private MenuBar menuBar;
private LineChartFunctionality lineChartFunctionality;
private HBox bottomBar;
private static TextField treeSpeciesText;
private static TextField dimensionsText;
......@@ -68,11 +72,12 @@ public class Main extends Application {
super.init();
// Initializing variables
this.lineChartFunctionality = new LineChartFunctionality();
this.topBar = new BorderPane();
this.logoBar = new HBox();
this.sideBar = new VBox();
this.menuBar = new MenuBar();
this.lineChartFunctionality = new LineChartFunctionality();
this.bottomBar = new HBox();
}
/**
......@@ -90,6 +95,7 @@ public class Main extends Application {
this.sideBar = createSideBar();
this.logoBar = createLogoBar();
LineChart<String, Number> lineChart = LineChartFunctionality.getLineChart();
//Set id's to connect to css stylesheet
......@@ -97,6 +103,8 @@ public class Main extends Application {
this.logoBar.setId("logoBar");
this.menuBar.setId("menuBar");
this.sideBar.setId("sideBar");
this.bottomBar = createBottomBar();
this.bottomBar.setId("bottomBar");
lineChart.setId("lineChart");
......@@ -111,6 +119,7 @@ public class Main extends Application {
root.setTop(this.topBar);
root.setLeft(this.sideBar);
root.setCenter(lineChart);
root.setBottom(this.bottomBar);
VBox.setVgrow(this.logoBar, Priority.ALWAYS);
......@@ -251,7 +260,7 @@ public class Main extends Application {
rpi.setProgress(progress);
});
progress = getLiveData().size()/getDataPoints();
progress = getLiveData().size()/ getDataPointsXAxis()*100;
if (progress > 100) {
break;
......@@ -305,6 +314,71 @@ public class Main extends Application {
return new HBox(imageViewM, region1, imageViewTitle, region2);
}
private HBox createBottomBar(){
HBox hBox = new HBox();
Label liveDataText = new Label("View Live Data");
CheckBox liveDataBox = new CheckBox();
liveDataBox.setSelected(true);
liveDataBox.setOnAction(event -> {
if(liveDataBox.isSelected()){
LineChartFunctionality.setPrintLiveData(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintLiveData(false);
LineChartFunctionality.printGraphs();
}
});
Label regressionText = new Label("View Regression");
CheckBox regressionBox = new CheckBox();
regressionBox.setSelected(true);
regressionBox.setOnAction(event -> {
if(regressionBox.isSelected()){
LineChartFunctionality.setPrintRegression(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintRegression(false);
LineChartFunctionality.printGraphs();
}
});
Label regressionConfidenceIntervalText = new Label("View Regression Shadow");
CheckBox regressionConfidenceIntervalBox = new CheckBox();
regressionConfidenceIntervalBox.setSelected(true);
regressionConfidenceIntervalBox.setOnAction(event -> {
if(regressionConfidenceIntervalBox.isSelected()){
LineChartFunctionality.setPrintRegressionConfidenceInterval(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintRegressionConfidenceInterval(false);
LineChartFunctionality.printGraphs();
}
});
Label previousText = new Label("View Previous Data");
CheckBox previousBox = new CheckBox();
previousBox.setSelected(true);
previousBox.setOnAction(event -> {
if(previousBox.isSelected()){
LineChartFunctionality.setPrintPreviousData(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintPreviousData(false);
LineChartFunctionality.printGraphs();
}
});
hBox.getChildren().addAll(liveDataText, liveDataBox, regressionText, regressionBox, regressionConfidenceIntervalText, regressionConfidenceIntervalBox, previousText, previousBox);
hBox.setAlignment(Pos.CENTER_RIGHT);
hBox.setSpacing(5);
return hBox;
}
......@@ -327,6 +401,10 @@ public class Main extends Application {
public static void setTimeLeftText(String moistureGoalText) {
Main.timeLeftText.setText(moistureGoalText);
}
public LineChartFunctionality getLineChartFunctionality() {
return lineChartFunctionality;
}
}
......@@ -23,6 +23,7 @@
*/
#sideBar {
-fx-pref-width: 250;
-fx-pref-height: infinity;
}
#sideBarLabel {
......@@ -74,6 +75,22 @@
-fx-text-fill: white;
}
/*
BottomBar styling
*/
#bottomBar {
-fx-pref-width: infinity;
-fx-pref-height: 50;
}
#bottomBarButtons {
-fx-alignment: center-right;
-fx-tile-alignment: center-right;
-fx-translate-x: -5;
-fx-pref-width: 150;
-fx-pref-height: 25;
}
/*
Input popup window
*/
......
......@@ -4,20 +4,25 @@
-fx-effect: null;
}
.chart-earlier-data-line {
-fx-stroke-width: 1px;
-fx-effect: null;
}
.default-color0.chart-series-line{-fx-stroke: red; -fx-opacity: 1.0}
.default-color1.chart-series-line{-fx-stroke: green; -fx-opacity: 1.0}
.default-color2.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color3.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color4.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color5.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color6.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color7.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color2.chart-earlier-data-line{-fx-stroke: black; -fx-opacity: 0.1}
.default-color3.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color4.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color5.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color6.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color7.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color0.chart-line-symbol{-fx-background-color: red,red;}
.default-color1.chart-line-symbol{-fx-background-color: green,green;}
.default-color2.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color3.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color4.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color5.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color6.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color7.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color2.chart-line-symbol{-fx-background-color: black,white;}
.default-color3.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color4.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color5.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color6.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color7.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
......@@ -23,6 +23,7 @@
*/
#sideBar {
-fx-pref-width: 250;
-fx-pref-height: infinity;
}
#sideBarLabel {
......@@ -74,6 +75,22 @@
-fx-text-fill: white;
}
/*
BottomBar styling
*/
#bottomBar {
-fx-pref-width: infinity;
-fx-pref-height: 50;
}
#bottomBarButtons {
-fx-alignment: center-right;
-fx-tile-alignment: center-right;
-fx-translate-x: -5;
-fx-pref-width: 150;
-fx-pref-height: 25;
}
/*
Input popup window
*/
......
......@@ -4,20 +4,25 @@
-fx-effect: null;
}
.default-color0.chart-series-line{-fx-stroke: green; -fx-opacity: 1.0}
.default-color1.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color2.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color3.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color4.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color5.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color6.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color7.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.chart-earlier-data-line {
-fx-stroke-width: 1px;
-fx-effect: null;
}
.default-color0.chart-series-line{-fx-stroke: red; -fx-opacity: 1.0}
.default-color1.chart-series-line{-fx-stroke: green; -fx-opacity: 1.0}
.default-color2.chart-earlier-data-line{-fx-stroke: black; -fx-opacity: 0.1}
.default-color3.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color4.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color5.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color6.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color7.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color0.chart-line-symbol{-fx-background-color: green,green;}
.default-color1.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color2.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color3.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color4.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color5.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color6.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color7.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
.default-color0.chart-line-symbol{-fx-background-color: red,red;}
.default-color1.chart-line-symbol{-fx-background-color: green,green;}
.default-color2.chart-line-symbol{-fx-background-color: black,white;}
.default-color3.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color4.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color5.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color6.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color7.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
File added
No preview for this file type
No preview for this file type
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