Example #1
0
 def pointAt(self, axes, axis_values):
     """
     Returns the point that best represents this graph information.
     
     :param      axes        | [<XChartAxis>, ..]
                 axis_values | {<str> axisName, <variant> value
     
     :return     <QPointF>
     """
     point = QPointF()
     
     rect = self._buildData.get('axis_rect')
     if not rect:
         return point
     
     x_range = rect.right() - rect.left()
     y_range = rect.bottom() - rect.top()
     
     for axis in axes:
         if not axis.name() in axis_values:
             continue
         
         perc = axis.percentAt(axis_values[axis.name()])
         if axis.orientation() == Qt.Vertical:
             point.setY(rect.bottom() - perc * y_range)
         else:
             point.setX(rect.left() + perc * x_range)
     
     return point
Example #2
0
    def pointAt(self, axes, axis_values):
        """
        Returns the point that best represents this graph information.
        
        :param      axes        | [<XChartAxis>, ..]
                    axis_values | {<str> axisName, <variant> value
        
        :return     <QPointF>
        """
        point = QPointF()

        rect = self._buildData.get('axis_rect')
        if not rect:
            return point

        x_range = rect.right() - rect.left()
        y_range = rect.bottom() - rect.top()

        for axis in axes:
            if not axis.name() in axis_values:
                continue

            perc = axis.percentAt(axis_values[axis.name()])
            if axis.orientation() == Qt.Vertical:
                point.setY(rect.bottom() - perc * y_range)
            else:
                point.setX(rect.left() + perc * x_range)

        return point