List of usage examples for org.jfree.chart.plot CategoryPlot setBackgroundImageAlpha
public void setBackgroundImageAlpha(float alpha)
From source file:com.redhat.thermostat.byteman.plot.impl.TestPlotRenderer.java
void renderToFile(Collection<PlotRecord> records, String filename) throws Exception { DefaultCategoryDataset ds = new DefaultCategoryDataset(); for (PlotRecord re : records) { Long label = re.getPeriodStart() + ((re.getPeriodEnd() - re.getPeriodStart()) / 2); ds.addValue(re.getValue(), re.getCategory(), label); }//from w ww . j ava 2 s . c o m JFreeChart chart = ChartFactory.createStackedBarChart(EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, ds, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(toColor("#FFFFFFFF")); plot.setBackgroundImageAlpha((float) 0.0d); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(toColor("#FFAAAAAA")); // plot.getRangeAxis().setRange(new Range(ds.getMin(), ds.getMax() * 1.1)); plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // plot.getRangeAxis().setLabel(cf.rangeAxisLabel); // colorAxis(plot.getRangeAxis()); // colorAxis(plot.getDomainAxis()); // plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI * 0.12d)); // plot.getDomainAxis().setLowerMargin(cf.domainAxisLowerMargin); // plot.getDomainAxis().setUpperMargin(cf.domainAxisUpperMargin); // plot.getDomainAxis().setLabel(cf.domainAxisLabel); BarRenderer3D barrenderer = new StackedBarRenderer3D(16.0d, 12.0d); barrenderer.setSeriesPaint(0, toColor("#00FFFFFF")); barrenderer.setSeriesPaint(1, toColor("#BB669900")); barrenderer.setSeriesPaint(2, toColor("#BBFF8800")); barrenderer.setWallPaint(toColor("#FFEEEEEE")); // barrenderer.setBaseItemLabelsVisible(cf.baseItemLabelsVisible); barrenderer.setShadowVisible(false); barrenderer.setItemMargin(0.0d); plot.setRenderer(barrenderer); plot.setOutlineVisible(false); chartToSvg(chart, 1024, 600, filename); }
From source file:graficarordenamiento.Graficador.java
public void crearGrafico() { // Creando el Grafico chart = ChartFactory.createBarChart("Grfico de barras", null, null, dataset, PlotOrientation.VERTICAL, false, false, false);//from w ww . ja v a 2 s .co m chart.setBackgroundPaint(new GradientPaint(0, 0, Color.WHITE, 700, 0, Color.BLACK.brighter(), false)); chart.setBackgroundImageAlpha(0.5f); final CategoryPlot plot = chart.getCategoryPlot(); plot.setNoDataMessage("NO DATA!"); plot.setRangeGridlinePaint(Color.red); plot.setBackgroundPaint(new GradientPaint(0, 0, Color.LIGHT_GRAY, 0, 100, Color.darkGray)); plot.setBackgroundImageAlpha(0.5f); //plot.setDomainGridlinesVisible(true); BarRenderer rend = (BarRenderer) plot.getRenderer(); final ItemLabelPosition e = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0); GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); rend.setSeriesPaint(0, gp0); rend.setSeriesPaint(1, gp1); rend.setSeriesPaint(2, gp2); plot.setRenderer(rend); // change the margin at the top of the range axis... final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); // set up gradient paints for series... }
From source file:com.rapidminer.gui.viewer.metadata.model.NominalAttributeStatisticsModel.java
/** * Creates the histogram chart.//from ww w.j a va2s . com * * @return */ private JFreeChart createBarChart() { JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL, false, false, false); AbstractAttributeStatisticsModel.setDefaultChartFonts(chart); chart.setBackgroundPaint(null); chart.setBackgroundImageAlpha(0.0f); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setOutlineVisible(false); plot.setRangeZeroBaselineVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(COLOR_INVISIBLE); plot.setBackgroundImageAlpha(0.0f); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL)); renderer.setBarPainter(new StandardBarPainter()); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); return chart; }