Mered Williams
Mered Williams

Reputation: 95

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 :)

Upvotes: 2

Views: 2525

Answers (2)

korfax
korfax

Reputation: 11

Maybe, you should try to use

getChartPanel().zoomInRange(1, 2); getChartPanel().restoreAutoBounds()

Sometimes, only zoomOut just didn't worked for me, so I added zoomIn first and all worked well

Upvotes: 1

trashgod
trashgod

Reputation: 205785

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.

Upvotes: 1

Related Questions