org.jfree.chart.plot.FastScatterPlot Java Examples

The following examples show how to use org.jfree.chart.plot.FastScatterPlot. 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: FastScatterPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that 
 * no exceptions are thrown.
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        float[][] data = createData();

        ValueAxis domainAxis = new NumberAxis("X");
        ValueAxis rangeAxis = new NumberAxis("Y");
        FastScatterPlot plot = new FastScatterPlot(data, domainAxis, 
                rangeAxis);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
Example #2
Source File: FastScatterPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown.
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        float[][] data = createData();

        ValueAxis domainAxis = new NumberAxis("X");
        ValueAxis rangeAxis = new NumberAxis("Y");
        FastScatterPlot plot = new FastScatterPlot(data, domainAxis,
                rangeAxis);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
Example #3
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link FastScatterPlot}.
 * 
 * @param plot  the plot ({@code null} not permitted).
 */
protected void applyToFastScatterPlot(FastScatterPlot plot) {
    plot.setDomainGridlinePaint(this.domainGridlinePaint);
    plot.setRangeGridlinePaint(this.rangeGridlinePaint);
    ValueAxis xAxis = plot.getDomainAxis();
    if (xAxis != null) {
        applyToValueAxis(xAxis);
    }
    ValueAxis yAxis = plot.getRangeAxis();
    if (yAxis != null) {
        applyToValueAxis(yAxis);
    }

}
 
Example #4
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link FastScatterPlot}.
 * 
 * @param plot  the plot ({@code null} not permitted).
 */
protected void applyToFastScatterPlot(FastScatterPlot plot) {
    plot.setDomainGridlinePaint(this.domainGridlinePaint);
    plot.setRangeGridlinePaint(this.rangeGridlinePaint);
    ValueAxis xAxis = plot.getDomainAxis();
    if (xAxis != null) {
        applyToValueAxis(xAxis);
    }
    ValueAxis yAxis = plot.getRangeAxis();
    if (yAxis != null) {
        applyToValueAxis(yAxis);
    }

}
 
Example #5
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link FastScatterPlot}.
 * 
 * @param plot  the plot ({@code null} not permitted).
 */
protected void applyToFastScatterPlot(FastScatterPlot plot) {
    plot.setDomainGridlinePaint(this.domainGridlinePaint);
    plot.setRangeGridlinePaint(this.rangeGridlinePaint);
    ValueAxis xAxis = plot.getDomainAxis();
    if (xAxis != null) {
        applyToValueAxis(xAxis);
    }
    ValueAxis yAxis = plot.getRangeAxis();
    if (yAxis != null) {
        applyToValueAxis(yAxis);
    }

}
 
Example #6
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link FastScatterPlot}.
 * @param plot
 */
protected void applyToFastScatterPlot(FastScatterPlot plot) {
    plot.setDomainGridlinePaint(this.domainGridlinePaint);
    plot.setRangeGridlinePaint(this.rangeGridlinePaint);
    ValueAxis xAxis = plot.getDomainAxis();
    if (xAxis != null) {
        applyToValueAxis(xAxis);
    }
    ValueAxis yAxis = plot.getRangeAxis();
    if (yAxis != null) {
        applyToValueAxis(yAxis);
    }

}
 
Example #7
Source File: FastScatterPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the data array equality in the equals() method.
 */
public void testEquals2() {
    FastScatterPlot plot1 = new FastScatterPlot();
    FastScatterPlot plot2 = new FastScatterPlot();
    assertTrue(plot1.equals(plot2));
    assertTrue(plot2.equals(plot1));

    float[][] a = new float[2][];
    float[][] b = new float[2][];
    plot1.setData(a);
    assertFalse(plot1.equals(plot2));
    plot2.setData(b);
    assertTrue(plot1.equals(plot2));

    a[0] = new float[6];
    assertFalse(plot1.equals(plot2));
    b[0] = new float[6];
    assertTrue(plot1.equals(plot2));

    a[0][0] = 1.0f;
    assertFalse(plot1.equals(plot2));
    b[0][0] = 1.0f;
    assertTrue(plot1.equals(plot2));

    a[0][1] = Float.NaN;
    assertFalse(plot1.equals(plot2));
    b[0][1] = Float.NaN;
    assertTrue(plot1.equals(plot2));

    a[0][2] = Float.POSITIVE_INFINITY;
    assertFalse(plot1.equals(plot2));
    b[0][2] = Float.POSITIVE_INFINITY;
    assertTrue(plot1.equals(plot2));

    a[0][3] = Float.NEGATIVE_INFINITY;
    assertFalse(plot1.equals(plot2));
    b[0][3] = Float.NEGATIVE_INFINITY;
    assertTrue(plot1.equals(plot2));
}
 
Example #8
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link FastScatterPlot}.
 * 
 * @param plot  the plot ({@code null} not permitted).
 */
protected void applyToFastScatterPlot(FastScatterPlot plot) {
    plot.setDomainGridlinePaint(this.domainGridlinePaint);
    plot.setRangeGridlinePaint(this.rangeGridlinePaint);
    ValueAxis xAxis = plot.getDomainAxis();
    if (xAxis != null) {
        applyToValueAxis(xAxis);
    }
    ValueAxis yAxis = plot.getRangeAxis();
    if (yAxis != null) {
        applyToValueAxis(yAxis);
    }

}
 
Example #9
Source File: ChartPanelShiftController.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Returns the plot orientation.
 * 
 * @return True = {@link org.jfree.chart.plot.PlotOrientation#VERTICAL VERTICAL}; False =
 *         {@link org.jfree.chart.plot.PlotOrientation#HORIZONTAL HORIZONTAL}
 */
protected boolean isHorizontalPlot(Plot plot) {
	if (plot instanceof XYPlot) {
		return ((XYPlot) plot).getOrientation() == PlotOrientation.HORIZONTAL;
	}
	if (plot instanceof FastScatterPlot) {
		return ((FastScatterPlot) plot).getOrientation() == PlotOrientation.HORIZONTAL;
	}
	return false;
}
 
Example #10
Source File: ChartPanelShiftController.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new controller to handle plot shifts.
 * 
 * @param chartPanel
 *            The panel displaying the plot.
 */
public ChartPanelShiftController(ChartPanel chartPanel) {
	super();
	this.chartPanel = chartPanel;

	// Check to see if plot is shiftable
	Plot plot = chartPanel.getChart().getPlot();
	if ((plot instanceof XYPlot) || (plot instanceof FastScatterPlot)) {
		plotSupported = true;
		axesSwaped = isHorizontalPlot(plot);
	}
}
 
Example #11
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link FastScatterPlot}.
 * 
 * @param plot  the plot ({@code null} not permitted).
 */
protected void applyToFastScatterPlot(FastScatterPlot plot) {
    plot.setDomainGridlinePaint(this.domainGridlinePaint);
    plot.setRangeGridlinePaint(this.rangeGridlinePaint);
    ValueAxis xAxis = plot.getDomainAxis();
    if (xAxis != null) {
        applyToValueAxis(xAxis);
    }
    ValueAxis yAxis = plot.getRangeAxis();
    if (yAxis != null) {
        applyToValueAxis(yAxis);
    }

}
 
Example #12
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link FastScatterPlot}.
 * 
 * @param plot  the plot ({@code null} not permitted).
 */
protected void applyToFastScatterPlot(FastScatterPlot plot) {
    plot.setDomainGridlinePaint(this.domainGridlinePaint);
    plot.setRangeGridlinePaint(this.rangeGridlinePaint);
    ValueAxis xAxis = plot.getDomainAxis();
    if (xAxis != null) {
        applyToValueAxis(xAxis);
    }
    ValueAxis yAxis = plot.getRangeAxis();
    if (yAxis != null) {
        applyToValueAxis(yAxis);
    }

}
 
Example #13
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 #14
Source File: FastScatterPlotTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
public void testEquals() {

    FastScatterPlot plot1 = new FastScatterPlot();
    FastScatterPlot plot2 = new FastScatterPlot();
    assertTrue(plot1.equals(plot2));
    assertTrue(plot2.equals(plot1));

    plot1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));

    plot1.setDomainGridlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinesVisible(false);
    assertTrue(plot1.equals(plot2));

    plot1.setDomainGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));

    Stroke s = new BasicStroke(1.5f);
    plot1.setDomainGridlineStroke(s);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlineStroke(s);
    assertTrue(plot1.equals(plot2));

    plot1.setRangeGridlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinesVisible(false);
    assertTrue(plot1.equals(plot2));

    plot1.setRangeGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.green,
            3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.green,
            3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));

    Stroke s2 = new BasicStroke(1.5f);
    plot1.setRangeGridlineStroke(s2);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlineStroke(s2);
    assertTrue(plot1.equals(plot2));

    plot1.setDomainPannable(true);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainPannable(true);
    assertTrue(plot1.equals(plot2));

    plot1.setRangePannable(true);
    assertFalse(plot1.equals(plot2));
    plot2.setRangePannable(true);
    assertTrue(plot1.equals(plot2));

}
 
Example #15
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 #16
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 #17
Source File: FastScatterPlotTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
public void testEquals() {
    
    FastScatterPlot plot1 = new FastScatterPlot();
    FastScatterPlot plot2 = new FastScatterPlot();
    assertTrue(plot1.equals(plot2));    
    assertTrue(plot2.equals(plot1));
    
    plot1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 
            3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 
            3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));
    
    plot1.setDomainGridlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinesVisible(false);
    assertTrue(plot1.equals(plot2));
    
    plot1.setDomainGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 
            3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 
            3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));
    
    Stroke s = new BasicStroke(1.5f);
    plot1.setDomainGridlineStroke(s);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlineStroke(s);
    assertTrue(plot1.equals(plot2));
    
    plot1.setRangeGridlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinesVisible(false);
    assertTrue(plot1.equals(plot2));
    
    plot1.setRangeGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.green, 
            3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.green, 
            3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));
    
    Stroke s2 = new BasicStroke(1.5f);
    plot1.setRangeGridlineStroke(s2);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlineStroke(s2);
    assertTrue(plot1.equals(plot2));
    
}
 
Example #18
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 #19
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 #20
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 #21
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);
    }
}