Java Code Examples for org.jfree.chart.renderer.category.BoxAndWhiskerRenderer#setArtifactPaint()

The following examples show how to use org.jfree.chart.renderer.category.BoxAndWhiskerRenderer#setArtifactPaint() . 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: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
public void testEquals() {
    BoxAndWhiskerRenderer r1 = new BoxAndWhiskerRenderer();
    BoxAndWhiskerRenderer r2 = new BoxAndWhiskerRenderer();
    assertEquals(r1, r2);
    
    r1.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 
            3.0f, 4.0f, Color.blue));
    assertFalse(r1.equals(r2));
    r2.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 
            3.0f, 4.0f, Color.blue));
    assertEquals(r1, r2);
    
    r1.setFillBox(!r1.getFillBox());
    assertFalse(r1.equals(r2));
    r2.setFillBox(!r2.getFillBox());
    assertEquals(r1, r2);
    
    r1.setItemMargin(0.11);
    assertFalse(r1.equals(r2));
    r2.setItemMargin(0.11);
    assertEquals(r1, r2);
    
}
 
Example 2
Source File: SimpleBox.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
public JFreeChart createChart(DatasetMap datasetMap) {

		BoxAndWhiskerCategoryDataset dataset=(BoxAndWhiskerCategoryDataset)datasetMap.getDatasets().get("1"); 

		JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(
				name, categoryLabel, valueLabel, dataset, 
				false);

		TextTitle title =setStyleTitle(name, styleTitle);
		chart.setTitle(title);
		if(subName!= null && !subName.equals("")){
			TextTitle subTitle =setStyleTitle(subName, styleSubTitle);
			chart.addSubtitle(subTitle);
		}
		
		CategoryPlot plot = (CategoryPlot) chart.getPlot();
		BoxAndWhiskerRenderer renderer=(BoxAndWhiskerRenderer)plot.getRenderer();
		chart.setBackgroundPaint(Color.white);

		plot.setBackgroundPaint(new Color(Integer.decode("#c0c0c0").intValue()));
		plot.setDomainGridlinePaint(Color.WHITE);
		plot.setDomainGridlinesVisible(true);
		plot.setRangeGridlinePaint(Color.white);
		renderer.setFillBox(true);
		renderer.setArtifactPaint(Color.BLACK);
		renderer.setSeriesPaint(0,new Color(Integer.decode("#0000FF").intValue()));

		NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
		rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
		rangeAxis.setRange(min, max);

		return chart;
	}
 
Example 3
Source File: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
public void testEquals() {
    BoxAndWhiskerRenderer r1 = new BoxAndWhiskerRenderer();
    BoxAndWhiskerRenderer r2 = new BoxAndWhiskerRenderer();
    assertEquals(r1, r2);

    r1.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
            3.0f, 4.0f, Color.blue));
    assertFalse(r1.equals(r2));
    r2.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
            3.0f, 4.0f, Color.blue));
    assertEquals(r1, r2);

    r1.setFillBox(!r1.getFillBox());
    assertFalse(r1.equals(r2));
    r2.setFillBox(!r2.getFillBox());
    assertEquals(r1, r2);

    r1.setItemMargin(0.11);
    assertFalse(r1.equals(r2));
    r2.setItemMargin(0.11);
    assertEquals(r1, r2);

    r1.setMaximumBarWidth(0.99);
    assertFalse(r1.equals(r2));
    r2.setMaximumBarWidth(0.99);
    assertTrue(r1.equals(r2));

    // the default for meanVisible is false in 1.2.x
    r1.setMeanVisible(true);
    assertFalse(r1.equals(r2));
    r2.setMeanVisible(true);
    assertTrue(r1.equals(r2));

    r1.setMedianVisible(false);
    assertFalse(r1.equals(r2));
    r2.setMedianVisible(false);
    assertTrue(r1.equals(r2));
}