Search code examples
javaswingjfreechartzooming

JFreeChart Maximum Zoom Out


I am working with JFreeChart to create a line graph via an XYPlot which is embedded into an application. The graph is contained within a ChartPanel and added to the background panel of my GUI.

My issue is that the XYPlot appears so zoomed in that I am unable to see any of the lines; simply the whitespace background each side of them!

Is there a way to view the component at its "maximum zoomed out" state so that the graph is understandable?

Many thanks :)


Solution

  • The setZoomInFactor() method works well for this, but you'll have to define maximum to choose the factor. This example shows how to add a control that manipulates the zoom state.