org.jfree.chart.plot.DefaultDrawingSupplier Java Examples

The following examples show how to use org.jfree.chart.plot.DefaultDrawingSupplier. 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: AbstractRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #2
Source File: AbstractRendererTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #3
Source File: AbstractRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the outline paint lookup mechanism.
 */
public void testOutlinePaintLookup() {
    BarRenderer r = new BarRenderer();
    assertEquals(Color.gray, r.getBaseOutlinePaint());
    
    // 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));
}
 
Example #4
Source File: AbstractRendererTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #5
Source File: AbstractRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #6
Source File: AbstractRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #7
Source File: AbstractRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Some checks for the outline paint lookup mechanism.
 */
@Test
public void testOutlinePaintLookup() {
    BarRenderer r = new BarRenderer();
    assertEquals(Color.gray, r.getBaseOutlinePaint());

    // 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));
}
 
Example #8
Source File: AbstractRendererTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #9
Source File: AbstractRendererTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Some checks for the outline paint lookup mechanism.
 */
@Test
public void testOutlinePaintLookup() {
    BarRenderer r = new BarRenderer();
    assertEquals(Color.gray, r.getBaseOutlinePaint());

    // 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));
}
 
Example #10
Source File: AbstractRendererTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Some checks for the outline paint lookup mechanism.
 */
@Test
public void testOutlinePaintLookup() {
    BarRenderer r = new BarRenderer();
    assertEquals(Color.gray, r.getBaseOutlinePaint());

    // 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));
}
 
Example #11
Source File: AbstractRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the fill paint lookup mechanism.
 */
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));
}
 
Example #12
Source File: AbstractRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the paint lookup mechanism.
 */
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));
}
 
Example #13
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 #14
Source File: AbstractRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the outline paint lookup mechanism.
 */
public void testOutlinePaintLookup() {
    BarRenderer r = new BarRenderer();
    assertEquals(Color.gray, r.getBaseOutlinePaint());

    // 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));
}
 
Example #15
Source File: SimpleChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected Paint[] getOutlinePaintSequence(PlotSettings plotSettings)
{
	List<PaintProvider> outlinePaintSequenceProvider = plotSettings.getSeriesOutlinePaintSequence();
	Paint[] outlinePaintSequence = null;
	if (outlinePaintSequenceProvider != null && !outlinePaintSequenceProvider.isEmpty())
	{
		outlinePaintSequence = new Paint[outlinePaintSequenceProvider.size()];
		for (int i=0; i< outlinePaintSequenceProvider.size(); i++)
		{
			outlinePaintSequence[i] = outlinePaintSequenceProvider.get(i).getPaint();
		}
	}
	else
	{
		outlinePaintSequence = DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE;
	}
	return outlinePaintSequence;
}
 
Example #16
Source File: AbstractRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the fill paint lookup mechanism.
 */
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));
}
 
Example #17
Source File: AbstractRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the paint lookup mechanism.
 */
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));
}
 
Example #18
Source File: AbstractRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #19
Source File: AbstractRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #20
Source File: AbstractRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Some checks for the outline paint lookup mechanism.
 */
@Test
public void testOutlinePaintLookup() {
    BarRenderer r = new BarRenderer();
    assertEquals(Color.gray, r.getBaseOutlinePaint());

    // 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));
}
 
Example #21
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates and returns a theme called "Darkness".  In this theme, the
 * charts have a black background.
 *
 * @return The "Darkness" theme.
 */
public static ChartTheme createDarknessTheme() {
    StandardChartTheme theme = new StandardChartTheme("Darkness");
    theme.titlePaint = Color.white;
    theme.subtitlePaint = Color.white;
    theme.legendBackgroundPaint = Color.black;
    theme.legendItemPaint = Color.white;
    theme.chartBackgroundPaint = Color.black;
    theme.plotBackgroundPaint = Color.black;
    theme.plotOutlinePaint = Color.yellow;
    theme.baselinePaint = Color.white;
    theme.crosshairPaint = Color.red;
    theme.labelLinkPaint = Color.lightGray;
    theme.tickLabelPaint = Color.white;
    theme.axisLabelPaint = Color.white;
    theme.shadowPaint = Color.darkGray;
    theme.itemLabelPaint = Color.white;
    theme.drawingSupplier = new DefaultDrawingSupplier(
            new Paint[] {Color.decode("0xFFFF00"),
                    Color.decode("0x0036CC"), Color.decode("0xFF0000"),
                    Color.decode("0xFFFF7F"), Color.decode("0x6681CC"),
                    Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"),
                    Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"),
                    Color.decode("0xA9A938"), Color.decode("0x2D4587")},
            new Paint[] {Color.decode("0xFFFF00"),
                    Color.decode("0x0036CC")},
            new Stroke[] {new BasicStroke(2.0f)},
            new Stroke[] {new BasicStroke(0.5f)},
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    theme.wallPaint = Color.darkGray;
    theme.errorIndicatorPaint = Color.lightGray;
    theme.gridBandPaint = new Color(255, 255, 255, 20);
    theme.gridBandAlternatePaint = new Color(255, 255, 255, 40);
    return theme;
}
 
Example #22
Source File: AbstractRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the outline paint lookup mechanism.
 */
@Test
public void testOutlinePaintLookup() {
    BarRenderer r = new BarRenderer();
    assertEquals(Color.gray, r.getBaseOutlinePaint());

    // 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));
}
 
Example #23
Source File: AbstractRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #24
Source File: AbstractRendererTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #25
Source File: MultiAgentPerformancePlotter.java    From burlap with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a DeviationRenderer to use for the trial average plots
 * @return a DeviationRenderer
 */
protected DeviationRenderer createDeviationRenderer(){
	DeviationRenderer renderer = new DeviationRenderer(true, false);
	
	for(int i = 0; i < DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length; i++){
		Color c = (Color)DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[i];
		Color nc = new Color(c.getRed(), c.getGreen(), c.getBlue(), 100);
		renderer.setSeriesFillPaint(i, nc);
	}
	
	return renderer;
}
 
Example #26
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates and returns a theme called "Darkness".  In this theme, the
 * charts have a black background.
 *
 * @return The "Darkness" theme.
 */
public static ChartTheme createDarknessTheme() {
    StandardChartTheme theme = new StandardChartTheme("Darkness");
    theme.titlePaint = Color.white;
    theme.subtitlePaint = Color.white;
    theme.legendBackgroundPaint = Color.black;
    theme.legendItemPaint = Color.white;
    theme.chartBackgroundPaint = Color.black;
    theme.plotBackgroundPaint = Color.black;
    theme.plotOutlinePaint = Color.yellow;
    theme.baselinePaint = Color.white;
    theme.crosshairPaint = Color.red;
    theme.labelLinkPaint = Color.lightGray;
    theme.tickLabelPaint = Color.white;
    theme.axisLabelPaint = Color.white;
    theme.shadowPaint = Color.darkGray;
    theme.itemLabelPaint = Color.white;
    theme.drawingSupplier = new DefaultDrawingSupplier(
            new Paint[] {Color.decode("0xFFFF00"),
                    Color.decode("0x0036CC"), Color.decode("0xFF0000"),
                    Color.decode("0xFFFF7F"), Color.decode("0x6681CC"),
                    Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"),
                    Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"),
                    Color.decode("0xA9A938"), Color.decode("0x2D4587")},
            new Paint[] {Color.decode("0xFFFF00"),
                    Color.decode("0x0036CC")},
            new Stroke[] {new BasicStroke(2.0f)},
            new Stroke[] {new BasicStroke(0.5f)},
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    theme.wallPaint = Color.darkGray;
    theme.errorIndicatorPaint = Color.lightGray;
    theme.gridBandPaint = new Color(255, 255, 255, 20);
    theme.gridBandAlternatePaint = new Color(255, 255, 255, 40);
    theme.shadowGenerator = null;
    return theme;
}
 
Example #27
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a theme called "Darkness".  In this theme, the
 * charts have a black background.
 *
 * @return The "Darkness" theme.
 */
public static ChartTheme createDarknessTheme() {
    StandardChartTheme theme = new StandardChartTheme("Darkness");
    theme.titlePaint = Color.white;
    theme.subtitlePaint = Color.white;
    theme.legendBackgroundPaint = Color.black;
    theme.legendItemPaint = Color.white;
    theme.chartBackgroundPaint = Color.black;
    theme.plotBackgroundPaint = Color.black;
    theme.plotOutlinePaint = Color.yellow;
    theme.baselinePaint = Color.white;
    theme.crosshairPaint = Color.red;
    theme.labelLinkPaint = Color.lightGray;
    theme.tickLabelPaint = Color.white;
    theme.axisLabelPaint = Color.white;
    theme.shadowPaint = Color.darkGray;
    theme.itemLabelPaint = Color.white;
    theme.drawingSupplier = new DefaultDrawingSupplier(
            new Paint[] {Color.decode("0xFFFF00"),
                    Color.decode("0x0036CC"), Color.decode("0xFF0000"),
                    Color.decode("0xFFFF7F"), Color.decode("0x6681CC"),
                    Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"),
                    Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"),
                    Color.decode("0xA9A938"), Color.decode("0x2D4587")},
            new Paint[] {Color.decode("0xFFFF00"),
                    Color.decode("0x0036CC")},
            new Stroke[] {new BasicStroke(2.0f)},
            new Stroke[] {new BasicStroke(0.5f)},
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    theme.wallPaint = Color.darkGray;
    theme.errorIndicatorPaint = Color.lightGray;
    theme.gridBandPaint = new Color(255, 255, 255, 20);
    theme.gridBandAlternatePaint = new Color(255, 255, 255, 40);
    theme.shadowGenerator = null;
    return theme;
}
 
Example #28
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new default instance.
 *
 * @param name  the name of the theme (<code>null</code> not permitted).
 * @param shadow  a flag that controls whether a shadow generator is 
 *                included.
 *
 * @since 1.0.14
 */
public StandardChartTheme(String name, boolean shadow) {
    ParamChecks.nullNotPermitted(name, "name");
    this.name = name;
    this.extraLargeFont = new Font("Tahoma", Font.BOLD, 20);
    this.largeFont = new Font("Tahoma", Font.BOLD, 14);
    this.regularFont = new Font("Tahoma", Font.PLAIN, 12);
    this.smallFont = new Font("Tahoma", Font.PLAIN, 10);
    this.titlePaint = Color.black;
    this.subtitlePaint = Color.black;
    this.legendBackgroundPaint = Color.white;
    this.legendItemPaint = Color.darkGray;
    this.chartBackgroundPaint = Color.white;
    this.drawingSupplier = new DefaultDrawingSupplier();
    this.plotBackgroundPaint = Color.lightGray;
    this.plotOutlinePaint = Color.black;
    this.labelLinkPaint = Color.black;
    this.labelLinkStyle = PieLabelLinkStyle.CUBIC_CURVE;
    this.axisOffset = new RectangleInsets(4, 4, 4, 4);
    this.domainGridlinePaint = Color.white;
    this.rangeGridlinePaint = Color.white;
    this.baselinePaint = Color.black;
    this.crosshairPaint = Color.blue;
    this.axisLabelPaint = Color.darkGray;
    this.tickLabelPaint = Color.darkGray;
    this.barPainter = new GradientBarPainter();
    this.xyBarPainter = new GradientXYBarPainter();
    this.shadowVisible = false;
    this.shadowPaint = Color.gray;
    this.itemLabelPaint = Color.black;
    this.thermometerPaint = Color.white;
    this.wallPaint = BarRenderer3D.DEFAULT_WALL_PAINT;
    this.errorIndicatorPaint = Color.black;
    this.shadowGenerator = shadow ? new DefaultShadowGenerator() : null;
}
 
Example #29
Source File: ObdDataPlotter.java    From AndrOBD with GNU General Public License v3.0 5 votes vote down vote up
/**
 * add a new series to the graph
 *
 * @param series The new series to be added
 */
public synchronized void addSeries(TimeSeries series)
{

	if (oneRangePerSeries)
	{
		// get paint for current axis/range/...
		Paint currPaint =
			DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[
				raIndex % DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length];

		XYPlot plot = (XYPlot) chart.getPlot();
		// set dataset
		plot.setDataset(raIndex, new TimeSeriesCollection(series));
		// ** set axis
		NumberAxis axis = new NumberAxis();
		axis.setTickLabelFont(legendFont);
		axis.setAxisLinePaint(currPaint);
		axis.setTickLabelPaint(currPaint);
		axis.setTickMarkPaint(currPaint);
		// ** set axis in plot
		plot.setRangeAxis(raIndex, axis);
		plot.setRangeAxisLocation(raIndex, raIndex % 2 == 0 ? AxisLocation.TOP_OR_LEFT : AxisLocation.BOTTOM_OR_RIGHT);
		plot.mapDatasetToRangeAxis(raIndex, raIndex);
		// ** create renderer
		XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
		renderer.setBaseToolTipGenerator(toolTipGen);
		renderer.setSeriesPaint(0, currPaint);
		// ** set renderer in plot
		plot.setRenderer(raIndex, renderer);

		raIndex++;
	}
	dataset.addSeries(series);
}
 
Example #30
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates and returns a theme called "Darkness".  In this theme, the
 * charts have a black background.
 *
 * @return The "Darkness" theme.
 */
public static ChartTheme createDarknessTheme() {
    StandardChartTheme theme = new StandardChartTheme("Darkness");
    theme.titlePaint = Color.white;
    theme.subtitlePaint = Color.white;
    theme.legendBackgroundPaint = Color.black;
    theme.legendItemPaint = Color.white;
    theme.chartBackgroundPaint = Color.black;
    theme.plotBackgroundPaint = Color.black;
    theme.plotOutlinePaint = Color.yellow;
    theme.baselinePaint = Color.white;
    theme.crosshairPaint = Color.red;
    theme.labelLinkPaint = Color.lightGray;
    theme.tickLabelPaint = Color.white;
    theme.axisLabelPaint = Color.white;
    theme.shadowPaint = Color.darkGray;
    theme.itemLabelPaint = Color.white;
    theme.drawingSupplier = new DefaultDrawingSupplier(
            new Paint[] {Color.decode("0xFFFF00"),
                    Color.decode("0x0036CC"), Color.decode("0xFF0000"),
                    Color.decode("0xFFFF7F"), Color.decode("0x6681CC"),
                    Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"),
                    Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"),
                    Color.decode("0xA9A938"), Color.decode("0x2D4587")},
            new Paint[] {Color.decode("0xFFFF00"),
                    Color.decode("0x0036CC")},
            new Stroke[] {new BasicStroke(2.0f)},
            new Stroke[] {new BasicStroke(0.5f)},
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    theme.wallPaint = Color.darkGray;
    theme.errorIndicatorPaint = Color.lightGray;
    theme.gridBandPaint = new Color(255, 255, 255, 20);
    theme.gridBandAlternatePaint = new Color(255, 255, 255, 40);
    theme.shadowGenerator = null;
    return theme;
}