Add a jfree bar chart into a scroll pane

2019-09-16 18:10发布

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

1条回答
小情绪 Triste *
2楼-- · 2019-09-16 19:01

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.

查看更多
登录 后发表回答