aram535 wrote:Ok so now I have a JTable with the data, but I can't figure out how to render it into the chart. Anyone have any snippets they can share?
No code snippet, but some ideas...
1. Just place the JTable in the same container as the ChartPanel. But then, the JTable will not be part of the JFreeChart.
2. Write a wrapper around a JTable (or more general around a JComponent) that turns the JComponent into a Title. Inside the draw(Graphics2D titleG2, Rectangle2D titleRect) method of the Title, you can query the preferredSize of the JComponent, place it into the titleRect, and then call JComponent.paintComponent(titleG2). Simply place the JComponentTitle where it belongs.
3. You could try to use a CompositeTitle with a GridArrangement and add the LegendItemBlockContainers (which are the building blocks of a "normal" LegendTitle) and LabelBlocks to the GridArrangement. In this way, you could eliminate the JTable (well, finally at least a
link to a code snippet.The missing methods of GridArrangement have been implemented in the meantime).
Finally, in order to keep the size of the data area constant, regardless of whether this (rather bulky) title is shown or not, you can try
this patch.