private BufferedImage render(StaplerRequest req, ChartRenderingInfo info) { String w = req.getParameter("width"); if(w==null) w=String.valueOf(defaultW); String h = req.getParameter("height"); if(h==null) h=String.valueOf(defaultH); Color graphBg = stringToColor(req.getParameter("graphBg")); Color plotBg = stringToColor(req.getParameter("plotBg")); if (graph==null) graph = createGraph(); graph.setBackgroundPaint(graphBg); Plot p = graph.getPlot(); p.setBackgroundPaint(plotBg); return graph.createBufferedImage(Integer.parseInt(w),Integer.parseInt(h),info); }
/** * Draws a chart into {@link JFreeChart}. */ public JFreeChart createChart() { final JFreeChart chart = ChartFactory.createLineChart(null, // chart title null, // unused null, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); chart.getLegend().setItemFont(CHART_FONT); final CategoryPlot plot = chart.getCategoryPlot(); configurePlot(plot); configureRangeAxis((NumberAxis) plot.getRangeAxis()); crop(plot); return chart; }
true, // tooltips false ); // urls chart.setBackgroundPaint( Color.white ); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint( Color.white );
true, // tooltips false ); // urls chart.setBackgroundPaint( Color.white ); TextTitle title = new TextTitle( chartTitle );
); chart.setBackgroundPaint(Color.white);
XYSeriesCollection xyDataset = new XYSeriesCollection(dataSeries); StandardXYToolTipGenerator ttg = new StandardXYToolTipGenerator( "{0}: {2}", chartFormatter, NumberFormat.getInstance()); StandardXYItemRenderer renderer = new StandardXYItemRenderer( StandardXYItemRenderer.SHAPES_AND_LINES, ttg, null); renderer.setShapesFilled(true); XYPlot plot = new XYPlot(xyDataset, dateAxis, valueAxis, renderer); JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, false); chart.setBackgroundPaint(java.awt.Color.WHITE);
); chart.setBackgroundPaint(Color.white);
chart.setBackgroundPaint(Color.YELLOW); MultiplePiePlot plot = (MultiplePiePlot) chart.getPlot(); plot.setBackgroundPaint(Color.BLUE); JFreeChart subchart = plot.getPieChart(); subchart.setBackgroundPaint(Color.RED);
chart.setBackgroundPaint(new Color(backgroundColor)); for (int i = 0; i < seriesMaxCount; i++) { if (seriesColor[i] >= 0) {
/** * Adds default formatting options for the charts, like a white background etc. * Requires the member {@link #chart} to be set by the overriding class! */ protected void addDefaultFormatting() { this.chart.setBackgroundPaint(new Color(1.0f, 1.0f, 1.0f, 1.0f)); this.chart.getLegend().setBorder(0.0, 0.0, 0.0, 0.0); }
/** * Returns a basic JFreeChart. */ private JFreeChart getBasicJFreeChart( CategoryPlot plot ) { JFreeChart jFreeChart = new JFreeChart( null, TITLE_FONT, plot, false ); jFreeChart.setBackgroundPaint( Color.WHITE ); jFreeChart.setAntiAlias( true ); return jFreeChart; }
private JFreeChart createMonthlyChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "", // title resourceMap.getString("graphDate.text"), // x-axis label resourceMap.getString("graphCBills.text"), // y-axis label dataset); chart.setBackgroundPaint(Color.WHITE); chart.getLegend().setPosition(RectangleEdge.TOP); return chart; }
private void improveChart(JFreeChart jfrechart, ChartParameters params) { Color background = Color.decode("#" + params.getValue(ChartParameters.PARAM_BACKGROUND_COLOR, "FFFFFF", false)); jfrechart.setBackgroundPaint(background); jfrechart.setBorderVisible(false); jfrechart.setAntiAlias(true); jfrechart.setTextAntiAlias(true); jfrechart.removeLegend(); }
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())); } }
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())); } }
protected void setColors() { chart.setBackgroundPaint(ChartColorFactory.createColor(ofxChart, ChartColorFactory.Area.backgroundChart)); chart.getPlot().setBackgroundPaint(ChartColorFactory.createColor(ofxChart, ChartColorFactory.Area.backgroundPlot)); setSpecialColors(); } protected void setSpecialColors(){logger.error("This should be @Overridden");}
/** * Updates the properties of a chart to match the properties defined on the * panel. * * @param chart the chart. */ public void updateChart(JFreeChart chart) { this.titleEditor.setTitleProperties(chart); this.plotEditor.updatePlotProperties(chart.getPlot()); chart.setAntiAlias(getAntiAlias()); chart.setBackgroundPaint(getBackgroundPaint()); }
protected JFreeChart createChart(XYDataset dataset) { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart( null, "time", "# of issues", dataset, true, false, false); jfreechart.setBackgroundPaint(Color.WHITE); XYPlot plot = (XYPlot)jfreechart.getPlot(); XYStepAreaRenderer renderer = new XYStepAreaRenderer(); plot.setRenderer(renderer); renderer.setSeriesPaint(0,ColorPalette.RED); renderer.setSeriesPaint(1,ColorPalette.GREEN); return jfreechart; } }
public static void setDefaults(JFreeChart chart) { chart.setBackgroundPaint(ChartDefaults.transparent); chart.setBorderVisible(false); chart.getPlot().setNoDataMessage("No Data Available"); setupPlot(chart.getPlot()); ChartUtil.setupTextTitle(chart.getTitle()); ChartUtil.setupLegendTitle(chart.getLegend()); }
public static void setDefaults(JFreeChart chart, final I18nHelper i18nHelper) { chart.setBackgroundPaint(Color.WHITE); chart.setBorderVisible(false); chart.getPlot().setNoDataMessage(i18nHelper.getText("gadget.charts.no.data")); setupPlot(chart.getPlot()); ChartUtil.setupTextTitle(chart.getTitle()); ChartUtil.setupLegendTitle(chart.getLegend()); }