Our main focus for Pentaho Reporting 3.7 is locked on improving the user experience when adding links to reports. The DRILLDOWN function and its made-to-measure UI bring us a long way towards the holy grail of being ‘easy to use'(tm).
Putting links on text is nice. But since Dashboards became the standard, everyone seems to want to click on hot areas in images and charts as well. In HTML, this problem is solved by providing a image-map. This structure holds the outline of the hot-spots as polygons (or circles or rectangles) along with the tooltip and hyperlink target.
I love to ‘borrow’ a good idea when I see it.
All content-elements now ship with a new attribute called “image-map”, that allows you to provide a image-map for your images. The image-map must be a valid XML fragment, something like this:
Usually such a image-map will be computed at runtime by using an attribute-expression. But computing such maps manually is less fun than it sounds. So if no user-provided image-map is given, our Drawables can compute these maps on the fly as well.
All of our JFreeChart generator expressions now produce a JFreeChartReportDrawable objects instead of a plain JFreeChart objects. All ReportDrawables provide the “getImageMap(Rectangle2D)” method so that output targets that support image-maps can annotate their generated images with links and tooltips.
You can use the new “tooltip-formula” and “url-formula” properties on the chart-expressions to provide a formula for the tooltip and URL generators. Within the formula you have access to several automatically generated fields (in addition to all values of the regular fields at the time the chart is rendered).
- “chart::series-key”: The current series-value
- “chart::category-key”: The current category-value
- “chart::series-index”: The number of the series
- “chart::category-index”: The number of the category
- “chart::series-keys”: All known series-keys as array
- “chart::category-keys”: All known category-keys as array
- “chart::value”: The current value for the current series and category.
- “chart::x-value”: The current x-value
- “chart::y-value”: The current y-value
- “chart::z-value”: The current z-value
- “chart::series-index”: The number of the current series
- “chart::series-count”: The total number of series in the chart
- “chart::item-index”: The current item within the series
- “chart::item-count”: The total number of items within the series.
Pie-, Ring- and Multi-Pie Charts:
- “chart::key”: The current key for the pie-slice
- “chart::keys”: All known keys
- “chart::item”: The current item value for the pie-slice
- “chart::items”: All items
- “chart::pie-index”: The number of the current pie-chart (used in Multi-Pie charts)
At the moment, only the HTML export fully supports image maps. The PDF export already supports tooltips, but the links are not yet working. The work on the full image-map link support into PDF and to enable that stuff in the Swing preview as well should be finished next week.
And remember: The formula-properties of the chart-expressions can use the DRILLDOWN function to compute the links.