From 1ee5098172b1f684bfc31db2f98dd644f5c60acd Mon Sep 17 00:00:00 2001 From: aj Date: Tue, 15 Jan 2019 13:33:14 +0000 Subject: [PATCH] updating chart ui - graph dates, separate menu --- .../sarsoo/fmframework/fx/controller/ControllerMain.java | 7 +++++++ .../fx/controller/ScrobbleChartPaneController.java | 6 ++++-- src/main/resources/sarsoo/fmframework/fx/ui/main.fxml | 8 ++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/sarsoo/fmframework/fx/controller/ControllerMain.java b/src/main/java/sarsoo/fmframework/fx/controller/ControllerMain.java index 8fa5daf..ee618ce 100644 --- a/src/main/java/sarsoo/fmframework/fx/controller/ControllerMain.java +++ b/src/main/java/sarsoo/fmframework/fx/controller/ControllerMain.java @@ -185,6 +185,10 @@ public class ControllerMain { JSONArray hierarchiesJsonArray = rootParsedJsonObj.getJSONObject("genrehierarchy") .getJSONArray("genres"); + + if(hierarchiesJsonArray.length() > 0) { + menuPieChart.setVisible(true); + } int counter; for (counter = 0; counter < hierarchiesJsonArray.length(); counter++) { @@ -667,6 +671,9 @@ public class ControllerMain { @FXML private Menu menuPieChart; + + @FXML + private Menu menuChart; // // @FXML // private PieChart pieChartRap; diff --git a/src/main/java/sarsoo/fmframework/fx/controller/ScrobbleChartPaneController.java b/src/main/java/sarsoo/fmframework/fx/controller/ScrobbleChartPaneController.java index 1899375..a57ae72 100644 --- a/src/main/java/sarsoo/fmframework/fx/controller/ScrobbleChartPaneController.java +++ b/src/main/java/sarsoo/fmframework/fx/controller/ScrobbleChartPaneController.java @@ -2,6 +2,7 @@ package sarsoo.fmframework.fx.controller; import java.io.IOException; import java.text.NumberFormat; +import java.time.LocalDate; import java.util.Locale; import java.util.concurrent.CountDownLatch; @@ -38,7 +39,7 @@ public class ScrobbleChartPaneController { private Button buttonRefresh; @FXML - private ChoiceBox dropDownTimeRange; + private ChoiceBox dropDownTimeRange; @FXML private LineChart lineChartScrobbles; @@ -99,7 +100,8 @@ public class ScrobbleChartPaneController { for (counter = 0; counter < dayLength; counter++) { int scrobble = net.getScrobbleCountByDeltaDay(dayLength - counter - 1); // System.out.println(scrobble); - series.getData().add(new XYChart.Data(String.valueOf(dayLength - counter), scrobble)); +// series.getData().add(new XYChart.Data(String.valueOf(dayLength - counter), scrobble)); + series.getData().add(new XYChart.Data(LocalDate.now().minusDays(dayLength - counter - 1).toString(), scrobble)); } final CountDownLatch latch = new CountDownLatch(1); diff --git a/src/main/resources/sarsoo/fmframework/fx/ui/main.fxml b/src/main/resources/sarsoo/fmframework/fx/ui/main.fxml index 4cf0dbb..150614c 100644 --- a/src/main/resources/sarsoo/fmframework/fx/ui/main.fxml +++ b/src/main/resources/sarsoo/fmframework/fx/ui/main.fxml @@ -14,7 +14,6 @@ - @@ -24,12 +23,17 @@ + + + + + + -