kauron/estraba
Archived
1
0
Fork 0

multiple series on mapchart

This commit is contained in:
Jesús Vélez Palacios 2016-05-25 11:46:14 +02:00
parent 5c09e8b074
commit 08b919f131
2 changed files with 18 additions and 10 deletions

View file

@ -45,6 +45,7 @@ import javafx.scene.Scene;
import javafx.scene.chart.AreaChart; import javafx.scene.chart.AreaChart;
import javafx.scene.chart.LineChart; import javafx.scene.chart.LineChart;
import javafx.scene.chart.PieChart; import javafx.scene.chart.PieChart;
import javafx.scene.chart.XYChart;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import javafx.scene.image.Image; import javafx.scene.image.Image;
@ -120,7 +121,6 @@ public class DashboardController implements Initializable, MapComponentInitializ
@FXML @FXML
private void toggleChart(MouseEvent e) { private void toggleChart(MouseEvent e) {
System.out.println("hi");
for (Node n : ((Node) e.getSource()).getParent().getChildrenUnmodifiable()) for (Node n : ((Node) e.getSource()).getParent().getChildrenUnmodifiable())
n.setVisible(!n.isVisible()); n.setVisible(!n.isVisible());
} }
@ -139,21 +139,27 @@ public class DashboardController implements Initializable, MapComponentInitializ
} }
@FXML @FXML
private void onMapButton(ActionEvent event){ private void onMapButton(ActionEvent event) {
switch (((JFXButton)event.getSource()).getId()) { XYChart.Series<Double, Double> data = elevationChart.getData().get(0);
switch (((JFXButton) event.getSource()).getId()) {
case "elevationButton": case "elevationButton":
mapChart.setData(elevationChart.getData()); data = elevationChart.getData().get(0);
break; break;
case "speedButton": case "speedButton":
mapChart.setData(speedChart.getData()); data = speedChart.getData().get(0);
break; break;
case "hrButton": case "hrButton":
mapChart.setData(hrChart.getData()); data = hrChart.getData().get(0);
break; break;
case "cadenceButton": case "cadenceButton":
mapChart.setData(cadenceChart.getData()); data = cadenceChart.getData().get(0);
break; break;
} }
if (mapChart.getData().contains(data))
mapChart.getData().remove(data);
else mapChart.getData().add(data);
} }
private String randomMotivation() { private String randomMotivation() {

View file

@ -58,7 +58,7 @@
<VBox.margin> <VBox.margin>
<Insets /> <Insets />
</VBox.margin> </VBox.margin>
<VBox minHeight="360.0" minWidth="300.0" prefHeight="300.0"> <VBox minHeight="360.0" minWidth="300.0" prefHeight="300.0" HBox.hgrow="ALWAYS">
<HBox.margin> <HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin> </HBox.margin>
@ -204,9 +204,11 @@
</VBox> </VBox>
</HBox> </HBox>
</VBox> </VBox>
<PieChart fx:id="zoneChart" labelsVisible="false" legendVisible="true" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" prefWidth="360.0" startAngle="90"> <PieChart fx:id="zoneChart" labelsVisible="false" legendVisible="true" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="300.0" prefWidth="360.0" startAngle="90" HBox.hgrow="ALWAYS">
</PieChart> </PieChart>
<VBox layoutX="15.0" layoutY="15.0" minHeight="360.0" minWidth="300.0" prefHeight="300.0"> <VBox layoutX="15.0" layoutY="15.0" minHeight="360.0" minWidth="300.0" prefHeight="300.0"
HBox.hgrow="ALWAYS">
<HBox alignment="CENTER" layoutX="10.0" layoutY="10.0" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="200.0" HBox.hgrow="ALWAYS" VBox.vgrow="ALWAYS"> <HBox alignment="CENTER" layoutX="10.0" layoutY="10.0" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="200.0" HBox.hgrow="ALWAYS" VBox.vgrow="ALWAYS">
<VBox alignment="CENTER" HBox.hgrow="ALWAYS"> <VBox alignment="CENTER" HBox.hgrow="ALWAYS">
<Label fx:id="valueDate" alignment="CENTER" layoutX="10.0" layoutY="97.0" maxWidth="1.7976931348623157E308"> <Label fx:id="valueDate" alignment="CENTER" layoutX="10.0" layoutY="97.0" maxWidth="1.7976931348623157E308">