Whichever way you look at it, JFreeChart is one sensational charting library. So, what do you do if you’re hacking SWT apps?

Couple of options. You can use the SWT_AWT bridge stuff and take your chances on non-Windows platforms. Or, you can use some very nifty code here on the jfree forums to create an SWT Image from an AWT BufferedImage. (I’m using the code from Til at the bottom of the forum dated 12 Jan, 2005).

I’ve got a little project that I’m working on related to spamfiltering, so I though I’d mock up some charts to see if this stuff actually works. In this grab, I’ve created two CLabels, and called setImage() with the data returned from Til’s helper function. Gotta be happy with that!

JFreeChart Embedded in an SWT CLabel

Awesome! I’ve got a sensational charting package without the need to do scary stuff with embedded AWT/Swing panels in an SWT app! Thanks to the Til and the other brave souls who did the hard yards!