List of usage examples for org.jfree.chart.renderer.category BarRenderer3D setSeriesPaint
public void setSeriesPaint(int series, Paint paint)
From source file:graficos.GraficoBarras.java
private static JFreeChart crearGrafico(CategoryDataset cjto_datos) { JFreeChart grafico = ChartFactory.createBarChart3D("Distribucin de Recursos", // Ttulo "Unidad de tiempo", // Ttulo eje x "Recurso", // Ttulo eje y cjto_datos, // Datos PlotOrientation.VERTICAL, // Orientacin true, // Incluir leyenda true, // Incluir tooltips false // Incluir URLs );/*from w ww . j av a 2s . co m*/ grafico.setBackgroundPaint(new Color(240, 240, 240)); grafico.getPlot().zoom(0.0); CategoryPlot ploter = (CategoryPlot) grafico.getPlot(); NumberAxis3D rangeAxis = (NumberAxis3D) ploter.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis3D.createIntegerTickUnits()); BarRenderer3D renderer = (BarRenderer3D) ploter.getRenderer(); renderer.setDrawBarOutline(false); 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)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setItemMargin(0.0); CategoryAxis domainAxis = ploter.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(0.0)); return grafico; }
From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo.java
private static JFreeChart createBarChart3D(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D("Bar Chart 3D Demo 1", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation true, // include legend true, // tooltips? false // URLs? );// w ww .ja v a 2s .c o m chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setForegroundAlpha(0.5f); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer(); // set up gradient paints for series... 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)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); return chart; }
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 w w. j a va2 s . co 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:net.nosleep.superanalyzer.analysis.views.WordView.java
public void createChart() { _chart = ChartFactory.createBarChart3D(Misc.getString("SONG_WORDS"), // chart title Misc.getString("WORD"), // domain axis label Misc.getString("SONG_COUNT"), // range axis label _dataset, // data PlotOrientation.HORIZONTAL, // orientation false, // include legend true, // tooltips? false // URLs? );//w w w. j ava 2 s. c om _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("SONG_WORDS_TOOLTIP"))); CategoryPlot plot = (CategoryPlot) _chart.getPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartUtilities.applyCurrentTheme(_chart); Misc.formatChart(plot); CategoryItemRenderer renderer = plot.getRenderer(); BarRenderer3D barRenderer = (BarRenderer3D) renderer; barRenderer.setWallPaint(Color.white); barRenderer.setSeriesPaint(0, Theme.getColorSet()[1]); }
From source file:net.nosleep.superanalyzer.analysis.views.MostPlayedAAView.java
public JFreeChart createChart(String title, String domainLabel, DefaultCategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title domainLabel, // domain axis label Misc.getString("SONG_COUNT"), // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation false, // include legend true, // tooltips? false // URLs? );/*from w w w . j a v a 2 s. c o m*/ // _artistChart.addSubtitle(HomePanel // .createSubtitle("How many songs you have in each genre")); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartUtilities.applyCurrentTheme(chart); Misc.formatChart(plot); plot.getDomainAxis().setMaximumCategoryLabelWidthRatio(0.5f); CategoryItemRenderer renderer = plot.getRenderer(); BarRenderer3D barRenderer = (BarRenderer3D) renderer; barRenderer.setWallPaint(Color.white); barRenderer.setSeriesPaint(0, Theme.getColorSet()[1]); return chart; }
From source file:net.nosleep.superanalyzer.analysis.views.MostPlayedDGView.java
public JFreeChart createChart(String title, String domainLabel, DefaultCategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title domainLabel, // domain axis label Misc.getString("SONG_COUNT"), // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation false, // include legend true, // tooltips? false // URLs? );// w ww. ja va 2 s. c o m // _artistChart.addSubtitle(HomePanel // .createSubtitle("How many songs you have in each genre")); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartUtilities.applyCurrentTheme(chart); Misc.formatChart(plot); plot.getDomainAxis().setMaximumCategoryLabelWidthRatio(0.5f); CategoryItemRenderer renderer = plot.getRenderer(); BarRenderer3D barRenderer = (BarRenderer3D) renderer; barRenderer.setWallPaint(Color.white); barRenderer.setSeriesPaint(0, Theme.getColorSet()[1]); return chart; }
From source file:net.nosleep.superanalyzer.analysis.views.GenreView.java
public void createChart() { _chart = ChartFactory.createBarChart3D(Misc.getString("GENRES"), // chart // title Misc.getString("GENRE"), // domain axis label Misc.getString("SONG_COUNT"), // range axis label _dataset, // data PlotOrientation.HORIZONTAL, // orientation false, // include legend true, // tooltips? false // URLs? );/*from ww w.j av a2s. c om*/ _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("GENRES_SUBTITLE"))); CategoryPlot plot = (CategoryPlot) _chart.getPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartUtilities.applyCurrentTheme(_chart); Misc.formatChart(plot); CategoryItemRenderer renderer = plot.getRenderer(); BarRenderer3D barRenderer = (BarRenderer3D) renderer; barRenderer.setWallPaint(Color.white); barRenderer.setSeriesPaint(0, Theme.getColorSet()[1]); }
From source file:org.eevolution.form.CRPDetail.java
/** * Create Chart based on UOM/* w ww . j ava 2 s . c om*/ * * @param dataset * @param title * @param uom * @return JFreeChart Chart based On UOM */ public JFreeChart createChart(CategoryDataset dataset, String title, MUOM uom) { JFreeChart chart = ChartFactory.createBarChart3D(title, Msg.translate(Env.getCtx(), "Day"), // X-Axis label Msg.translate(Env.getCtx(), (uom == null) ? "" : uom.getName()), // Y-Axis // label dataset, // Dataset PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); chart.setBackgroundPaint(Color.WHITE); chart.setAntiAlias(true); chart.setBorderVisible(true); CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.GRAY); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.GRAY); BarRenderer3D barrenderer = (BarRenderer3D) plot.getRenderer(); barrenderer.setDrawBarOutline(false); barrenderer.setBaseItemLabelGenerator(new LabelGenerator()); barrenderer.setBaseItemLabelsVisible(true); barrenderer.setSeriesPaint(0, new Color(10, 80, 150, 128)); barrenderer.setSeriesPaint(1, new Color(180, 60, 50, 128)); ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER); barrenderer.setPositiveItemLabelPosition(itemlabelposition); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); return chart; }
From source file:org.bench4Q.console.ui.section.E_ErrorSection.java
private JPanel printErrorPic() throws IOException { CategoryDataset dataset = getDataSet(); JFreeChart chart = ChartFactory.createBarChart3D("Error", "Error type", "Error number", dataset, PlotOrientation.VERTICAL, true, true, true); CategoryPlot plot = chart.getCategoryPlot(); org.jfree.chart.axis.CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.1);/*from w ww. ja v a 2s.c om*/ domainAxis.setUpperMargin(0.1); domainAxis.setCategoryLabelPositionOffset(10); domainAxis.setCategoryMargin(0.2); domainAxis.setCategoryLabelPositionOffset(10); org.jfree.chart.axis.ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setUpperMargin(0.1); org.jfree.chart.renderer.category.BarRenderer3D renderer; renderer = new org.jfree.chart.renderer.category.BarRenderer3D(); renderer.setBaseOutlinePaint(Color.red); renderer.setSeriesPaint(0, new Color(0, 255, 255)); renderer.setSeriesOutlinePaint(0, Color.BLACK); renderer.setSeriesPaint(1, new Color(0, 255, 0)); renderer.setSeriesOutlinePaint(1, Color.red); renderer.setItemMargin(0.1); renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setItemLabelFont(new Font("", Font.BOLD, 12)); renderer.setItemLabelPaint(Color.black); renderer.setItemLabelsVisible(true); plot.setRenderer(renderer); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.setBackgroundPaint(Color.WHITE); return new ChartPanel(chart); }
From source file:org.bench4Q.console.ui.section.S_LengthSection.java
/** * @return//w w w. ja v a2 s. co m * @throws IOException */ public JPanel drawSessionPic() throws IOException { CategoryDataset dataset = getDataSet(); JFreeChart chart = ChartFactory.createBarChart3D("Session", "Session type", "Session number", dataset, PlotOrientation.VERTICAL, true, true, true); CategoryPlot plot = chart.getCategoryPlot(); org.jfree.chart.axis.CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.1); domainAxis.setUpperMargin(0.1); domainAxis.setCategoryLabelPositionOffset(10); domainAxis.setCategoryMargin(0.2); org.jfree.chart.axis.ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setUpperMargin(0.1); org.jfree.chart.renderer.category.BarRenderer3D renderer; renderer = new org.jfree.chart.renderer.category.BarRenderer3D(); renderer.setBaseOutlinePaint(Color.red); renderer.setSeriesPaint(0, new Color(0, 255, 255)); renderer.setSeriesOutlinePaint(0, Color.BLACK); renderer.setSeriesPaint(1, new Color(0, 255, 0)); renderer.setSeriesOutlinePaint(1, Color.red); renderer.setItemMargin(0.1); renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setItemLabelFont(new Font("", Font.BOLD, 12)); renderer.setItemLabelPaint(Color.black); renderer.setItemLabelsVisible(true); plot.setRenderer(renderer); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.setBackgroundPaint(Color.WHITE); return new ChartPanel(chart); }