#1127 Empty XYPlot when one dataset is empty

1.0.x
closed-fixed
David Gilbert
None
5
2014-07-29
2014-04-23
exeba
No

When one of the timeseires is empty, the resulting plot becomes empty as well.
Furthermore, when the empty dataset is added, the return value of "plot.getDataRange(rangeAxis)" becomes "[NaN,NaN]"

private static JFreeChart createChart() {

    XYPlot plot = new XYPlot();
    ValueAxis rangeAxis = new NumberAxis();
    plot.setRangeAxis(0,rangeAxis);
    plot.setDomainAxis(0, new DateAxis());

    /* Adding non-empty dataset */
    plot.setDataset(0,createNonEmptyDataset());
    plot.setRenderer(0, new XYLineAndShapeRenderer());
    plot.mapDatasetToRangeAxis(0, 0);
    plot.mapDatasetToDomainAxis(0, 0);
    System.out.println(plot.getDataRange(rangeAxis)); // Outputs: Range[153.8,181.8]

    /* Adding empty dataset */
    plot.setDataset(1,createEmptyDataset());
    plot.setRenderer(1, new XYLineAndShapeRenderer());
    plot.mapDatasetToRangeAxis(1, 0);
    plot.mapDatasetToDomainAxis(1, 0);
    System.out.println(plot.getDataRange(rangeAxis)); // Outputs: Range[NaN,NaN]

    return new JFreeChart(plot);
}
1 Attachments

Discussion

  • David Gilbert
    David Gilbert
    2014-04-23

    Thanks for the report. There are changes already committed for the upcoming 1.0.18 release that fix this issue.

     
  • simon04
    simon04
    2014-07-26

    So this ticket can be closed?

     
  • David Gilbert
    David Gilbert
    2014-07-29

    Yes, closing.

     
  • David Gilbert
    David Gilbert
    2014-07-29

    • status: open --> closed-fixed
    • assigned_to: David Gilbert