org.jfree.chart.renderer.AbstractRenderer Java Examples

The following examples show how to use org.jfree.chart.renderer.AbstractRenderer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #2
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #3
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #4
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #5
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #6
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #7
Source File: ChartJFreeChartOutput.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
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;

}
 
Example #8
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #9
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #10
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #11
Source File: LegendShapeCustomizer.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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);
		}
	}
}
 
Example #12
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #13
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #14
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #15
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #16
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #17
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #18
Source File: ChartJFreeChartOutputRadar.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected AbstractRenderer createRenderer(final IScope scope, final String serieid) {
	return null;
}
 
Example #19
Source File: LineChartPanel.java    From nmonvisualizer with Apache License 2.0 4 votes vote down vote up
@Override
public final void chartMouseClicked(ChartMouseEvent event) {
    int series = -1;

    ChartEntity entity = event.getEntity();

    if (entity == null) {
        return;
    }

    // users can click on either the line or the legend
    // regardless, figure out the series index
    if (entity.getClass() == XYItemEntity.class) {
        series = ((XYItemEntity) event.getEntity()).getSeriesIndex();
    }
    else if (entity.getClass() == LegendItemEntity.class) {
        LegendItemEntity legendEntity = (LegendItemEntity) event.getEntity();
        XYDataset dataset = (XYDataset) legendEntity.getDataset();

        for (int i = 0; i < dataset.getSeriesCount(); i++) {
            if (dataset.getSeriesKey(i).equals(legendEntity.getSeriesKey())) {
                series = i;
                break;
            }
        }
    }

    if (series != -1) {
        XYItemRenderer renderer = getChart().getXYPlot().getRenderer();
        Stroke oldHighlight = renderer.getSeriesStroke(series);

        // clear existing highlights
        ((AbstractRenderer) getChart().getXYPlot().getRenderer()).clearSeriesStrokes(false);

        // toggle series stroke
        if (oldHighlight != SELECTED_STROKE) {
            renderer.setSeriesStroke(series, SELECTED_STROKE);

            firePropertyChange("highlightedLine", null, series);
        }
        else {
            renderer.setSeriesStroke(series, null);

            firePropertyChange("highlightedLine", series, null);
        }

        // assume whatever fired the event will repaint the chart
    }
}
 
Example #20
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #21
Source File: LineChartPanel.java    From nmonvisualizer with Apache License 2.0 4 votes vote down vote up
@Override
public final void clearHighlightedElements() {
    if (getChart() != null) {
        ((AbstractRenderer) getChart().getXYPlot().getRenderer()).clearSeriesStrokes(false);
    }
}
 
Example #22
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #23
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #24
Source File: ChartJFreeChartOutput.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
protected AbstractRenderer createRenderer(final IScope scope, final String serieid) {
	// TODO Auto-generated method stub
	return new XYErrorRenderer();

}
 
Example #25
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #26
Source File: LineDotShapeCustomizer.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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);	
		}
	}
}
 
Example #27
Source File: LineDotShapeCustomizer.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
public AbstractRendererSeriesShapeSetter(AbstractRenderer renderer)
{
	this.renderer = renderer;
}
 
Example #28
Source File: LegendShapeCustomizer.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
public AbstractRendererLegendShapeSetter(AbstractRenderer renderer)
{
	this.renderer = renderer;
}
 
Example #29
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #30
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
    }
}