• Post Reply Bookmark Topic Watch Topic
  • New Topic

place component in the centre of polar chart

 
shanaya dutt
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am required to place a component right in the middle of the polar chart made using Jfreechart.what is the way to go about it?i am not familiar with using the Layeredpane which maybe needed for the purpose.can someone help me?

I have to place the enitire thing later on a frame.So i would have to create a Jpanel.but i'm not sure about using Layeredpane with Jpanel.then how can i implement this?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You usually use a ChartPanel to display the actual JFreeChart object. The ChartPanel subclasses JPanel. So you can safely presume it to be like any other container and add your component to it.
 
shanaya dutt
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i do know this but the point is both the polar chart and the component should the visible at the same time.therefore i have to use layered pane.but how can i use layered pane witha jpanel?

if you have any other idea please share
 
shanaya dutt
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You usually use a ChartPanel to display the actual JFreeChart object. The ChartPanel subclasses JPanel. So you can safely presume it to be like any other container and add your component to it.




i tried doing this but it only displays the polar chart and not the component.
 
shanaya dutt
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have tried using a button instead of my desirable component.here when i add the button to the chartpanel it either covers the entire polar chart despite defining its size using setPreferredSize when i use the borderLayout fot the chartpanel.the Flowlayout does not place the button in the Center anyhow.

I don't know where i'm going wrong.perhaps using different Layout manager may help.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know nothing about JFreeChart or polar chart, but if you wanted to place a component in the middle of a panel,
you would set that panel's layoutmanger to GridBagLayout, and add the component with default GridBagConstraints.

now, the GridBagLayout might not suit the polar chart, so perhaps adding them on top of each other might work,
via OverlayLayout (where the top panel is transparent).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!