Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1120 StackedXYAreaRenderer displays null values as zero

1.0.x
open
nobody
5
2013-12-02
2013-12-02
Igor Rodriguez
No

StackedXYAreaRenderer displays null values as zero. Displaying a value, even zero, is not appropriate. The problem is even more noticeable with stacked polylines. I'm using version 1.0.16.

See example:

public class StackedPolylineRendererTest {
public static void main( String[] args ) {
final JFreeChart chart = ChartFactory.createStackedXYAreaChart( "Null Values Rendered As Zero", null, null, createDataSet(), PlotOrientation.VERTICAL, true, false, false );
chart.getXYPlot().setRenderer( new StackedXYAreaRenderer(XYAreaRenderer.LINES) );

    final JFrame frame = new JFrame( "Test Rendering Of Null Values" ); 
    frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
    frame.setPreferredSize( new Dimension( 800, 600 ) );
    frame.add( new ChartPanel( chart ) );
    frame.pack();
    frame.setVisible( true );
}

private static TableXYDataset createDataSet() {
    final XYSeries s = new XYSeries( "Series", true, false ); //$NON-NLS-1$
    s.add( 1, 1 );
    s.add( 2, 2 );
    s.add( 3, null );
    s.add( 4, 4 );
    s.add( 5, 5 );

    final DefaultTableXYDataset dataSet = new DefaultTableXYDataset();
    dataSet.addSeries( s );

    return dataSet;
}

}

2 Attachments

Discussion