add scrollbar to JFreeChart 3DBarChart

2019-01-29 12:52发布

Can I add a scroll bar to the JFreeChart that allows me horizontally move the bar ?

JFreeChart chart = ChartFactory.createBarChart3D(
    title, 
    "X",
    "Y",
    dataset, 
    PlotOrientation.VERTICAL, 
    true, 
    false, 
    false
);

Because the dataset could be very long that there's not enough width to show the result...

Can I use JSlide on it? or other methods?

If possible, please show me some sample code. Thank you!

1条回答
干净又极端
2楼-- · 2019-01-29 13:39

.Yes you can, if you have access to the JFreeChart demo code just modify SlidingCategoryDatasetDemo2 and replace createBarChart3D with createBarChart3D and you will get this:

3d Scrolling Chart

You will need to use a SlidingCategoryDataset. You can find the source code and demos here JFreeChart

查看更多
登录 后发表回答