/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { if (renderer == null) { throw new IllegalArgumentException("Null 'renderer' argument."); } if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
protected void setColours(final AbstractRenderer renderer, final KeyedValues2D dataset) { final int tmpRowDim = dataset.getRowCount(); for (int i = 0; i < tmpRowDim; i++) { final Comparable<?> tmpKey = dataset.getRowKey(i); final Paint tmpPaint = this.getColour(tmpKey); renderer.setSeriesPaint(i, tmpPaint); } }
/** * Applies the attributes for this theme to an {@link AbstractRenderer}. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToAbstractRenderer(AbstractRenderer renderer) { if (renderer.getAutoPopulateSeriesPaint()) { renderer.clearSeriesPaints(false); } if (renderer.getAutoPopulateSeriesStroke()) { renderer.clearSeriesStrokes(false); } }
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
/** * Applies the attributes for this theme to an {@link AbstractRenderer}. * * @param renderer the renderer ({@code null} not permitted). */ protected void applyToAbstractRenderer(AbstractRenderer renderer) { if (renderer.getAutoPopulateSeriesPaint()) { renderer.clearSeriesPaints(false); } if (renderer.getAutoPopulateSeriesStroke()) { renderer.clearSeriesStrokes(false); } }
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer ({@code null} not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { Args.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setDefaultItemLabelFont(this.regularFont); renderer.setDefaultItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer ({@code null} not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { Args.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setDefaultItemLabelFont(this.regularFont); renderer.setDefaultItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
@Override public void customize(JFreeChart jfc, JRChart jrc) { Plot plot = jfc.getPlot(); ItemsCounter itemsCounter = new LegendItemsCounter(plot); SeriesNameProvider seriesNameProvider = null; Object renderer = null; if (plot instanceof XYPlot) { XYPlot xyPlot = jfc.getXYPlot(); renderer = xyPlot.getRenderer(); seriesNameProvider = new XYPlotSeriesNameProvider(xyPlot); } else if (plot instanceof CategoryPlot) { CategoryPlot categoryPlot = jfc.getCategoryPlot(); renderer = categoryPlot.getRenderer(); seriesNameProvider = new CategorySeriesNameProvider(categoryPlot); } Integer legendItemIndex = CustomizerUtil.resolveIndex(this, itemsCounter, seriesNameProvider); if ( legendItemIndex != null && renderer instanceof AbstractRenderer ) { ShapeSetter shapeSetter = new AbstractRendererLegendShapeSetter((AbstractRenderer)renderer); if (legendItemIndex == -1) { updateItems(itemsCounter, shapeSetter); } else { updateItem(itemsCounter, shapeSetter, legendItemIndex); } } }
public static void setNiceSeriesColors(CategoryDataset paramCategoryDataset, AbstractRenderer paramAbstractRenderer) { Color[] arrayOfColor = ColorUtil.getDarkColors(ColorUtil.getPastelColors(), 0.35D); for (int i = 0; i < paramCategoryDataset.getRowCount(); i++) { Color localColor = arrayOfColor[(i % arrayOfColor.length)]; paramAbstractRenderer.setSeriesPaint(i, localColor); } }
AbstractRenderer getOrCreateRenderer(final IScope scope, final String serieid) { if (RendererSet.containsKey(serieid)) { return RendererSet.get(serieid); } final AbstractRenderer newrenderer = createRenderer(scope, serieid); RendererSet.put(serieid, newrenderer); return newrenderer; }
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }
public AbstractRendererLegendShapeSetter(AbstractRenderer renderer) { this.renderer = renderer; }
public AbstractRendererSeriesShapeSetter(AbstractRenderer renderer) { this.renderer = renderer; }
@Override public void customize(JFreeChart jfc, JRChart jrc) { Plot plot = jfc.getPlot(); ItemsCounter itemsCounter = null; SeriesNameProvider seriesNameProvider = null; Object renderer = null; if (plot instanceof XYPlot) { XYPlot xyPlot = jfc.getXYPlot(); renderer = xyPlot.getRenderer(); itemsCounter = new XYPlotSeriesCounter(xyPlot); seriesNameProvider = new XYPlotSeriesNameProvider(xyPlot); } else if (plot instanceof CategoryPlot) { CategoryPlot categoryPlot = jfc.getCategoryPlot(); renderer = categoryPlot.getRenderer(); itemsCounter = new CategoryCounter(categoryPlot); seriesNameProvider = new CategorySeriesNameProvider(categoryPlot); } Integer seriesItemIndex = CustomizerUtil.resolveIndex(this, itemsCounter, seriesNameProvider); if ( seriesItemIndex != null && renderer instanceof AbstractRenderer ) { ShapeSetter shapeSetter = new AbstractRendererSeriesShapeSetter((AbstractRenderer)renderer); if (seriesItemIndex == -1) { updateItems(itemsCounter, shapeSetter); } else { updateItem(itemsCounter, shapeSetter, seriesItemIndex); } } }
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { if (renderer == null) { throw new IllegalArgumentException("Null 'renderer' argument."); } if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }