|
coordinates of mouse selection in 3d scatter and 3d surface plot |
Posted by Frederik on Jul-31-2013 10:48 |
|
Hi,
is it possible to get the coordinates of a mouse click on a 3d surface or 3d scatter chart? I understand that this is complex due to the third dimension. However, just wondering if chartdir support such functionality... |
Re: coordinates of mouse selection in 3d scatter and 3d surface plot |
Posted by Peter Kwan on Jul-31-2013 19:18 |
|
Hi Frederik,
For the 3D scatter chart, you can determine which scatter point the mouse has clicked. However, if the mouse has not clicked on any symbol, it is not possible to determine which position in 3D space that the mouse has clicked.
For the 3D surface chart, unluckily, even if the mouse has clicked on the surface, ChartDirector still cannot provide the 3D data coordinate on the surface.
Regards
Peter Kwan |
Re: coordinates of mouse selection in 3d scatter and 3d surface plot |
Posted by Frederik on Aug-01-2013 08:00 |
|
thanks Peter. The scatter plot might actually do. Just gave it a try to evaluate if this fits our requirements. I added a MouseListener to the viewer (See code below) and get the click but I am unable to determine the scatter point. Is there an example how to determine the scatter point in a ThreeDScatterChart?
regards
Frederik
viewer.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e)
{
System.out.println("Mouse clicked");
}
}); |
Re: coordinates of mouse selection in 3d scatter and 3d surface plot |
Posted by Peter Kwan on Aug-02-2013 02:11 |
|
Hi Frederik,
If you try the ChartDirectorDemo sample code that comes with ChartDirector, and view the "3D Scatter Chart (1)", you can click on the data points, and it will pop up a dialog box that shows the detail information of that point.
In brief, you need to perform the followings:
(a) Make sure the chart includes an image map. In the sample code included in the ChartDirector, the image map of the "3D Scatter Chart (1)" is configured as:
viewer.setImageMap(c.getHTMLImageMap("clickable", "",
"title='(x={x|p}, y={y|p}, z={z|p}'"));
(b) Use the HotSpotListener to listen to the hot spot mouse events. (The MouseListener is a standard Java listener and it does not support hot spots within an image.) The ChartDirectorDemo sample code attaches HotSpotListener to listen to hot spot mouse click events to the ChartViewer, so it can receive hot spot mouse clicks.
Hope this can help.
Regards
Peter Kwan |
Re: coordinates of mouse selection in 3d scatter and 3d surface plot |
Posted by Frederik on Aug-02-2013 07:57 |
|
thanks I got it to work. cheers Frederik |
|