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

Good enough x-axis, not smooth, but best i could do...

parent 897b8e5b
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,6 @@ import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.shape.Line;
import java.text.SimpleDateFormat;
import java.util.Date;
......@@ -21,11 +20,12 @@ public class LineChartFunctionality {
xAxis = new CategoryAxis();
yAxis = new NumberAxis();
lineChart = new LineChart<>(xAxis, yAxis);
xAxis.setLabel("Date");
xAxis.setLabel("Hours");
xAxis.setAnimated(false);
yAxis.setLabel("Kwh");
yAxis.setAnimated(false);
lineChart.setTitle("Drying Processes");
lineChart.setCreateSymbols(false);
}
public static void setLineChart(LineChart<String, Number> lineChart) {
......@@ -44,7 +44,7 @@ public class LineChartFunctionality {
lineChart.getData().clear();
}
private static long findDifference(String start_date, String end_date) {
private static double findDifference(String start_date, String end_date) {
// Defining a simple date format
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -54,7 +54,7 @@ public class LineChartFunctionality {
Date dateEnd = dateFormat.parse(end_date);
// Finds the difference in millis
long differenceMillis = dateEnd.getTime() - dateStart.getTime();
double differenceMillis = dateEnd.getTime() - dateStart.getTime();
// Finds the difference in minutes
return (differenceMillis / (1000 * 60 )) % 60;
......@@ -95,7 +95,7 @@ public class LineChartFunctionality {
minutes += findDifference(previouseDate, currentDate);
hours = (minutes/60);
hours = minutes/60;
System.out.println(hours);
previouseDate = currentDate;
......
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