Orson Charts 3D / Enhanced SVG Export
In April, we released Orson Charts version 1.3. This release brings exciting new interactive features, including mouse events that can identify all chart elements (titles, axis labels, legend items, data items, etc.) and provide links back to the chart's source data. This gives developers endless possibilities to create dynamic and interactive visualisations in Java applications, whether it be for item selections, popup info (dialogs and/or tooltips) or drill-down data displays. With Orson Charts 1.3 it is now even easier to let your users explore their data.
This post highlights a less visible feature in the 1.3 release---the enhanced SVG export---which also supports interactivity (mouse events and tooltips) for server-side generated charts displayed in modern web browsers.
Enhanced SVG Export
This feature is implemented using special rendering hints that get recognised by JFreeSVG but ignored by other Graphics2D implementations. This allows you to use the same code, unchanged, with any output target. In this post, we provide a few examples to illustrate---the source code for these demos is included in the Orson Charts download (you can also view the HTML page source here).
To enable the enhanced SVG export feature, you simply need to call the setElementHinting(boolean) method on your chart instance prior to drawing the chart to the SVGGraphics2D instance provided by JFreeSVG:
SVGGraphics2D g2 = new SVGGraphics2D(width, height);
chart.draw(g2, new Rectangle(width, height));
That's all that needs to be done in terms of the SVG generation (for an overview of creating a chart using Orson Charts, refer to an earlier blog post 'Creating 3D Charts in Java').
In this post we showed how Orson Charts and JFreeSVG integrate to provide both high quality vector rendering in modern web browsers plus the ability to support interactive features such as tooltips and mouse selection. The source code for these examples is included in the Orson Charts download.
If you'd like to give feedback on this post, please comment via the Orson Charts Twitter feed.