use of javafx.scene.chart.BarChart in project Gargoyle by callakrsos.
the class ScmCommitComposite method scmHistoryWalk.
private void scmHistoryWalk() throws SVNException {
List<GagoyleDate> periodDaysByWeek = DateUtil.getPeriodDaysByWeek(supplier.getWeekSize());
Collection<SVNLogEntry> allLogs = supplier.getAllLogs();
// supplier.createStream(allLogs);
TreeMap<String, Long> dayOfMonths = allLogs.stream().collect(Collectors.groupingBy(v -> FxSVNHistoryDataSupplier.YYYYMMDD_EEE_PATTERN.format(v.getDate()), () -> new TreeMap<>(), Collectors.counting()));
Map<String, Long> dayOfWeeks = new LinkedHashMap<>();
//초기값 세팅. [중요한건 정렬순서를 유지해아하므로. 초기값을 넣어준것.]
for (GagoyleDate d : DateUtil.getPeriodDaysByWeek()) {
String eee = FxSVNHistoryDataSupplier.EEE_PATTERN.format(d.toDate());
dayOfWeeks.put(eee, new Long(0));
}
//실제값 add
dayOfWeeks.putAll(allLogs.stream().collect(Collectors.groupingBy(v -> FxSVNHistoryDataSupplier.EEE_PATTERN.format(v.getDate()), Collectors.counting())));
{
BarChart<String, Long> barChartDayOfMonth = getBarChartDayOfMonth();
ObservableList<Data<String, Long>> convert = convert(FxSVNHistoryDataSupplier.YYYYMMDD_EEE_PATTERN, periodDaysByWeek, dayOfMonths, true);
Series<String, Long> series = new Series<>(SERIES_LABEL, convert);
barChartDayOfMonth.getData().add(series);
}
{
LineChart<String, Long> lineChartDayOfWeek = getLineChartDayOfWeek();
ObservableList<Data<String, Long>> convert = convert(FxSVNHistoryDataSupplier.EEE_PATTERN, DateUtil.getPeriodDaysByWeek(), dayOfWeeks, false);
Series<String, Long> series = new Series<>(SERIES_LABEL, convert);
lineChartDayOfWeek.getData().add(series);
}
}
use of javafx.scene.chart.BarChart in project dolphin-platform by canoo.
the class GraphComponent method onUpdate.
private void onUpdate() {
getChildren().clear();
bindings.forEach(b -> b.unbind());
bindings.clear();
if (metadataSubscription != null) {
metadataSubscription.unsubscribe();
}
metadataSubscription = MetadataUtilities.addListenerToMetadata(data.get(), () -> {
onUpdate();
});
GraphDataBean currentBean = data.get();
if (currentBean != null) {
if (GraphType.PIE.equals(GraphMetadata.getGraphType(data.get()))) {
PieChart chart = new PieChart();
bindings.add(FXBinder.bind(chart.dataProperty().get()).to(currentBean.getValues(), valueBean -> {
PieChart.Data data = new PieChart.Data(valueBean.getName(), valueBean.getValue());
bindings.add(FXBinder.bind(data.nameProperty()).to(valueBean.nameProperty()));
bindings.add(FXBinder.bind(data.pieValueProperty()).to(valueBean.valueProperty()));
return data;
}));
getChildren().add(chart);
} else {
BarChart<String, Number> barChart = new BarChart<>(new CategoryAxis(), new NumberAxis());
XYChart.Series<String, Number> defaulSeries = new XYChart.Series<>();
barChart.getData().add(defaulSeries);
bindings.add(FXBinder.bind(defaulSeries.dataProperty().get()).to(currentBean.getValues(), valueBean -> {
XYChart.Data<String, Number> data = new XYChart.Data<>(valueBean.getName(), valueBean.getValue());
bindings.add(FXBinder.bind(data.XValueProperty()).to(valueBean.nameProperty()));
bindings.add(FXBinder.bind(data.YValueProperty()).to(valueBean.valueProperty()));
return data;
}));
getChildren().add(barChart);
}
}
}
use of javafx.scene.chart.BarChart in project jOOQ by jOOQ.
the class BarChartSample method chart.
private BarChart<String, Number> chart(TableField<CountriesRecord, ? extends Number> field, String title, String yAxisLabel) {
CategoryAxis xAxis = new CategoryAxis();
NumberAxis yAxis = new NumberAxis();
xAxis.setLabel("Country");
yAxis.setLabel(yAxisLabel);
BarChart<String, Number> bc = new BarChart<>(xAxis, yAxis);
bc.setTitle(title);
bc.setUserData(field);
return bc;
}
Aggregations