Search in sources :

Example 1 with Green

use of org.opennms.netmgt.config.charts.Green in project opennms by OpenNMS.

the class ChartUtils method setChartBackgroundColor.

private static void setChartBackgroundColor(BarChart chartConfig, JFreeChart chart) {
    if (chartConfig.getChartBackgroundColor().isPresent()) {
        final ChartBackgroundColor bgColor = chartConfig.getChartBackgroundColor().get();
        Red red = bgColor.getRgb().getRed();
        Blue blue = bgColor.getRgb().getBlue();
        Green green = bgColor.getRgb().getGreen();
        chart.setBackgroundPaint(new Color(red.getRgbColor(), green.getRgbColor(), blue.getRgbColor()));
    }
}
Also used : Red(org.opennms.netmgt.config.charts.Red) Blue(org.opennms.netmgt.config.charts.Blue) ChartBackgroundColor(org.opennms.netmgt.config.charts.ChartBackgroundColor) Color(java.awt.Color) ChartBackgroundColor(org.opennms.netmgt.config.charts.ChartBackgroundColor) PlotBackgroundColor(org.opennms.netmgt.config.charts.PlotBackgroundColor) Green(org.opennms.netmgt.config.charts.Green)

Example 2 with Green

use of org.opennms.netmgt.config.charts.Green in project opennms by OpenNMS.

the class ChartUtils method setPlotBackgroundColor.

private static void setPlotBackgroundColor(BarChart chartConfig, JFreeChart chart) {
    if (chartConfig.getPlotBackgroundColor().isPresent()) {
        final PlotBackgroundColor bgColor = chartConfig.getPlotBackgroundColor().get();
        final Optional<Rgb> rgb = bgColor.getRgb();
        if (rgb.isPresent()) {
            final Red red = rgb.get().getRed();
            final Blue blue = rgb.get().getBlue();
            final Green green = rgb.get().getGreen();
            chart.getPlot().setBackgroundPaint(new Color(red.getRgbColor(), green.getRgbColor(), blue.getRgbColor()));
        }
    }
}
Also used : PlotBackgroundColor(org.opennms.netmgt.config.charts.PlotBackgroundColor) Red(org.opennms.netmgt.config.charts.Red) Blue(org.opennms.netmgt.config.charts.Blue) Color(java.awt.Color) ChartBackgroundColor(org.opennms.netmgt.config.charts.ChartBackgroundColor) PlotBackgroundColor(org.opennms.netmgt.config.charts.PlotBackgroundColor) Rgb(org.opennms.netmgt.config.charts.Rgb) Green(org.opennms.netmgt.config.charts.Green)

Aggregations

Color (java.awt.Color)2 Blue (org.opennms.netmgt.config.charts.Blue)2 ChartBackgroundColor (org.opennms.netmgt.config.charts.ChartBackgroundColor)2 Green (org.opennms.netmgt.config.charts.Green)2 PlotBackgroundColor (org.opennms.netmgt.config.charts.PlotBackgroundColor)2 Red (org.opennms.netmgt.config.charts.Red)2 Rgb (org.opennms.netmgt.config.charts.Rgb)1