private static void configureBarRenderer(BarRenderer renderer, ValueSource valueSource, PlotInstance plotInstance) { StandardBarPainter barPainter = new StandardBarPainter(); renderer.setBarPainter(barPainter); renderer.setGradientPaintTransformer(null); ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource); int seriesCount = valueSourceData.getSeriesCount(); DimensionConfig domainConfig = valueSource.getDomainConfig(); DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig( PlotDimension.COLOR); SeriesFormat seriesFormat = valueSource.getSeriesFormat(); // Loop all series and set series format. // Format based on dimension configs will be set later on in initFormatDelegate(). for (int seriesIdx = 0; seriesIdx < seriesCount; ++seriesIdx) { // configure series paint if necessary if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, colorDimensionConfig)) { renderer.setSeriesPaint(seriesIdx, seriesFormat.getAreaFillPaint()); } // configure general style of the bars renderer.setShadowVisible(false); renderer.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT); } renderer.setDrawBarOutline(true); }
/** * Creates the histogram chart. * * @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; }
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset, PlotOrientation.HORIZONTAL,false,false,false); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); // chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, null, rangeAxis1, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, null, rangeAxis2, renderer2); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
/** * Creates a sample plot. * * @return A plot. */ private CombinedRangeCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, null, rangeAxis1, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, null, rangeAxis2, renderer2); subplot2.setDomainGridlinesVisible(true); NumberAxis rangeAxis = new NumberAxis("Value"); CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot(rangeAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
@Test public void testRangeMarkerIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); // add a second dataset, plotted against a second axis DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); plot.setDataset(99, dataset); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setRangeAxis(1, yAxis2); LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(); plot.setRenderer(99, renderer2); plot.mapDatasetToRangeAxis(99, 1); ValueMarker yMarker1 = new ValueMarker(123); plot.addRangeMarker(99, yMarker1, Layer.FOREGROUND); assertTrue(plot.getRangeMarkers(99, Layer.FOREGROUND).contains( yMarker1)); }
@Test public void testDomainMarkerIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); // add a second dataset, plotted against a second x axis DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); plot.setDataset(99, dataset); CategoryAxis xAxis2 = new CategoryAxis("X2"); plot.setDomainAxis(1, xAxis2); LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(); plot.setRenderer(99, renderer2); plot.mapDatasetToDomainAxis(99, 1); CategoryMarker xMarker1 = new CategoryMarker(123); plot.addDomainMarker(99, xMarker1, Layer.FOREGROUND); assertTrue(plot.getDomainMarkers(99, Layer.FOREGROUND).contains( xMarker1)); }
/** * Serialize an instance, restore it, and check for equality. In addition, * test for a bug that was reported where the listener list is 'null' after * deserialization. */ @Test public void testSerialization() { BarRenderer r1 = new BarRenderer(); r1.setBaseLegendTextFont(new Font("Dialog", Font.PLAIN, 4)); r1.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.green)); r1.setBaseLegendShape(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); BarRenderer r2 = (BarRenderer) TestUtilities.serialised(r1); assertEquals(r1, r2); try { r2.notifyListeners(new RendererChangeEvent(r2)); } catch (NullPointerException e) { fail("No exception should be thrown."); // failed } }
/** * Some checks for the fill paint lookup mechanism. */ @Test public void testFillPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.white, r.getBaseFillPaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesFillPaint(false); assertEquals(Color.white, r.lookupSeriesFillPaint(0)); assertNull(r.getSeriesFillPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesFillPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE[0], r.lookupSeriesFillPaint(0)); assertNotNull(r.getSeriesFillPaint(0)); }
@Test public void testGetRendererForDataset2() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); // add a second dataset DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); plot.setDataset(99, dataset2); // by default, the renderer with index 0 is used assertEquals(renderer, plot.getRendererForDataset(dataset2)); // add a second renderer with the same index as dataset2, now it will // be used CategoryItemRenderer renderer2 = new LineAndShapeRenderer(); plot.setRenderer(99, renderer2); assertEquals(renderer2, plot.getRendererForDataset(dataset2)); }
@Test public void testAxisIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); assertEquals(xAxis, plot.getDomainAxis(0)); assertEquals(yAxis, plot.getRangeAxis(0)); CategoryAxis xAxis2 = new CategoryAxis("X2"); plot.setDomainAxis(99, xAxis2); assertEquals(xAxis2, plot.getDomainAxis(99)); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setRangeAxis(99, yAxis2); assertEquals(yAxis2, plot.getRangeAxis(99)); }
/** * Datasets are now stored in a Map, and it should be possible to assign * them an arbitrary key (index). */ @Test public void testDatasetIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); assertEquals(dataset, plot.getDataset(0)); DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); // we should be able to give a dataset an arbitrary index plot.setDataset(99, dataset2); assertEquals(2, plot.getDatasetCount()); assertEquals(dataset2, plot.getDataset(99)); assertEquals(0, plot.indexOf(dataset)); assertEquals(99, plot.indexOf(dataset2)); }
@Test public void testAxisLocationIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); CategoryAxis xAxis2 = new CategoryAxis("X2"); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setDomainAxis(99, xAxis2); plot.setRangeAxis(99, yAxis2); plot.setDomainAxisLocation(99, AxisLocation.BOTTOM_OR_RIGHT); assertEquals(AxisLocation.BOTTOM_OR_RIGHT, plot.getDomainAxisLocation(99)); plot.setRangeAxisLocation(99, AxisLocation.BOTTOM_OR_LEFT); assertEquals(AxisLocation.BOTTOM_OR_LEFT, plot.getRangeAxisLocation(99)); }
/** * This method sets the width of the bars, and the spacing between the bars. It sets a general, hard coded standard for this. In JFreeChart, you * cannot set the bar width. In stead, you set the gaps: - lowerMargin is the gap between the start of the x-axis and the first bar - upperMargin * is the gap between the end of the x-axis and the last bar - categoryMargin is the gap between the categories. Note that the number you provide * here, is divided over all the gaps. So if you set this margin to 0.5 (is 50%) and there are 6 categories, this means that there are 5 gaps, so * each gap will get 10%. - itemMargin is the gap between the bars within a category. Again, this number is divided over all the itemgaps in the * whole graph. The method also takes care that extreme cases (with a very small amount of bars) still look acceptable. * @param plot */ private void setMargins(final CategoryPlot plot) { final CategoryAxis axis = plot.getDomainAxis(); axis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 9)); final int categoryCount = plot.getCategories().size(); final int seriesCount = plot.getDataset().getRowCount(); axis.setCategoryMargin(0.23); // sets spacing between categories on x% // set spacing between bars inside a catgory (in fractions, so 1 = 100%) final BarRenderer renderer = (BarRenderer) plot.getRenderer(); if (categoryCount == 1) { renderer.setItemMargin(0.15); } else { renderer.setItemMargin(0.03); } // extreme cases if (categoryCount * seriesCount < 4) { final double outerMargins = (4.0 - (categoryCount * seriesCount)) / 10.0; axis.setLowerMargin(outerMargins); axis.setUpperMargin(outerMargins); } }
@Test public void testMapDatasetToDomainAxis() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); CategoryAxis xAxis2 = new CategoryAxis("X2"); plot.setDomainAxis(11, xAxis2); // add a second dataset DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); plot.setDataset(99, dataset); assertEquals(xAxis, plot.getDomainAxisForDataset(99)); // now map the dataset to the second xAxis plot.mapDatasetToDomainAxis(99, 11); assertEquals(xAxis2, plot.getDomainAxisForDataset(99)); }
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
public GraphData(String printer_id, String outDir, boolean warn, String label,String yLabel, ArrayList<String> learnSpecs) { this.outDir = outDir; this.printer_id = printer_id; this.warn = warn; this.learnSpecs = learnSpecs; graphProbs = new ArrayList<String>(); probGraphed = new LinkedList<GraphProbs>(); chart = ChartFactory.createBarChart(label, "", yLabel, new DefaultCategoryDataset(), PlotOrientation.VERTICAL, true, true, false); applyChartTheme(); ((BarRenderer) chart.getCategoryPlot().getRenderer()).setBarPainter(new StandardBarPainter()); chart.setBackgroundPaint(new java.awt.Color(238, 238, 238)); chart.getPlot().setBackgroundPaint(java.awt.Color.WHITE); chart.getCategoryPlot().setRangeGridlinePaint(java.awt.Color.LIGHT_GRAY); legend = chart.getLegend(); timeSeriesPlot = false; averageOrder = null; }
/** * Sets the current chart theme. This will be applied to all new charts * created via methods in this class. * * @param theme the theme ({@code null} not permitted). * * @see #getChartTheme() * @see ChartUtils#applyCurrentTheme(JFreeChart) * * @since 1.0.11 */ public static void setChartTheme(ChartTheme theme) { Args.nullNotPermitted(theme, "theme"); currentTheme = theme; // here we do a check to see if the user is installing the "Legacy" // theme, and reset the bar painters in that case... if (theme instanceof StandardChartTheme) { StandardChartTheme sct = (StandardChartTheme) theme; if (sct.getName().equals("Legacy")) { BarRenderer.setDefaultBarPainter(new StandardBarPainter()); XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter()); } else { BarRenderer.setDefaultBarPainter(new GradientBarPainter()); XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter()); } } }
/** * Serialize an instance, restore it, and check for equality. In addition, * test for a bug that was reported where the listener list is 'null' after * deserialization. */ @Test public void testSerialization() { BarRenderer r1 = new BarRenderer(); r1.setDefaultLegendTextFont(new Font("Dialog", Font.PLAIN, 4)); r1.setDefaultLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.GREEN)); r1.setDefaultLegendShape(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); BarRenderer r2 = (BarRenderer) TestUtils.serialised(r1); assertEquals(r1, r2); try { r2.notifyListeners(new RendererChangeEvent(r2)); } catch (NullPointerException e) { fail("No exception should be thrown."); // failed } }
/** * Some checks for the fill paint lookup mechanism. */ @Test public void testFillPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.WHITE, r.getDefaultFillPaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesFillPaint(false); assertEquals(Color.WHITE, r.lookupSeriesFillPaint(0)); assertNull(r.getSeriesFillPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesFillPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE[0], r.lookupSeriesFillPaint(0)); assertNotNull(r.getSeriesFillPaint(0)); }
/** * Some checks for the outline paint lookup mechanism. */ @Test public void testOutlinePaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.GRAY, r.getDefaultOutlinePaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesOutlinePaint(false); assertEquals(Color.GRAY, r.lookupSeriesOutlinePaint(0)); assertNull(r.getSeriesOutlinePaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesOutlinePaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE[0], r.lookupSeriesOutlinePaint(0)); assertNotNull(r.getSeriesOutlinePaint(0)); }
@Test public void testRendererIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); assertEquals(renderer, plot.getRenderer(0)); // we should be able to give a renderer an arbitrary index CategoryItemRenderer renderer2 = new LineAndShapeRenderer(); plot.setRenderer(20, renderer2); assertEquals(2, plot.getRendererCount()); assertEquals(renderer2, plot.getRenderer(20)); assertEquals(20, plot.getIndexOf(renderer2)); }
@Test public void testMapDatasetToRangeAxis() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setRangeAxis(22, yAxis2); // add a second dataset DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); plot.setDataset(99, dataset); assertEquals(yAxis, plot.getRangeAxisForDataset(99)); // now map the dataset to the second xAxis plot.mapDatasetToRangeAxis(99, 22); assertEquals(yAxis2, plot.getRangeAxisForDataset(99)); }
/** * Some checks for the paint lookup mechanism. */ @Test public void testPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.blue, r.getBasePaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesPaint(false); assertEquals(Color.blue, r.lookupSeriesPaint(0)); assertNull(r.getSeriesPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[0], r.lookupSeriesPaint(0)); assertNotNull(r.getSeriesPaint(0)); }
@Override protected JFreeChart createStackedBarChart() throws JRException { JFreeChart jfreeChart = super.createStackedBarChart(); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); //categoryPlot.setOrientation(PlotOrientation.HORIZONTAL); BarRenderer barRenderer = (BarRenderer)categoryPlot.getRenderer(); barRenderer.setItemMargin(0); barRenderer.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL) ); CategoryDataset categoryDataset = categoryPlot.getDataset(); if (categoryDataset != null) { for (int i = 0; i < categoryDataset.getRowCount(); i++) { barRenderer.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i)); } } return jfreeChart; }