updating chart ui - graph dates, separate menu

This commit is contained in:
aj 2019-01-15 13:33:14 +00:00
parent 11836840bf
commit 1ee5098172
3 changed files with 17 additions and 4 deletions

View File

@ -185,6 +185,10 @@ public class ControllerMain {
JSONArray hierarchiesJsonArray = rootParsedJsonObj.getJSONObject("genrehierarchy") JSONArray hierarchiesJsonArray = rootParsedJsonObj.getJSONObject("genrehierarchy")
.getJSONArray("genres"); .getJSONArray("genres");
if(hierarchiesJsonArray.length() > 0) {
menuPieChart.setVisible(true);
}
int counter; int counter;
for (counter = 0; counter < hierarchiesJsonArray.length(); counter++) { for (counter = 0; counter < hierarchiesJsonArray.length(); counter++) {
@ -667,6 +671,9 @@ public class ControllerMain {
@FXML @FXML
private Menu menuPieChart; private Menu menuPieChart;
@FXML
private Menu menuChart;
// //
// @FXML // @FXML
// private PieChart pieChartRap; // private PieChart pieChartRap;

View File

@ -2,6 +2,7 @@ package sarsoo.fmframework.fx.controller;
import java.io.IOException; import java.io.IOException;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -38,7 +39,7 @@ public class ScrobbleChartPaneController {
private Button buttonRefresh; private Button buttonRefresh;
@FXML @FXML
private ChoiceBox dropDownTimeRange; private ChoiceBox<String> dropDownTimeRange;
@FXML @FXML
private LineChart lineChartScrobbles; private LineChart lineChartScrobbles;
@ -99,7 +100,8 @@ public class ScrobbleChartPaneController {
for (counter = 0; counter < dayLength; counter++) { for (counter = 0; counter < dayLength; counter++) {
int scrobble = net.getScrobbleCountByDeltaDay(dayLength - counter - 1); int scrobble = net.getScrobbleCountByDeltaDay(dayLength - counter - 1);
// System.out.println(scrobble); // 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); final CountDownLatch latch = new CountDownLatch(1);

View File

@ -14,7 +14,6 @@
<items> <items>
<MenuItem fx:id="menuItemCreateList" mnemonicParsing="false" onAction="#handleCreateList" text="new list" /> <MenuItem fx:id="menuItemCreateList" mnemonicParsing="false" onAction="#handleCreateList" text="new list" />
<MenuItem fx:id="menuItemListEdit" mnemonicParsing="false" onAction="#handleListEdit" text="open list" /> <MenuItem fx:id="menuItemListEdit" mnemonicParsing="false" onAction="#handleListEdit" text="open list" />
<Menu fx:id="menuPieChart" mnemonicParsing="false" text="open pie chart" />
</items> </items>
</Menu> </Menu>
<Menu fx:id="menuLookup" mnemonicParsing="false" text="lookup"> <Menu fx:id="menuLookup" mnemonicParsing="false" text="lookup">
@ -24,12 +23,17 @@
<MenuItem fx:id="menuItemArtist" mnemonicParsing="false" onAction="#handleLookupArtist" text="artist" /> <MenuItem fx:id="menuItemArtist" mnemonicParsing="false" onAction="#handleLookupArtist" text="artist" />
</items> </items>
</Menu> </Menu>
<Menu fx:id="menuChart" mnemonicParsing="false" text="chart">
<items>
<MenuItem fx:id="menuItemScrobbleChart" mnemonicParsing="false" onAction="#handleScrobbleChart" text="daily scrobbles" />
<Menu fx:id="menuPieChart" mnemonicParsing="false" text="load pie chart" visible="false" />
</items>
</Menu>
<Menu fx:id="menuTag" mnemonicParsing="false" text="tags" /> <Menu fx:id="menuTag" mnemonicParsing="false" text="tags" />
<Menu fx:id="menuUtil" mnemonicParsing="false" text="util"> <Menu fx:id="menuUtil" mnemonicParsing="false" text="util">
<items> <items>
<MenuItem fx:id="menuItemScrobble" mnemonicParsing="false" onAction="#handleScrobble" text="scrobble" /> <MenuItem fx:id="menuItemScrobble" mnemonicParsing="false" onAction="#handleScrobble" text="scrobble" />
<MenuItem fx:id="menuItemCurrentTrack" mnemonicParsing="false" onAction="#handleCurrentTrack" text="current track" /> <MenuItem fx:id="menuItemCurrentTrack" mnemonicParsing="false" onAction="#handleCurrentTrack" text="current track" />
<MenuItem fx:id="menuItemScrobbleChart" mnemonicParsing="false" onAction="#handleScrobbleChart" text="scrobble chart" />
<MenuItem fx:id="menuItemOpenConsole" mnemonicParsing="false" onAction="#handleOpenConsole" text="open console" /> <MenuItem fx:id="menuItemOpenConsole" mnemonicParsing="false" onAction="#handleOpenConsole" text="open console" />
<MenuItem mnemonicParsing="false" onAction="#handleChangeUsername" text="set username" /> <MenuItem mnemonicParsing="false" onAction="#handleChangeUsername" text="set username" />
</items> </items>