use of com.sun.javafx.charts.Legend in project Gargoyle by callakrsos.
the class AttachedTextValuePieChart method layoutChartChildren.
/* (non-Javadoc)
* @see javafx.scene.chart.PieChart#layoutChartChildren(double, double, double, double)
*/
@Override
protected void layoutChartChildren(double top, double left, double contentWidth, double contentHeight) {
if (getLabelsVisible()) {
getData().forEach(d -> {
if (tooltipConverter != null || customAction != null) {
d.getNode().lookupAll(".chart-pie").stream().forEach(v -> {
if (tooltipConverter != null)
FxUtil.installTooltip(v, tooltipConverter.toString(d));
if (customAction != null) {
customAction.accept(d, v);
}
});
}
if (labelConverter != null) {
Optional<Node> opTextNode = this.lookupAll(".chart-pie-label").stream().filter(n -> n instanceof Text && ((Text) n).getText().contains(d.getName())).findAny();
if (opTextNode.isPresent()) {
Text text = (Text) opTextNode.get();
text.setText(labelConverter.toString(d));
}
}
});
// Legend legend = (Legend) getLegend();
// legend.getItems().forEach(item->{
//
// item.
//
// });
// if (isLegendVisible() && seriesLegendLabelCustomAction != null) {
// this.lookupAll(".chart-legend-item").stream().forEach(v -> {
// System.out.println(v);
// });
// }
}
super.layoutChartChildren(top, left, contentWidth, contentHeight);
}
Aggregations