Hi satay,
If you are referring to clicking the "hot spots" on the chart (eg. the bars in a bar chart, the slices in a pie chart, etc), you may add a HotSpotListener. In the original "ChartDirectorDemo" sample code, almost all charts are clickable using this method.
In brief, the code is like:
//handle hot spot mouse events
viewer.addHotSpotListener(new HotSpotAdapter() {
public void hotSpotClicked(HotSpotEvent e) {
System.out.println("Data Value = " + e.get("value"));
}});
You may optionally use ChartViewer.setHotSpotCursor to provide mouse cursor feedback when the mouse is over a hot spot. For example, if you want the mouse cursor to change to a hand shape, the code is like:
viewer.setHotSpotCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Hope this can help.
Regards
Peter Kwan |