I've released FlexChart 2.0 today. Binary download is available here: flexchart_2-0-r4392.zip. The demo app is still available, of course. Backwards compatibility is not quite 100%, as I'll explain below, but the non-compatibilities only affect certain classes of charts, and they're the complex ones. For simple stuff it should be drop-and-go.
There are no real outward changes to the engine. It's still shipped as a SWF and with a CFML demo app and custom tag. It's loadable by SWFObject if you prefer that, and since it's interplay with the world is strictly via JavaScript and XML, it's totally application platform independent. It's designed with Ajax in mind, as you might imagine, and fits into that realm very well.
Under the hood, however, you'll find all kinds of changes. The first version was a proof-of-concept app that I build one Friday afternoon and then extended with a few more bits over time. It did direct XML-to-UIComponent translation with no validation, no unit tests, and no debugging assitance. It was also a huge pain to work with, because the inside all operated on either an XML DOM tree or a ChartBase instance, neither of which is fun to debug.
The new version is a four phase engine: parse, transform, validate, build. Unifying them all is an intermediate representation that the parser creates, the transformer manipulates, the validator validates, and the builder uses to construct the ChartBase instance for actually adding to the stage. There are FlexUnit unit tests for the first three phases, along with a couple for the builder phase. I couldn't figure out how to test the builder reliably (because it's "output" is all UIComponents) until quite late in the process, so the coverage is only for a couple bugs that came up.
Because of the more explicit nature of the engine, error handling is far better. Internal errors caused by improper descriptors are also caught and displayed to the user for easier debugging. There is not currently a way to suppress this behaviour, maybe in a future version.
The rewrite also allowed me to hide some evilness lurking inside the Flex charting components. In particular, if you've used grouped series and the grouped legend, you'll possibly need to revisit things a bit. This is the one place where backwards compatibility was sacrificed, but the changes required in the XML are minor and a significant number of edge cases that the first engine couldn't handle are now dealt with correctly. Note that these weren't really bugs in the first version, but rather limitations in the Flex charting components that the first version didn't hide away from the user. I.e. in order to build certain charts you had to have an intimate understanding of the Flex charting components' internals. That's been fixed.
Bugs, comments, and questions welcome as always.
Congrats on the new release! Awesome work Barney!
Thanks, Jonathan. The first rev was a complete hack job. Worked well, but it was written as a proof-of-concept not a real app. I'm much happier about it now that the rewrite is complete. Only took a couple days in my free time to do it too, which was nice.
Awesome job, Barney. Very good example of being able to use Flex where it's good and integrating it with HTML/JS.
Missed you at lunch last week.
Barney,
Very nice. I just ran it on Railo/ISS. Just what the doctor ordered.
Thank you sir!
Very nice,But I do't know how to export images in Java.Can you help me?Thank you
Xingnanli,
FlexChart gives you a PNG image in base64-encoded format. Just a matter of decoding the base64-encoded text (which will give you the raw image bits), and writing it to the OutputStream of your choice. Commons Codec has Base64 tooling, as does Ostermiller utils. I've only used the former.
Barney,
Good, I have done!Thank you!