use of eu.hansolo.tilesfx.chart.RadarChart in project tilesfx by HanSolo.
the class RadarChartTileSkin method initGraphics.
// ******************** Initialization ************************************
@Override
protected void initGraphics() {
super.initGraphics();
radarChart = new RadarChart(tile.getChartData());
radarChart.setMaxValue(tile.getMaxValue());
radarChart.setUnit(tile.getUnit());
radarChart.setLegendVisible(true);
radarChart.setThresholdVisible(tile.isThresholdVisible());
radarChart.setMode(tile.getRadarChartMode());
radarChart.setGridColor(tile.getChartGridColor());
radarChart.setChartTextColor(tile.getTextColor());
radarChart.setThresholdColor(tile.getThresholdColor());
radarChart.setGradientStops(tile.getGradientStops());
chartEventListener = e -> radarChart.redraw();
tile.getChartData().forEach(chartData -> chartData.addChartDataEventListener(chartEventListener));
chartDataListener = c -> {
while (c.next()) {
if (c.wasAdded()) {
c.getAddedSubList().forEach(addedItem -> addedItem.addChartDataEventListener(chartEventListener));
} else if (c.wasRemoved()) {
c.getRemoved().forEach(removedItem -> removedItem.removeChartDataEventListener(chartEventListener));
}
}
radarChart.redraw();
};
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
text = new Text(tile.getText());
text.setFill(tile.getTextColor());
Helper.enableNode(text, tile.isTextVisible());
getPane().getChildren().addAll(titleText, radarChart, text);
}
Aggregations