Search in sources :

Example 1 with RadarChart

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);
}
Also used : Tile(eu.hansolo.tilesfx.Tile) Text(javafx.scene.text.Text) ChartData(eu.hansolo.tilesfx.chart.ChartData) Fonts(eu.hansolo.tilesfx.fonts.Fonts) Helper(eu.hansolo.tilesfx.tools.Helper) ListChangeListener(javafx.collections.ListChangeListener) RadarChart(eu.hansolo.tilesfx.chart.RadarChart) Font(javafx.scene.text.Font) ChartDataEventListener(eu.hansolo.tilesfx.events.ChartDataEventListener) RadarChart(eu.hansolo.tilesfx.chart.RadarChart) Text(javafx.scene.text.Text)

Aggregations

Tile (eu.hansolo.tilesfx.Tile)1 ChartData (eu.hansolo.tilesfx.chart.ChartData)1 RadarChart (eu.hansolo.tilesfx.chart.RadarChart)1 ChartDataEventListener (eu.hansolo.tilesfx.events.ChartDataEventListener)1 Fonts (eu.hansolo.tilesfx.fonts.Fonts)1 Helper (eu.hansolo.tilesfx.tools.Helper)1 ListChangeListener (javafx.collections.ListChangeListener)1 Font (javafx.scene.text.Font)1 Text (javafx.scene.text.Text)1