pirSeries = new XYChart.Series<>();
microwaveSeries = new XYChart.Series<>();
laserSeries = new XYChart.Series<>();
readTripsSeries = new XYChart.Series<>();
final SimpleCalendar simpleCalender = new SimpleCalendar();
simpleCalender.setMaxSize(100d, 20d);
final TextField dateField = new TextField(new SimpleDateFormat(
"MM/dd/yyyy").format(simpleCalender.dateProperty().get()));
dateField.setMaxSize(simpleCalender.getMaxWidth(),
simpleCalender.getMaxHeight());
dateField.setEditable(false);
dateField.setDisable(true);
simpleCalender.dateProperty().addListener(new ChangeListener<Date>() {
@Override
public void changed(final ObservableValue<? extends Date> ov,
final Date oldDate, final Date newDate) {
dateField.setText(new SimpleDateFormat("MM/dd/yyyy")
.format(newDate));
final Calendar cal = Calendar.getInstance();
cal.setTime(newDate);
populateData(chart, cal);
}
});
final HBox dateBox = new HBox();
dateBox.setAlignment(Pos.BOTTOM_RIGHT);
dateBox.getChildren().addAll(dateField, simpleCalender);
setPadding(new Insets(10d));
setAlignment(Pos.BOTTOM_RIGHT);
getChildren().addAll(chart, dateBox);
sonarSeries.setName(RS.rbLabel(KEY.LABEL_GRAPH_SERIES_ALARM_SONAR));
pirSeries.setName(RS.rbLabel(KEY.LABEL_GRAPH_SERIES_ALARM_PIR));
microwaveSeries.setName(RS
.rbLabel(KEY.LABEL_GRAPH_SERIES_ALARM_MICROWAVE));
laserSeries.setName(RS.rbLabel(KEY.LABEL_GRAPH_SERIES_ALARM_LASER));
readTripsSeries.setName(RS
.rbLabel(KEY.LABEL_GRAPH_SERIES_ACTIVITY_READS));
final Calendar cal = Calendar.getInstance();
cal.setTime(simpleCalender.dateProperty().get());
populateData(chart, cal);
}