0

I have a JFree Bar Chart. the dataset is populated using DefaultCategoryDataset , There may be situations when the values on both the domain and range axis are such that these values are not very clearly visible.

I need something like a scrollPane into which the chart can be added. But it looks like the ChartPanel cannot be added into a JScrollPane

Is there any way of doing this ?

Thanks Bhavya

N West
  • 6,768
  • 25
  • 40
Bhavya
  • 11
  • 3

1 Answers1

1

You can use setLowerMargin() and/or getUpperMargin() on the relevant CategoryAxis to improve the appearance. Alternatively, you can use a SlidingCategoryDataset in conjunction with a JSlider.

Addendum: A third alternative is to use zooming, which is enabled by default, as shown here.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • @trashgod for total lazyness by OP to read official tutorial +1 – mKorbel Jun 23 '11 at 06:04
  • @trashgod , i would like to make some more changes so that the graph looks better many be I can attach the graph and how it looks like for your suggestions . how do i attach a file here ? – Bhavya Jun 23 '11 at 06:07
  • @mkorbel where is this official tutorial is this the JFreeChart documentation ? – Bhavya Jun 23 '11 at 06:08
  • 1
    @mKorbel: I can recommend the free [examples](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/demo/package-frame.html)(click class name for source) and the modestly priced [JFreeChart Developer Guide](http://www.jfree.org/jfreechart/devguide.html). @Bhavya: You can edit your question to include code or links. Disclaimer: not affiliated with Object Refinery. – trashgod Jun 23 '11 at 06:17