• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any one knows how to add a JFreeChart into a JScrollPane

 
Tan xiaolong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i check the JFreechart javadoc http://www.jfree.org/jfreechart/api/javadoc/index.html
it says that:
public ChartFrame(java.lang.String title,
JFreeChart chart,
boolean scrollPane)
Constructs a frame for a chart.
Parameters:
title - the frame title.
chart - the chart.
scrollPane - if true, put the Chart(Panel) into a JScrollPane.

but i do not know how to realize it...

as the Attachments shows...

please help me..thank you~
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tan,
Welcome to the Ranch!

JFreeChart has a class ChartPanel which I think extends JPanel. So, you create an instance of that and add it to the JFrame in the usual way.
You can add the ChartPanel itself to a JScrollPane too...
 
Tan xiaolong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranganathan Kaliyur Mannar wrote:Hi Tan,
Welcome to the Ranch!

JFreeChart has a class ChartPanel which I think extends JPanel. So, you create an instance of that and add it to the JFrame in the usual way.
You can add the ChartPanel itself to a JScrollPane too...



i learned from some e.g.s

here's my code for who needed




tip: attention to your panel LAYOUT,or you won't see it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic