gPad->GetEventX() to axis range

Have a look at $ROOTSYS/tutorials/graphics/mandelbrot.C