I have been using the domain and range cross hairs tied to JSliders. People complain that when they right-click on the chart to bring up the pop-up menu, sometimes the cross hairs move to the place in the chart where they clicked. I really only want to move the cross hairs via the the sliders.
Is there a way to turn off that behavior of the cross hairs?
One solution I have considered is to use the CrosshairOverlay and add cross hairs that way, i.e.,
Code: Select all
CrosshairOverlay overlay = new CrosshairOverlay();
Crosshair xCrosshair = new Crosshair();
overlay.addDomainCrosshair(xCrosshair);
chartPanel.addOverlay(overlay);
The only problem is I use the ChartProgressListener to update the sliders when the chart is redrawn. I can get the domainCrosshair from the source of the event passed to the ChartProgressListener. I've not been able to figure out how to get either the overlay I added to the chart or the crosshairs added to the overlay, if I am starting out only knowing which chart the event occurred in.
So before creating some globally accessible variables for this other type of crosshair, I thought I'd ask if there was a way with the standard crosshairs to turn off the one behavior (moving on a mouse click) that is causing the problem.
Thanks for any suggestions.