Hi,
Can anyone give an example to make the left mouse
button do something.
Rigth now, right mouse click start a menu - very useful.
Left mouse move can be used to show tooltips.
I would like to CLICK or PRESS left mouse button and
do something!
Thanks
H
Great, but one more thing - Left Mouse on Chart
-
- Posts: 16
- Joined: Wed Aug 31, 2005 4:25 pm
Add an own MouseListener to the chartpanel.
If you want for instance the x and y value of the clicked position you could try this:
Hope it helps,
christopher
If you want for instance the x and y value of the clicked position you could try this:
Code: Select all
myChartPanel.addMouseListener(new MouseAdapter(){
public void mouseClicked(java.awt.event.MouseEvent e) {
long xval = Math.round(chart.getXYPlot().getDomainAxis().java2DToValue(e.getX(),
getChartRenderingInfo().getPlotInfo().getDataArea(),
chart.getXYPlot().getDomainAxisEdge()));
long yval = Math.round(chart.getXYPlot().getRangeAxis().java2DToValue(e.getY(),
getChartRenderingInfo().getPlotInfo().getDataArea(),
chart.getXYPlot().getRangeAxisEdge()));
handleMouseClick(xval, yval);
}
});
public void handleMouseClick(xval, yval){
....
}
christopher