'Decides whether to pop up a tool tip and which text to show in it.
:param x: the x coordinate of the mouse in data coordinates.
:type x: float
:param y: the y coordinate of the mouse in data coordinates.
:type y: float
:returns: A tuple consisting of the ``text``, ``x`` and ``y`` arguments to :meth:`addToolTip` of the
closest point.
:rtype: tuple of (int or str), float, float'

def maybeTip(self, x, y):

    if (len(self.positions) == 0):
        return ('', (-1), (-1))
    dists = [(max((abs((x - position[0])) - position[2]), 0) + max((abs((y - position[1])) - position[3]), 0)) for position in self.positions]
    nearestIndex = dists.index(min(dists))
    intX = abs((self.graph.transform(xBottom, x) - self.graph.transform(xBottom, self.positions[nearestIndex][0])))
    intY = abs((self.graph.transform(yLeft, y) - self.graph.transform(yLeft, self.positions[nearestIndex][1])))
    if ((self.positions[nearestIndex][2] == 0) and (self.positions[nearestIndex][3] == 0)):
        if ((intX + intY) < 6):
            return (self.texts[nearestIndex], self.positions[nearestIndex][0], self.positions[nearestIndex][1])
        else:
            return ('', None, None)
    elif ((abs((self.positions[nearestIndex][0] - x)) <= self.positions[nearestIndex][2]) and (abs((self.positions[nearestIndex][1] - y)) <= self.positions[nearestIndex][3])):
        return (self.texts[nearestIndex], x, y)
    else:
        return ('', None, None)
