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

Added CSS file for graph

parent ee4980af
No related branches found
No related tags found
No related merge requests found
Showing
with 79 additions and 200 deletions
......@@ -27,6 +27,9 @@ public final class Constants {
// Number of wanted drying periods
public static int NUMBER_OF_PERIODS = 1;
// Non linear regression
public static final double ADJUST_REGRESSION = 5.5;
// Database ID/name
public static final String PROJECT_ID = "sf-drying-optimization";
......
......@@ -13,6 +13,9 @@ import org.apache.commons.math3.stat.regression.SimpleRegression;
import java.lang.reflect.Array;
import java.util.*;
import static com.application.DB.Constants.ADJUST_REGRESSION;
//import static com.application.DB.DB.
public class LineChartFunctionality {
private static LineChart<String, Number> lineChart;
......@@ -42,6 +45,8 @@ public class LineChartFunctionality {
public static void updateLineChart(XYChart.Series<String, Number> series) {
lineChart.getData().add(series);
series.getNode().setId("dataGraphs");
lineChart.getStylesheets().add(LineChartFunctionality.class.getResource("/com.application/GUI/graphStyles.css").toExternalForm());
}
public static void clearLineChart() {
......@@ -117,7 +122,7 @@ public class LineChartFunctionality {
index++;
}
//allSeries.add(newSeries);
updateLineChart(newSeries);
//updateLineChart(newSeries);
//lineChart.setOpacity(1);
}
......@@ -216,6 +221,26 @@ public class LineChartFunctionality {
for (Map.Entry<Integer, Map<String, Number>> entryKwh : userInput.entrySet()) {
//System.out.println(data.size());
XYChart.Series<String, Number> newSeries = new XYChart.Series<String, Number>();
index = 0;
for (Object entryData : entryKwh.getValue().entrySet()) {
//System.out.println("data: \t"+entryData);
String entryString = entryData.toString();
Double kwhValue = Double.parseDouble(entryString.split("=")[1]);
// Connect the data to a series
newSeries.getData().add(new XYChart.Data<String, Number>(String.valueOf(index), kwhValue));
index++;
}
//allSeries.add(newSeries);
updateLineChart(newSeries);
//lineChart.setOpacity(1);
}
System.out.println("Get R: " + simpleRegression.getR());
System.out.println("Get getRSquare: " + simpleRegression.getRSquare());
......@@ -234,6 +259,8 @@ public class LineChartFunctionality {
return getLineChart();
}
......@@ -256,9 +283,10 @@ public class LineChartFunctionality {
//double p_t = ((beta*maxYValue)/(maxYValue+((beta-maxYValue)*Math.exp(-alpha*(yValue-maxYValue)))));
//double p_t = ((beta* y0)/(y0 +((beta- y0)*Math.exp(-alpha*j/n/(2*Math.PI)))))-y0; //Funker sånn halveis
double p_t = (((beta * y0))/(y0 +((beta- y0)*Math.exp(-alpha*j/n/(6.5)))))-y0; //Funker sånn halveis
//double p_t = (beta * y0)/(y0 + (beta - y0)*Math.exp(-intercept*(j/n)));
double p_t = (((beta * y0))/(y0 +((beta- y0)*Math.exp(-alpha*j/n/(ADJUST_REGRESSION)))))-y0; //Beste til nå
System.out.println("---------------------------");
System.out.println("y0: " + y0);
......
print("This line will be printed.")
print(locals())
\ No newline at end of file
.chart-series-line {
-fx-stroke-width: 7px;
-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}
.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);}
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.chart.CategoryAxis?>
<?import javafx.scene.chart.LineChart?>
<?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<left>
<VBox prefHeight="200.0" prefWidth="150.0" BorderPane.alignment="CENTER">
<children>
<Label prefHeight="17.0" prefWidth="150.0" text="Tree Species" />
<TextField />
<Label prefHeight="17.0" prefWidth="150.0" text="Width x Height" />
<TextField />
<Label prefHeight="17.0" prefWidth="150.0" text="Sawsett" />
<TextField />
<Label prefHeight="17.0" prefWidth="150.0" text="Desired moisture level" />
<TextField />
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="150.0" text="Finish" />
</children>
</VBox>
</left>
<center>
<LineChart BorderPane.alignment="CENTER">
<xAxis>
<CategoryAxis label="Time" side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis label="Kwh" side="LEFT" upperBound="25000.0">
<tickLabelFont>
<Font name="Arial" size="10.0" />
</tickLabelFont>
</NumberAxis>
</yAxis>
</LineChart>
</center>
<top>
<BorderPane prefHeight="80.0" prefWidth="700.0" BorderPane.alignment="CENTER">
<center>
<AnchorPane prefHeight="78.0" prefWidth="700.0" style="-fx-background-color: rgba(12, 76, 81, 1);" BorderPane.alignment="CENTER">
<children>
<BorderPane prefHeight="50.0" prefWidth="700.0">
<left>
<ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true" translateX="5.0" BorderPane.alignment="CENTER">
<image>
<Image url="@moelven_logo_m.png" />
</image>
</ImageView>
</left>
<center>
<ImageView fitHeight="30.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@moelven_logo_title.png" />
</image>
</ImageView>
</center>
</BorderPane>
</children>
</AnchorPane>
</center>
<top>
<MenuBar prefHeight="25.0" prefWidth="700.0" BorderPane.alignment="CENTER">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Delete" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
</top>
</BorderPane>
</top>
</BorderPane>
print("This line will be printed.")
print(locals())
\ No newline at end of file
.chart-series-line {
-fx-stroke-width: 7px;
-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}
.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);}
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.chart.CategoryAxis?>
<?import javafx.scene.chart.LineChart?>
<?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<left>
<VBox prefHeight="200.0" prefWidth="150.0" BorderPane.alignment="CENTER">
<children>
<Label prefHeight="17.0" prefWidth="150.0" text="Tree Species" />
<TextField />
<Label prefHeight="17.0" prefWidth="150.0" text="Width x Height" />
<TextField />
<Label prefHeight="17.0" prefWidth="150.0" text="Sawsett" />
<TextField />
<Label prefHeight="17.0" prefWidth="150.0" text="Desired moisture level" />
<TextField />
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="150.0" text="Finish" />
</children>
</VBox>
</left>
<center>
<LineChart BorderPane.alignment="CENTER">
<xAxis>
<CategoryAxis label="Time" side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis label="Kwh" side="LEFT" upperBound="25000.0">
<tickLabelFont>
<Font name="Arial" size="10.0" />
</tickLabelFont>
</NumberAxis>
</yAxis>
</LineChart>
</center>
<top>
<BorderPane prefHeight="80.0" prefWidth="700.0" BorderPane.alignment="CENTER">
<center>
<AnchorPane prefHeight="78.0" prefWidth="700.0" style="-fx-background-color: rgba(12, 76, 81, 1);" BorderPane.alignment="CENTER">
<children>
<BorderPane prefHeight="50.0" prefWidth="700.0">
<left>
<ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true" translateX="5.0" BorderPane.alignment="CENTER">
<image>
<Image url="@moelven_logo_m.png" />
</image>
</ImageView>
</left>
<center>
<ImageView fitHeight="30.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@moelven_logo_title.png" />
</image>
</ImageView>
</center>
</BorderPane>
</children>
</AnchorPane>
</center>
<top>
<MenuBar prefHeight="25.0" prefWidth="700.0" BorderPane.alignment="CENTER">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Delete" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
</top>
</BorderPane>
</top>
</BorderPane>
No preview for this file type
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.
Please register or to comment