Java Code Examples for org.jfree.chart.plot.Plot#setDrawingSupplier()

The following examples show how to use org.jfree.chart.plot.Plot#setDrawingSupplier() . 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: SimpleChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected void setPlotDrawingDefaults(Plot p, JRChartPlot jrPlot)
	{
		PlotSettings plotSettings = getPlotSettings();
		Paint[] paintSequence = getPaintSequence(plotSettings, jrPlot);	
		Paint[] outlinePaintSequence = getOutlinePaintSequence(plotSettings);	
		Stroke[] strokeSequence = getStrokeSequence(plotSettings);
		Stroke[] outlineStrokeSequence = getOutlineStrokeSequence(plotSettings);
			
//		Shape[] defaultPlotShapeSequence = 
//			getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_SHAPE_SEQUENCE) != null ?
//			(Shape[])getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_SHAPE_SEQUENCE) :
//			DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE;

		p.setDrawingSupplier(new DefaultDrawingSupplier(
				paintSequence,
				outlinePaintSequence,
				strokeSequence,
				outlineStrokeSequence,
				DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE
				)
			);
	}
 
Example 2
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    ParamChecks.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
 
Example 3
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    ParamChecks.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
 
Example 4
Source File: GenericChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void setPlotDrawingDefaults(Plot p, JRChartPlot jrPlot)
{
	@SuppressWarnings("unchecked")
	List<Paint> defaultSeriesColors = (List<Paint>)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);
	Paint[] defaultPlotOutlinePaintSequence = 
		getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_OUTLINE_PAINT_SEQUENCE) != null ?
		(Paint[])getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_OUTLINE_PAINT_SEQUENCE) :
		DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE;
		
	Stroke[] defaultPlotStrokeSequence = 
		getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_STROKE_SEQUENCE) != null ?
		(Stroke[])getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_STROKE_SEQUENCE) :
		DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE;
		
	Stroke[] defaultPlotOutlineStrokeSequence = 
		getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_OUTLINE_STROKE_SEQUENCE) != null ?
		(Stroke[])getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_OUTLINE_STROKE_SEQUENCE) :
		DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE;
		
	Shape[] defaultPlotShapeSequence = 
		getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_SHAPE_SEQUENCE) != null ?
		(Shape[])getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_SHAPE_SEQUENCE) :
		DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE;
	// Set color series
	Paint[] colors = null;
	SortedSet<JRSeriesColor> seriesColors = jrPlot.getSeriesColors();
	Paint[] colorSequence = null;
	if (seriesColors != null && seriesColors.size() > 0)
	{
		int seriesColorsSize = seriesColors.size();
		
		colors = new Paint[DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length + seriesColorsSize];

		JRSeriesColor[] jrColorSequence = new JRSeriesColor[seriesColorsSize];
		seriesColors.toArray(jrColorSequence);
		colorSequence = new Paint[seriesColorsSize];
		
		for (int i = 0; i < seriesColorsSize; i++)
		{
			colorSequence[i] = jrColorSequence[i].getColor();
		}
		populateSeriesColors(colors, colorSequence);
	}
	else if (defaultSeriesColors != null && defaultSeriesColors.size() > 0)
	{
		colors = new Paint[DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length + defaultSeriesColors.size()];
		colorSequence = new Paint[defaultSeriesColors.size()];
		defaultSeriesColors.toArray(colorSequence);
		populateSeriesColors(colors, colorSequence);
	}
	else
	{
		colors = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE;
	}
	
	p.setDrawingSupplier(new DefaultDrawingSupplier(
			colors,
			defaultPlotOutlinePaintSequence,
			defaultPlotStrokeSequence,
			defaultPlotOutlineStrokeSequence,
			defaultPlotShapeSequence
			)
		);
	
}
 
Example 5
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    ParamChecks.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
 
Example 6
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    ParamChecks.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
 
Example 7
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    if (plot == null) {
        throw new IllegalArgumentException("Null 'plot' argument.");
    }
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
 
Example 8
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    ParamChecks.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
 
Example 9
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    ParamChecks.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}