简体   繁体   English

将jfree条形图添加到滚动窗格中

[英]Add a jfree bar chart into a scroll pane

I have a JFree Bar Chart. 我有一个JFree条形图。 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. 数据集是使用DefaultCategoryDataset填充的,在某些情况下,域和范围轴上的值都不太清楚。

I need something like a scrollPane into which the chart can be added. 我需要类似scrollPane的图表可以添加到其中。 But it looks like the ChartPanel cannot be added into a JScrollPane 但是似乎ChartPanel无法添加到JScrollPane中

Is there any way of doing this ? 有什么办法吗?

Thanks Bhavya 谢谢Bhavya

You can use setLowerMargin() and/or getUpperMargin() on the relevant CategoryAxis to improve the appearance. 您可以在相关的CategoryAxis上使用setLowerMargin()和/或getUpperMargin()来改善外观。 Alternatively, you can use a SlidingCategoryDataset in conjunction with a JSlider . 或者,您可以将SlidingCategoryDatasetJSlider结合使用。

Addendum: A third alternative is to use zooming, which is enabled by default, as shown here . 附录:第三种替代方案是使用变焦,这是默认启用,如图这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM