The DataCursor class has no standard mode which tracks the mouseMove event, independent of the button status.
You can play around with a subclass of DataCursor. In this example the first move simulates a mouse pressed event to start the data cursor, and does NOT pass along actual mousePressed and mouseRelease events. Subsequent mouseMoved calls the standard mouse event mouseDragged method, which is what the DataCursor routine tracks. However, you may get remnants, definitely if you use it simultaneously with another MouseListener class which uses the XOR mode, such as the ChartZoom class.
class CustomDataCursor extends DataCursor {
boolean firstpass = true;
public CustomDataCursor(ChartView achartview, CartesianCoordinates thetransform,
int nmarkertype,
double rsize)
{
super(achartview, thetransform, nmarkertype, rsize);
}
// override mousePressed
public void mousePressed(MouseEvent event)
{
}
// override mouseReleased method
public void mouseReleased(MouseEvent event)
{
}
// create a simulated mousePressed event
public void simulatedMousePressed(MouseEvent event)
{
try {
super.mousePressed(event);
}
catch ( Exception e )
{
}
}
// override mouseReleased method in order to add stuff
public void mouseMoved (MouseEvent event)
{
MouseEvent me = new MouseEvent(this.getChartObjComponent(),
event.getID(),
0,
event.getModifiers() | this.getButtonMask(),
event.getX(),
event.getY(),
1,
false);
if (firstpass){
simulatedMousePressed( me);
firstpass = false;
} else
{
super.mouseDragged(me);
}
}
}