def getEdgeOppositeVertically(self, pp, symbol, y, onY2):

        # the cartesian data and pixel Y coordinates are
        # flipped, hence the (counter-intuitive) min/max
        # interchange below:
        if onY2:
            yMin =  pp.getY2Max()
            yMax =  pp.getY2Min()
        else:
            yMin =  pp.getYMax()
            yMax =  pp.getYMin()
        yMid = symbol.getBaseline()
        if (Double.NaN==(yMid)):
            yMid = (yMin + yMax)/2.

        yMinPx = pp.yToPixel(yMin,onY2)
        yMaxPx = pp.yToPixel(yMax,onY2)
        yMidPx = pp.yToPixel(yMid,onY2)
        yPx = pp.yToPixel(y, onY2)
        prevYPx = Double.NaN
        nextYPx = Double.NaN
        height = symbol.getHeight(pp, onY2)

        symHeight = self.getAdjustedHeight(height, yPx,
                                prevYPx, nextYPx, yMinPx, yMaxPx, yMidPx)
        if (Double.NaN==(symHeight)):
            return Double.NaN


        yTop = self.getUpperLeftY(height, yPx,
                                prevYPx, nextYPx,
                                yMinPx, yMaxPx, yMidPx,
                                pp.getYMousePlotArea())
        if (Double.NaN==(yTop)):
            return Double.NaN


        result = yTop+symHeight
        if abs(yTop - yPx) > abs(result - yPx):
            result = yTop


        return result
dataset/ETHPy150Open anandology/pyjamas/library/gwt/chart/SymbolType.py/SymbolType.getEdgeOppositeVertically/original