1

enter image description here

I would like to replicate this kind of plot as Swing component, and my question is: what is (or what could be) the hierarchy used in this picture?

It seems there are

JPanels (where rectangles, lines and text are displayed) within nested JSplitPanes within JInternalFrames within a JTabbedPane, all in the top container JFrame.

Is this correct or I am missing something?

Thanks

Alberto acepsut
  • 1,972
  • 10
  • 41
  • 87
  • This is too general. Have you already tried something? BTW Oracle has really good tutorials on Swing [here](http://docs.oracle.com/javase/tutorial/uiswing/). – Jakub Zaverka Mar 16 '12 at 13:06
  • 1
    Op your idea sounds fine to me. You might want to split the panels into multiple components and draw the individual graphs in their own coordinate space. – davidfrancis Mar 16 '12 at 13:09

1 Answers1

2

Look at getting JFreeChart and integrate that for all of the charting. As for stacking the graphs you could use a simple JPanel with a BoxLayout, or my favorite TableLayout. Then vertically stack the graphs. If you want to scroll graphs independently you can wrap those charts in JScrollPane and add that to the root JPanel.

Trickier is if you want to scroll those graphs with one scrollbar you'd need to put each graph in a JPanel that wraps itself around the longest graph (child), then wrap that in the JScrollPane. Then add that wrapping panel to the root JPanel.

http://www.jfree.org/jfreechart/

chubbsondubs
  • 37,646
  • 24
  • 106
  • 138
  • Thanks chubbard, I am aware of JFreeChart and I have discarded it because it doesn't suite for real time data. No need for scroll each pane, just resize by dragging on each dividers (I mean no need to scroll vertically, where I need a single horizontal scroll to move left or right all panes simultaneously) – Alberto acepsut Mar 16 '12 at 14:48
  • +1 for `JFreeChart`. You can test this [example](http://stackoverflow.com/a/5048863/230513) against your real-time requirements. See also these [alternatives](http://www.jfree.org/jfreechart/faq.html#FAQ13). – trashgod Mar 16 '12 at 14:52
  • Thanks trashgod, I think it would be better to start study some chart library rather than write myself – Alberto acepsut Mar 16 '12 at 15:20
  • JScrollPane works for both horizontal as well as vertical scrolling. As long as your component isn't bigger than the visible vertical space it won't show. You can easily resize the JFreeChart container so it's always the size of the visible height. You can also turn off vertical scrolling. – chubbsondubs Mar 17 '12 at 20:45