Java Code Examples for org.jfree.chart.renderer.category.LineAndShapeRenderer#setBaseShapesFilled()

The following examples show how to use org.jfree.chart.renderer.category.LineAndShapeRenderer#setBaseShapesFilled() . 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: LineChartExpression.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void configureChart( final JFreeChart chart ) {
  super.configureChart( chart );

  final CategoryPlot cpl = chart.getCategoryPlot();
  final CategoryItemRenderer renderer = cpl.getRenderer();
  renderer.setStroke( translateLineStyle( lineWidth, lineStyle ) );
  if ( renderer instanceof LineAndShapeRenderer ) {
    final LineAndShapeRenderer shapeRenderer = (LineAndShapeRenderer) renderer;
    shapeRenderer.setShapesVisible( isMarkersVisible() );
    shapeRenderer.setBaseShapesFilled( isMarkersVisible() );
  }

}
 
Example 2
Source File: IntervalChartBuilder.java    From nmonvisualizer with Apache License 2.0 5 votes vote down vote up
@Override
protected void formatChart() {
    super.formatChart();

    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    plot.getDomainAxis().setLabel(definition.getXAxisLabel());
    plot.getRangeAxis().setLabel(definition.getYAxisLabel());

    if (definition.usePercentYAxis()) {
        setPercentYAxis();
    }

    for (int i = 0; i < plot.getRendererCount(); i++) {
        LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(i);

        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);

        renderer.setBaseToolTipGenerator(
                new StandardCategoryToolTipGenerator("{1} {0} - {2}", new DecimalFormat("#,##0.00")));
    }

    // position of first line start and last line end
    // 1.5% of the chart area within the axis will be blank space on each end
    plot.getDomainAxis().setLowerMargin(.015);
    plot.getDomainAxis().setUpperMargin(.015);

    // position of first point start and last line end
    // 1.5% of the chart area within the axis will be blank space on each end
    plot.getDomainAxis().setLowerMargin(.015);
    plot.getDomainAxis().setUpperMargin(.015);

    // let each interval name have as much room as possible
    plot.getDomainAxis().setCategoryMargin(0);
}
 
Example 3
Source File: LineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
public void testEquals() {

    LineAndShapeRenderer r1 = new LineAndShapeRenderer();
    LineAndShapeRenderer r2 = new LineAndShapeRenderer();
    assertEquals(r1, r2);

    r1.setBaseLinesVisible(!r1.getBaseLinesVisible());
    assertFalse(r1.equals(r2));
    r2.setBaseLinesVisible(r1.getBaseLinesVisible());
    assertTrue(r1.equals(r2));

    r1.setSeriesLinesVisible(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesLinesVisible(1, true);
    assertTrue(r1.equals(r2));

    r1.setBaseShapesVisible(!r1.getBaseShapesVisible());
    assertFalse(r1.equals(r2));
    r2.setBaseShapesVisible(r1.getBaseShapesVisible());
    assertTrue(r1.equals(r2));

    r1.setSeriesShapesVisible(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesShapesVisible(1, true);
    assertTrue(r1.equals(r2));

    r1.setSeriesShapesFilled(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesShapesFilled(1, true);
    assertTrue(r1.equals(r2));

    r1.setBaseShapesFilled(false);
    assertFalse(r1.equals(r2));
    r2.setBaseShapesFilled(false);
    assertTrue(r1.equals(r2));

    r1.setUseOutlinePaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(true);
    assertTrue(r1.equals(r2));

    r1.setUseSeriesOffset(true);
    assertFalse(r1.equals(r2));
    r2.setUseSeriesOffset(true);
    assertTrue(r1.equals(r2));

    r1.setItemMargin(0.14);
    assertFalse(r1.equals(r2));
    r2.setItemMargin(0.14);
    assertTrue(r1.equals(r2));

}
 
Example 4
Source File: LineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Checks that the two renderers are equal but independent of one another.
 *
 * @param r1  renderer 1.
 * @param r2  renderer 2.
 *
 * @return A boolean.
 */
private boolean checkIndependence(LineAndShapeRenderer r1,
                                  LineAndShapeRenderer r2) {

    // should be equal...
    if (!r1.equals(r2)) {
        return false;
    }

    // and independent...
    r1.setBaseLinesVisible(!r1.getBaseLinesVisible());
    if (r1.equals(r2)) {
        return false;
    }
    r2.setBaseLinesVisible(r1.getBaseLinesVisible());
    if (!r1.equals(r2)) {
        return false;
    }

    r1.setSeriesLinesVisible(1, true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setSeriesLinesVisible(1, true);
    if (!r1.equals(r2)) {
        return false;
    }

    r1.setBaseShapesVisible(!r1.getBaseShapesVisible());
    if (r1.equals(r2)) {
        return false;
    }
    r2.setBaseShapesVisible(r1.getBaseShapesVisible());
    if (!r1.equals(r2)) {
        return false;
    }

    r1.setSeriesShapesVisible(1, true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setSeriesShapesVisible(1, true);
    if (!r1.equals(r2)) {
        return false;
    }

    r1.setSeriesShapesFilled(0, false);
    r2.setSeriesShapesFilled(0, true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setSeriesShapesFilled(0, false);
    if (!r1.equals(r2)) {
        return false;
    }

    r1.setBaseShapesFilled(false);
    r2.setBaseShapesFilled(true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setBaseShapesFilled(false);
    if (!r1.equals(r2)) {
        return false;
    }
    return true;

}
 
Example 5
Source File: LineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
public void testEquals() {
    
    LineAndShapeRenderer r1 = new LineAndShapeRenderer();
    LineAndShapeRenderer r2 = new LineAndShapeRenderer();
    assertEquals(r1, r2);
    
    r1.setBaseLinesVisible(!r1.getBaseLinesVisible());
    assertFalse(r1.equals(r2));
    r2.setBaseLinesVisible(r1.getBaseLinesVisible());
    assertTrue(r1.equals(r2));
    
    r1.setSeriesLinesVisible(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesLinesVisible(1, true);
    assertTrue(r1.equals(r2));
    
    r1.setBaseShapesVisible(!r1.getBaseShapesVisible());
    assertFalse(r1.equals(r2));
    r2.setBaseShapesVisible(r1.getBaseShapesVisible());
    assertTrue(r1.equals(r2));
    
    r1.setSeriesShapesVisible(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesShapesVisible(1, true);
    assertTrue(r1.equals(r2));
    
    r1.setSeriesShapesFilled(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesShapesFilled(1, true);
    assertTrue(r1.equals(r2));
    
    r1.setBaseShapesFilled(false);
    assertFalse(r1.equals(r2));
    r2.setBaseShapesFilled(false);
    assertTrue(r1.equals(r2));
    
    r1.setUseOutlinePaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(true);
    assertTrue(r1.equals(r2));
    
    r1.setUseSeriesOffset(true);
    assertFalse(r1.equals(r2));
    r2.setUseSeriesOffset(true);
    assertTrue(r1.equals(r2));
    
    r1.setItemMargin(0.14);
    assertFalse(r1.equals(r2));
    r2.setItemMargin(0.14);
    assertTrue(r1.equals(r2));
    
}
 
Example 6
Source File: LineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Checks that the two renderers are equal but independent of one another.
 * 
 * @param r1  renderer 1.
 * @param r2  renderer 2.
 * 
 * @return A boolean.
 */
private boolean checkIndependence(LineAndShapeRenderer r1, 
                                  LineAndShapeRenderer r2) {

    // should be equal...
    if (!r1.equals(r2)) {
        return false;
    }
    
    // and independent...        
    r1.setBaseLinesVisible(!r1.getBaseLinesVisible());
    if (r1.equals(r2)) {
        return false;
    }
    r2.setBaseLinesVisible(r1.getBaseLinesVisible());
    if (!r1.equals(r2)) {
        return false;
    }

    r1.setSeriesLinesVisible(1, true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setSeriesLinesVisible(1, true);
    if (!r1.equals(r2)) {
        return false;
    }
    
    r1.setBaseShapesVisible(!r1.getBaseShapesVisible());
    if (r1.equals(r2)) {
        return false;
    }
    r2.setBaseShapesVisible(r1.getBaseShapesVisible());
    if (!r1.equals(r2)) {
        return false;
    }

    r1.setSeriesShapesVisible(1, true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setSeriesShapesVisible(1, true);
    if (!r1.equals(r2)) {
        return false;
    }

    r1.setSeriesShapesFilled(0, false);
    r2.setSeriesShapesFilled(0, true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setSeriesShapesFilled(0, false);
    if (!r1.equals(r2)) {
        return false;
    }
    
    r1.setBaseShapesFilled(false);
    r2.setBaseShapesFilled(true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setBaseShapesFilled(false);
    if (!r1.equals(r2)) {
        return false;
    }
    return true;

}