added cumulative check box

This commit is contained in:
aj 2019-05-23 11:21:54 +01:00
parent c35be3b731
commit 4ff50048e0
3 changed files with 33 additions and 19 deletions

View File

@ -13,6 +13,7 @@ import javafx.scene.chart.AreaChart;
import javafx.scene.chart.XYChart;
import javafx.scene.chart.XYChart.Data;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.SplitPane;
import javafx.scene.layout.GridPane;
@ -45,6 +46,9 @@ public class ScrobblesViewPaneController {
@FXML
private Button buttonTracksAlbums;
@FXML
private CheckBox checkBoxCumulative;
private FMObj obj;
private LocalDate firstDate;
@ -251,7 +255,12 @@ public class ScrobblesViewPaneController {
for (MonthScrobbles month : calendar.getMonthScrobbles()) {
cumulative += month.getCount();
series.getData().add(new Data<String, Integer>(month.toString(), cumulative));
if (checkBoxCumulative.isSelected()) {
series.getData().add(new Data<String, Integer>(month.toString(), cumulative));
}else {
series.getData().add(new Data<String, Integer>(month.toString(), month.getCount()));
}
}
areaChart.getData().add(series);

View File

@ -105,6 +105,10 @@
-fx-background-color: #4D4D4D;
}
.check-box {
-fx-text-fill: white;
}
.label {
-fx-text-fill: white;
}

View File

@ -8,7 +8,7 @@
<?import javafx.scene.paint.*?>
<?import javafx.scene.text.*?>
<AnchorPane prefHeight="386.0" prefWidth="512.0" stylesheets="@../styles/mainPane.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sarsoo.fmframework.fx.controller.ScrobblesViewPaneController">
<AnchorPane prefHeight="508.0" prefWidth="783.0" stylesheets="@../styles/mainPane.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sarsoo.fmframework.fx.controller.ScrobblesViewPaneController">
<children>
<SplitPane fx:id="splitPane" dividerPositions="0.4909819639278557" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
@ -43,6 +43,7 @@
<Button fx:id="buttonTracks" mnemonicParsing="false" onAction="#handleShowTracks" text="tracks" />
<Button fx:id="buttonAlbums" mnemonicParsing="false" onAction="#handleShowAlbums" text="albums" />
<Button fx:id="buttonTracksAlbums" mnemonicParsing="false" onAction="#handleShowTracksByAlbums" text="tracks &amp; albums" />
<CheckBox fx:id="checkBoxCumulative" mnemonicParsing="false" selected="true" text="cumulative" />
</items>
</ToolBar>
</bottom>