Esempio n. 1
0
 def buildCanvasMaps(self, plot, canvasRect):
     maps = []
     for axisId in range(QwtPlot.axisCnt):
         map_ = QwtScaleMap()
         map_.setTransformation(
                             plot.axisScaleEngine(axisId).transformation())
         sd = plot.axisScaleDiv(axisId)
         map_.setScaleInterval(sd.lowerBound(), sd.upperBound())
         if plot.axisEnabled(axisId):
             s = plot.axisWidget(axisId)
             scaleRect = plot.plotLayout().scaleRect(axisId)
             if axisId in (QwtPlot.xTop, QwtPlot.xBottom):
                 from_ = scaleRect.left() + s.startBorderDist()
                 to = scaleRect.right() - s.endBorderDist()
             else:
                 from_ = scaleRect.bottom() - s.endBorderDist()
                 to = scaleRect.top() + s.startBorderDist()
         else:
             margin = 0
             if not plot.plotLayout().alignCanvasToScale(axisId):
                 margin = plot.plotLayout().canvasMargin(axisId)
             if axisId in (QwtPlot.yLeft, QwtPlot.yRight):
                 from_ = canvasRect.bottom() - margin
                 to = canvasRect.top() + margin
             else:
                 from_ = canvasRect.left() + margin
                 to = canvasRect.right() - margin
         map_.setPaintInterval(from_, to)
         maps.append(map_)
     return maps
Esempio n. 2
0
 def buildCanvasMaps(self, plot, canvasRect):
     maps = []
     for axisId in range(QwtPlot.axisCnt):
         map_ = QwtScaleMap()
         map_.setTransformation(
             plot.axisScaleEngine(axisId).transformation())
         sd = plot.axisScaleDiv(axisId)
         map_.setScaleInterval(sd.lowerBound(), sd.upperBound())
         if plot.axisEnabled(axisId):
             s = plot.axisWidget(axisId)
             scaleRect = plot.plotLayout().scaleRect(axisId)
             if axisId in (QwtPlot.xTop, QwtPlot.xBottom):
                 from_ = scaleRect.left() + s.startBorderDist()
                 to = scaleRect.right() - s.endBorderDist()
             else:
                 from_ = scaleRect.bottom() - s.endBorderDist()
                 to = scaleRect.top() + s.startBorderDist()
         else:
             margin = 0
             if not plot.plotLayout().alignCanvasToScale(axisId):
                 margin = plot.plotLayout().canvasMargin(axisId)
             if axisId in (QwtPlot.yLeft, QwtPlot.yRight):
                 from_ = canvasRect.bottom() - margin
                 to = canvasRect.top() + margin
             else:
                 from_ = canvasRect.left() + margin
                 to = canvasRect.right() - margin
         map_.setPaintInterval(from_, to)
         maps.append(map_)
     return maps
Esempio n. 3
0
 def canvasMap(self, axisId):
     map_ = QwtScaleMap()
     if not self.__data.canvas:
         return map_
     
     map_.setTransformation(self.axisScaleEngine(axisId).transformation())
     sd = self.axisScaleDiv(axisId)
     map_.setScaleInterval(sd.lowerBound(), sd.upperBound())
     
     if self.axisEnabled(axisId):
         s = self.axisWidget(axisId)
         if axisId in (self.yLeft, self.yRight):
             y = s.y() + s.startBorderDist() - self.__data.canvas.y()
             h = s.height() - s.startBorderDist() - s.endBorderDist()
             map_.setPaintInterval(y+h, y)
         else:
             x = s.x() + s.startBorderDist() - self.__data.canvas.x()
             w = s.width() - s.startBorderDist() - s.endBorderDist()
             map_.setPaintInterval(x, x+w)
     else:
         canvasRect = self.__data.canvas.contentsRect()
         if axisId in (self.yLeft, self.yRight):
             top = 0
             if not self.plotLayout().alignCanvasToScale(self.xTop):
                 top = self.plotLayout().canvasMargin(self.xTop)
             bottom = 0
             if not self.plotLayout().alignCanvasToScale(self.xBottom):
                 bottom = self.plotLayout().canvasMargin(self.xBottom)
             map_.setPaintInterval(canvasRect.bottom()-bottom,
                                   canvasRect.top()+top)
         else:
             left = 0
             if not self.plotLayout().alignCanvasToScale(self.yLeft):
                 left = self.plotLayout().canvasMargin(self.yLeft)
             right = 0
             if not self.plotLayout().alignCanvasToScale(self.yRight):
                 right = self.plotLayout().canvasMargin(self.yRight)
             map_.setPaintInterval(canvasRect.left()+left,
                                   canvasRect.right()-right)
     return map_
Esempio n. 4
0
    def buildCanvasMaps(self, plot, canvasRect):
        """
        Calculated the scale maps for rendering the canvas

        :param qwt.plot.QwtPlot plot: Plot widget
        :param QRectF canvasRect: Target rectangle
        :return: Calculated scale maps
        """
        maps = []
        for axisId in QwtPlot.validAxes:
            map_ = QwtScaleMap()
            map_.setTransformation(
                                plot.axisScaleEngine(axisId).transformation())
            sd = plot.axisScaleDiv(axisId)
            map_.setScaleInterval(sd.lowerBound(), sd.upperBound())
            if plot.axisEnabled(axisId):
                s = plot.axisWidget(axisId)
                scaleRect = plot.plotLayout().scaleRect(axisId)
                if axisId in (QwtPlot.xTop, QwtPlot.xBottom):
                    from_ = scaleRect.left() + s.startBorderDist()
                    to = scaleRect.right() - s.endBorderDist()
                else:
                    from_ = scaleRect.bottom() - s.endBorderDist()
                    to = scaleRect.top() + s.startBorderDist()
            else:
                margin = 0
                if not plot.plotLayout().alignCanvasToScale(axisId):
                    margin = plot.plotLayout().canvasMargin(axisId)
                if axisId in (QwtPlot.yLeft, QwtPlot.yRight):
                    from_ = canvasRect.bottom() - margin
                    to = canvasRect.top() + margin
                else:
                    from_ = canvasRect.left() + margin
                    to = canvasRect.right() - margin
            map_.setPaintInterval(from_, to)
            maps.append(map_)
        return maps
Esempio n. 5
0
    def buildCanvasMaps(self, plot, canvasRect):
        """
        Calculated the scale maps for rendering the canvas

        :param qwt.plot.QwtPlot plot: Plot widget
        :param QRectF canvasRect: Target rectangle
        :return: Calculated scale maps
        """
        maps = []
        for axisId in QwtPlot.validAxes:
            map_ = QwtScaleMap()
            map_.setTransformation(
                plot.axisScaleEngine(axisId).transformation())
            sd = plot.axisScaleDiv(axisId)
            map_.setScaleInterval(sd.lowerBound(), sd.upperBound())
            if plot.axisEnabled(axisId):
                s = plot.axisWidget(axisId)
                scaleRect = plot.plotLayout().scaleRect(axisId)
                if axisId in (QwtPlot.xTop, QwtPlot.xBottom):
                    from_ = scaleRect.left() + s.startBorderDist()
                    to = scaleRect.right() - s.endBorderDist()
                else:
                    from_ = scaleRect.bottom() - s.endBorderDist()
                    to = scaleRect.top() + s.startBorderDist()
            else:
                margin = 0
                if not plot.plotLayout().alignCanvasToScale(axisId):
                    margin = plot.plotLayout().canvasMargin(axisId)
                if axisId in (QwtPlot.yLeft, QwtPlot.yRight):
                    from_ = canvasRect.bottom() - margin
                    to = canvasRect.top() + margin
                else:
                    from_ = canvasRect.left() + margin
                    to = canvasRect.right() - margin
            map_.setPaintInterval(from_, to)
            maps.append(map_)
        return maps