2

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

mKorbel
  • 109,107
  • 18
  • 130
  • 305

2 Answers2

1

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

korfax
  • 11
  • 3
1

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.

Community
  • 1
  • 1
trashgod
  • 200,320
  • 28
  • 229
  • 974