Search code examples
javajfreechart

Split histogram - JfreeChart


I built an histogram with Java using JFreeChart API, but I have an issue with large dataset. For example, this is the different between a large and a small dataset:
This is the histogram with a small dataset: enter image description here

But when I have a very large dataset this is the result: enter image description here

When I have a large dataset is there any way to split the histogram in smaller pieces?


Solution

  • Assuming ChartFactory.createXYBarChart(), here are some approaches:

    • Zoom the chart by either dragging a selection or using the context menu,

    • Add custom controls, illustrated here.

    • Use a custom SlidingXYDataset; an example is cited here.

    • Adopt a paging approach, shown here.