In most situations, you will want to let the user click on a particular chart element to request another page which in turn provides information about the
clicked marker (or series). However, this is a major issue taking into
consideration that Chart FX for Java can generate Active Charts (Client Controls) or images. You will be happy to know, Chart FX for Java supports
not only implementing DrillDown capabilities but also:
- Generating Image Maps when PNG or JPEG Images are being generated. This allows users to DrillDown even when charts images are generated by the server component.
- Passing parameters from the referrer URL, for example, when a user clicks on a particular series you can decide to pass parameters like value, series and other related chart information. This takes only a property setting and allows you to customize the resulting code using information coming directly from the chart.
- Customizing the DrillDown capabilities. If you want to redirect the request when the user clicks on different chart objects, such as points, series, title, stripes and constant lines, you can easily customize this setting
- Reloading charts without reloading the entire page. This creates a seamless storyboard effect as the page will not be reloaded when a chart is invoked in the same bounding rectangle.
The DrillDown API
The Chart FX for Java server-side Java bean provides several important properties that allow you to achieve DrillDown capabilities:
URL
Each different object that supports DrillDown capabilities will provide its own URL property. It's a string holding the URL to be invoked when a user clicks on an object. Chart FX for Java provides individual URL settings for the following objects:
- Chart.setURL: when this general property is set, all the markers will invoke this URL when clicked.
- Chart.getSeries(<index>).setURL: each particular Series can have its own URL string. This property overrides the generic Chart.URL if it has been set.
- Chart.getPoint(<series>,<index>).setURL: a specific marker can have its own URL string. This property overrides the generic Chart.URL and the Chart.Series.URL properties.
- Chart.getTitle(<index>).setURL: each Title can have its own specific URL string, which will be invoked when the user clicks on the title.
- Chart.getStripe(<index>).setURL: each Stripe will support an indivually set URL string.
- Chart.getConstantLine(<index>).setURL: each Constant Line can have its own URL.
URLOptions
Allows you to specify whether Chart FX will jump to another page or reload the chart.
URLTarget
Contains the target frame or HTML Frame that should be used when jumping. It's the same for all the objects.
URLParamMask
String property that allows configuration of the parameters passed to the URL. You can use the same strings as the TipMask property.
chart1.setURL("targetpage.jsp"); chart1.setURLParamMask("Serie=%S& Point=%N&Value=%v&Label= %l");
|
The above example will generate an URL that will look like:
http://www.mydomain.com/targetpage.jsp? Serie=1&Point0&Value=77.00&Label=Jan
|
If instead of jumping to a different page, you want to call a JavaScript function, you need to use string "javascript:" before the function name when you set the URL property. Parameters can also be passed to the JavaScript using the ParanMask property.
When using JavaScript for DrillDown, Chart FX will build the URL accordingly:
chart1.setURL("javascript:myFunction"); chart1.setURLParamMask("(Serie=%S& Point=%N&Value=%v&Label= %l)");
|
The last example will generate a link that will look like:
javascripit:myFuncion(Serie=1& Point0&Value=77.00&Label=Jan)
|
IMPORTANT NOTE : Chart FX for Java does not maintain a history of the charts invoked using this methodology, therefore it is your responsibility to generate the appropriate URLs in the pages that are being invoked by the referrer.
|