Example #1
0
    def drawAxis(self, painter, rect, axis):
        """
        Draws the axis for the given painter.
        
        :param      painter | <QPainter>
                    rect    | <QRect>
        """
        if not axis:
            return

        # draw the axis lines
        painter.save()
        pen = QPen(self.axisColor())
        pen.setWidth(3)
        painter.setPen(pen)

        # draw the vertical line
        if axis.orientation() == Qt.Vertical:
            line = QLineF(rect.right(), rect.top(), rect.right(),
                          rect.bottom())

            painter.drawLine(line)
            painter.setFont(axis.labelFont())
            for y, height, label in self._buildData.get('grid_h_labels', []):
                painter.drawText(0, y - height / 2.0,
                                 rect.width() - 3, height,
                                 Qt.AlignRight | Qt.AlignVCenter, label)

            painter.translate(0, rect.center().y())
            painter.rotate(-90)

            painter.setFont(axis.titleFont())
            painter.drawText(-rect.height() / 2, 0, rect.height(),
                             rect.width(), Qt.AlignHCenter | Qt.AlignTop,
                             axis.title())

        # draw the horizontal line
        else:
            line = QLineF(rect.left(), rect.top(), rect.right(), rect.top())

            painter.setFont(axis.titleFont())
            painter.drawText(rect, Qt.AlignHCenter | Qt.AlignBottom,
                             axis.title())

            painter.drawLine(line)
            painter.setFont(axis.labelFont())
            for x, width, label in self._buildData.get('grid_v_labels', []):
                painter.drawText(x - width / 2.0, 3, width,
                                 rect.height() - 6,
                                 Qt.AlignHCenter | Qt.AlignTop, label)
        painter.restore()
Example #2
0
 def drawAxis(self, painter, rect, axis):
     """
     Draws the axis for the given painter.
     
     :param      painter | <QPainter>
                 rect    | <QRect>
     """
     if not axis:
         return
     
     # draw the axis lines
     painter.save()
     pen = QPen(self.axisColor())
     pen.setWidth(3)
     painter.setPen(pen)
     
     # draw the vertical line
     if axis.orientation() == Qt.Vertical:
         line = QLineF(rect.right(), rect.top(),
                       rect.right(), rect.bottom())
         
         painter.drawLine(line)
         painter.setFont(axis.labelFont())
         for y, height, label in self._buildData.get('grid_h_labels', []):
             painter.drawText(0, y - height / 2.0, rect.width() - 3, height,
                              Qt.AlignRight | Qt.AlignVCenter, label)
         
         painter.translate(0, rect.center().y())
         painter.rotate(-90)
         
         painter.setFont(axis.titleFont())
         painter.drawText(-rect.height()/2, 0, rect.height(), rect.width(),
                          Qt.AlignHCenter | Qt.AlignTop, axis.title())
         
     # draw the horizontal line
     else:
         line = QLineF(rect.left(), rect.top(),
                       rect.right(), rect.top())
         
         painter.setFont(axis.titleFont())
         painter.drawText(rect,
                          Qt.AlignHCenter | Qt.AlignBottom,
                          axis.title())
         
         painter.drawLine(line)
         painter.setFont(axis.labelFont())
         for x, width, label in self._buildData.get('grid_v_labels', []):
             painter.drawText(x - width / 2.0, 3, width, rect.height() - 6,
                              Qt.AlignHCenter | Qt.AlignTop, label)
     painter.restore()
Example #3
0
 def drawItem(self, item, painter, option):
     """
     Draws the inputed item as a bar graph.
     
     :param      item    | <XChartDatasetItem>
                 painter | <QPainter>
                 option  | <QStyleOptionGraphicsItem>
     """
     dataset = item.dataset()
     
     painter.save()
     painter.setRenderHint(painter.Antialiasing)
     
     pen = QPen(dataset.color())
     pen.setWidth(3)
     painter.setPen(pen)
     painter.setBrush(Qt.NoBrush)
     painter.drawPath(item.path())
     
     if self.showPoints():
         palette = QApplication.palette()
         pen = QPen(palette.color(palette.Base))
         pen.setWidth(2)
         
         painter.setBrush(dataset.color())
         painter.setPen(pen)
         
         for point in item.buildData('ellipses', []):
             painter.drawEllipse(point,
                                 self.pointRadius(),
                                 self.pointRadius())
     
     painter.restore()
Example #4
0
 def drawItem(self, item, painter, option):
     """
     Draws the inputed item as a bar graph.
     
     :param      item    | <XChartDatasetItem>
                 painter | <QPainter>
                 option  | <QStyleOptionGraphicsItem>
     """
     dataset = item.dataset()
     
     painter.save()
     painter.setRenderHint(painter.Antialiasing)
     
     center = item.buildData('center')
     radius = item.buildData('radius')
     
     if int(option.state) & QStyle.State_MouseOver != 0:
         alpha = 20
         mouse_over = True
     else:
         alpha = 0
         mouse_over = False
     
     for value, subpath in item.buildData('subpaths', []):
         clr = dataset.color(value)
         
         bg = clr.lighter(110)
         bg.setAlpha(alpha + 100)
         painter.setBrush(bg)
         
         if mouse_over:
             scale = 1.08
             dx = (center.x() / scale) - center.x()
             dy = (center.y() / scale) - center.y()
             
             painter.save()
             painter.scale(scale, scale)
             painter.translate(dx, dy)
             painter.setPen(Qt.NoPen)
             painter.drawPath(subpath)
             painter.restore()
         
         pen = QPen(clr)
         pen.setWidth(0.5)
         painter.setPen(pen)
         
         painter.drawPath(subpath)
         
     painter.restore()
Example #5
0
    def drawItem(self, item, painter, option):
        """
        Draws the inputed item as a bar graph.
        
        :param      item    | <XChartDatasetItem>
                    painter | <QPainter>
                    option  | <QStyleOptionGraphicsItem>
        """
        dataset = item.dataset()

        painter.save()
        painter.setRenderHint(painter.Antialiasing)

        center = item.buildData('center')
        radius = item.buildData('radius')

        if int(option.state) & QStyle.State_MouseOver != 0:
            alpha = 20
            mouse_over = True
        else:
            alpha = 0
            mouse_over = False

        for value, subpath in item.buildData('subpaths', []):
            clr = dataset.color(value)

            bg = clr.lighter(110)
            bg.setAlpha(alpha + 100)
            painter.setBrush(bg)

            if mouse_over:
                scale = 1.08
                dx = (center.x() / scale) - center.x()
                dy = (center.y() / scale) - center.y()

                painter.save()
                painter.scale(scale, scale)
                painter.translate(dx, dy)
                painter.setPen(Qt.NoPen)
                painter.drawPath(subpath)
                painter.restore()

            pen = QPen(clr)
            pen.setWidth(0.5)
            painter.setPen(pen)

            painter.drawPath(subpath)

        painter.restore()
Example #6
0
 def paintEvent(self, event):
     """
     Handles the drawing for this widget and its selection region.
     
     :param      event | <QPaintEvent>
     """
     pen = QPen(Qt.DashLine)
     pen.setColor(QColor('red'))
     with XPainter(self) as painter:
         painter.setPen(pen)
         clr = QColor('black')
         clr.setAlpha(100)
         painter.setBrush(clr)
         
         painter.drawRect(self._region)
Example #7
0
 def setGridPen(self, pen):
     """
     Sets the pen used to draw the grid lines for the view.
     
     :param      pen | <QPen> || <QColor>
     """
     self._gridPen = QPen(pen)
Example #8
0
    def drawAxis(self, painter):
        """
        Draws the axis for this system.
        """
        # draw the axis lines
        pen = QPen(self.axisColor())
        pen.setWidth(4)
        painter.setPen(pen)
        painter.drawLines(self._buildData['axis_lines'])

        # draw the notches
        for rect, text in self._buildData['grid_h_notches']:
            painter.drawText(rect, Qt.AlignTop | Qt.AlignRight, text)

        for rect, text in self._buildData['grid_v_notches']:
            painter.drawText(rect, Qt.AlignCenter, text)
Example #9
0
 def drawAxis( self, painter ):
     """
     Draws the axis for this system.
     """
     # draw the axis lines
     pen = QPen(self.axisColor())
     pen.setWidth(4)
     painter.setPen(pen)
     painter.drawLines(self._buildData['axis_lines'])
     
     # draw the notches
     for rect, text in self._buildData['grid_h_notches']:
         painter.drawText(rect, Qt.AlignTop | Qt.AlignRight, text)
     
     for rect, text in self._buildData['grid_v_notches']:
         painter.drawText(rect, Qt.AlignCenter, text)
Example #10
0
    def paintEvent(self, event):
        """
        Overloads the paint event to draw rounded edges on this widget.
        
        :param      event | <QPaintEvent>
        """
        super(XRolloutItem, self).paintEvent(event)

        with XPainter(self) as painter:
            w = self.width() - 3
            h = self.height() - 3

            color = self.palette().color(QPalette.Midlight)
            color = color.darker(180)
            pen = QPen(color)
            pen.setWidthF(0.5)

            painter.setPen(pen)
            painter.setBrush(self.palette().color(QPalette.Midlight))
            painter.setRenderHint(XPainter.Antialiasing)
            painter.drawRoundedRect(1, 1, w, h, 10, 10)
Example #11
0
 def paintEvent( self, event ):
     """
     Overloads the paint event to draw rounded edges on this widget.
     
     :param      event | <QPaintEvent>
     """
     super(XRolloutItem, self).paintEvent(event)
     
     with XPainter(self) as painter:
         w = self.width() - 3
         h = self.height() - 3
         
         color = self.palette().color(QPalette.Midlight)
         color = color.darker(180)
         pen = QPen(color)
         pen.setWidthF(0.5)
         
         painter.setPen(pen)
         painter.setBrush(self.palette().color(QPalette.Midlight))
         painter.setRenderHint(XPainter.Antialiasing)
         painter.drawRoundedRect(1, 1, w, h, 10, 10)
Example #12
0
 def adjustMask(self):
     """
     Updates the alpha mask for this popup widget.
     """
     if self.currentMode() == XPopupWidget.Mode.Dialog:
         self.clearMask()
         return
     
     path = self.borderPath()
     bitmap = QBitmap(self.width(), self.height())
     bitmap.fill(QColor('white'))
     
     with XPainter(bitmap) as painter:
         painter.setRenderHint(XPainter.Antialiasing)
         pen = QPen(QColor('black'))
         pen.setWidthF(0.75)
         painter.setPen(pen)
         painter.setBrush(QColor('black'))
         painter.drawPath(path)
     
     self.setMask(bitmap)
Example #13
0
    def adjustMask(self):
        """
        Updates the alpha mask for this popup widget.
        """
        if self.currentMode() == XPopupWidget.Mode.Dialog:
            self.clearMask()
            return

        path = self.borderPath()
        bitmap = QBitmap(self.width(), self.height())
        bitmap.fill(QColor('white'))

        with XPainter(bitmap) as painter:
            painter.setRenderHint(XPainter.Antialiasing)
            pen = QPen(QColor('black'))
            pen.setWidthF(0.75)
            painter.setPen(pen)
            painter.setBrush(QColor('black'))
            painter.drawPath(path)

        self.setMask(bitmap)
Example #14
0
 def drawItem(self, item, painter, option):
     """
     Draws the inputed item as a bar graph.
     
     :param      item    | <XChartDatasetItem>
                 painter | <QPainter>
                 option  | <QStyleOptionGraphicsItem>
     """
     dataset = item.dataset()
     
     painter.save()
     painter.setRenderHint(painter.Antialiasing)
     
     pen = QPen(dataset.color())
     pen.setWidth(0.75)
     painter.setPen(pen)
     
     for path in item.buildData('subpaths', []):
         gradient = QLinearGradient()
         
         clr = QColor(dataset.color())
         clr.setAlpha(220)
         
         gradient.setColorAt(0.0,  clr.lighter(180))
         gradient.setColorAt(0.1,  clr.lighter(160))
         gradient.setColorAt(0.25, clr.lighter(140))
         gradient.setColorAt(1.0,  clr.lighter(125))
         
         if self.orientation() == Qt.Vertical:
             gradient.setStart(0, path.boundingRect().bottom())
             gradient.setFinalStop(0, path.boundingRect().top())
         else:
             gradient.setStart(path.boundingRect().left(), 0)
             gradient.setFinalStop(path.boundingRect().right(), 0)
         
         painter.setBrush(gradient)
         painter.drawPath(path)
     
     painter.restore()
Example #15
0
    def paintEvent(self, event):
        """
        Overloads the paint event to handle painting pointers for the popup \
        mode.
        
        :param      event | <QPaintEvent>
        """
        # use the base technique for the dialog mode
        if self.currentMode() == XPopupWidget.Mode.Dialog:
            super(XPopupWidget, self).paintEvent(event)
            return

        # setup the coloring options
        palette = self.palette()

        with XPainter(self) as painter:
            pen = QPen(palette.color(palette.Window).darker(130))
            pen.setWidthF(1.75)
            painter.setPen(pen)
            painter.setRenderHint(painter.Antialiasing)
            painter.setBrush(palette.color(palette.Window))
            painter.drawPath(self.borderPath())
Example #16
0
    def drawItem(self, item, painter, option):
        """
        Draws the inputed item as a bar graph.
        
        :param      item    | <XChartDatasetItem>
                    painter | <QPainter>
                    option  | <QStyleOptionGraphicsItem>
        """
        dataset = item.dataset()

        painter.save()
        painter.setRenderHint(painter.Antialiasing)

        pen = QPen(dataset.color())
        pen.setWidth(0.75)
        painter.setPen(pen)

        for path in item.buildData('subpaths', []):
            gradient = QLinearGradient()

            clr = QColor(dataset.color())
            clr.setAlpha(220)

            gradient.setColorAt(0.0, clr.lighter(180))
            gradient.setColorAt(0.1, clr.lighter(160))
            gradient.setColorAt(0.25, clr.lighter(140))
            gradient.setColorAt(1.0, clr.lighter(125))

            if self.orientation() == Qt.Vertical:
                gradient.setStart(0, path.boundingRect().bottom())
                gradient.setFinalStop(0, path.boundingRect().top())
            else:
                gradient.setStart(path.boundingRect().left(), 0)
                gradient.setFinalStop(path.boundingRect().right(), 0)

            painter.setBrush(gradient)
            painter.drawPath(path)

        painter.restore()
Example #17
0
 def paintEvent(self, event):
     """
     Overloads the paint event to handle painting pointers for the popup \
     mode.
     
     :param      event | <QPaintEvent>
     """
     # use the base technique for the dialog mode
     if self.currentMode() == XPopupWidget.Mode.Dialog:
         super(XPopupWidget, self).paintEvent(event)
         return
     
     # setup the coloring options
     palette = self.palette()
     
     with XPainter(self) as painter:
         pen = QPen(palette.color(palette.Window).darker(130))
         pen.setWidthF(1.75)
         painter.setPen(pen)
         painter.setRenderHint(painter.Antialiasing)
         painter.setBrush(palette.color(palette.Window))
         painter.drawPath(self.borderPath())
Example #18
0
    def drawGrid(self, painter, rect, showGrid, showColumns, showRows):
        """
        Draws the grid on the inputed painter
        
        :param      painter     | <QPainter>
                    rect        | <QRect>
                    showGrid    | <bool>
                    showColumns | <bool>
                    showRows    | <bool>
        """
        if not (self.showGrid() and showGrid):
            return

        # saves the painter state before continuing
        painter.save()

        # draw the grid data
        painter.setBrush(self.alternateColor())
        painter.setPen(Qt.NoPen)

        # draw alternating rows
        if self.alternatingRowColors():
            painter.drawRects(self._buildData.get('grid_h_alt', []))

        # draw alternating columns
        if self.alternatingColumnColors():
            painter.drawRects(self._buildData.get('grid_v_alt', []))

        # draws the grid lines
        painter.setPen(QPen(self.axisColor()))
        grid = []
        if self.showRows() and showRows:
            grid += self._buildData.get('grid_h_lines', [])
        if self.showColumns() and showColumns:
            grid += self._buildData.get('grid_v_lines', [])

        if grid:
            painter.drawLines(grid)

        # restores the painter when finished
        painter.restore()
Example #19
0
    def drawGrid(self, painter):
        """
        Draws the rulers for this scene.
        
        :param      painter | <QPainter>
        """
        # draw the minor grid lines
        pen = QPen(self.borderColor())
        painter.setPen(pen)
        painter.setBrush(self.baseColor())

        # draw the grid data
        painter.drawRect(self._buildData['grid_rect'])

        painter.setBrush(self.alternateColor())
        painter.setPen(Qt.NoPen)

        if (self.alternatingRowColors()):
            for alt_rect in self._buildData['grid_h_alt']:
                painter.drawRect(alt_rect)

        if (self.alternatingColumnColors()):
            for alt_rect in self._buildData['grid_v_alt']:
                painter.drawRect(alt_rect)

        if (self.showGrid()):
            painter.setPen(pen)

            grid = []
            if (self.showRows()):
                grid += self._buildData['grid_h_lines']

            if (self.showColumns()):
                grid += self._buildData['grid_v_lines']

            painter.drawLines(grid)
Example #20
0
 def paint( self, painter, option, widget ):
     """
     Paints this item.
     
     :param      painter | <QPainter>
                 option  | <QGraphicsOption>
                 widget  | <QWidget>
     """
     painter.save()
     pen = QPen(self.color())
     pen.setWidth(2)
     painter.setPen(pen)
     painter.drawPath(self._basePath)
     painter.setRenderHint(painter.Antialiasing)
     
     
     pen.setColor(QColor('white'))
     painter.setPen(pen)
     painter.setBrush(self.color())
     for ellipse in self._ellipses:
         painter.drawEllipse(ellipse, 6, 6)
     
     painter.restore()
Example #21
0
 def paint( self, painter, option, widget ):
     """
     Draws this item with the inputed painter.
     
     :param      painter | <QPainter>
                 rect    | <QRect>
     """
     if self._dirty:
         self.rebuild()
     
     scene   = self.scene()
     if not scene:
         return
     
     grid    = scene.gridRect()
     typ     = self.chartType()
     
     # draw the line chart
     if typ == XChartScene.Type.Line:
         painter.setRenderHint(painter.Antialiasing)
         
         # draw the path area
         area = self._buildData.get('path_area')
         if area and self.isShaded():
             clr   = QColor(self.color())
             
             clr.setAlpha(120)
             painter.setPen(Qt.NoPen)
             painter.setBrush(clr)
             
             painter.drawPath(area)
         
         # draw the line data
         pen = QPen(self.color())
         pen.setWidth(2)
         
         painter.setPen(pen)
         painter.setBrush(Qt.NoBrush)
         
         painter.drawPath(self.path())
         
         if ( self.showPointsInLine() ):
             palette = QApplication.palette()
             pen = QPen(palette.color(palette.Base))
             pen.setWidth(2)
             
             painter.setBrush(self.color())
             painter.setPen(pen)
             
             for point in self._ellipses:
                 painter.drawEllipse(point, 
                                     self.pointRadius(), 
                                     self.pointRadius())
     
     # draw a bar chart
     elif typ == XChartScene.Type.Bar:
         painter.setRenderHint(painter.Antialiasing)
         
         pen = QPen(self.color())
         pen.setWidth(1)
         painter.setPen(pen)
         
         for key, value, sub_path in self._subpaths:
             gradient = QLinearGradient()
             
             clr = QColor(self.color())
             
             if ( sub_path != self._hoveredPath ):
                 clr.setAlpha(130)
             
             gradient.setColorAt(0.0,  clr.lighter(140))
             gradient.setColorAt(0.1,  clr.lighter(120))
             gradient.setColorAt(0.25, clr.lighter(110))
             gradient.setColorAt(1.0,  clr.lighter(105))
             
             if ( self.orientation() == Qt.Horizontal ):
                 gradient.setStart(0, sub_path.boundingRect().top())
                 gradient.setFinalStop(0, sub_path.boundingRect().bottom())
             else:
                 gradient.setStart(sub_path.boundingRect().left(), 0)
                 gradient.setFinalStop(sub_path.boundingRect().right(), 0)
             
             painter.setBrush(gradient)
             painter.drawPath(sub_path)
     
     # draw a simple pie chart (calculated by scene)
     elif typ == XChartScene.Type.Pie:
         painter.setRenderHint(painter.Antialiasing)
         
         center   = self.pieCenter()
         radius   = self.radius()
         
         for key, value, sub_path in self._subpaths:
             clr = self.keyColor(key)
             
             gradient = QRadialGradient(QPointF(0, 0), radius)
             
             a = QColor(clr.lighter(140))
             b = QColor(clr.lighter(110))
             
             a.setAlpha(40)
             b.setAlpha(80)
             
             # look for mouse over
             if ( sub_path == self._hoveredPath ):
                 a.setAlpha(100)
                 b.setAlpha(200)
             
             gradient.setColorAt(0, a)
             gradient.setColorAt(1, b)
             
             pen = QPen(clr)
             pen.setWidth(1)
             
             painter.setBrush(gradient)
             painter.setPen(pen)
             
             painter.drawPath(sub_path)
Example #22
0
    def __init__(self, parent=None):
        super(XGanttWidget, self).__init__(parent)

        # load the user interface
        projexui.loadUi(__file__, self)

        # define custom properties
        self._backend = None
        self._dateStart = QDate.currentDate().addMonths(-2)
        self._dateEnd = QDate.currentDate().addMonths(2)
        self._timeStart = QTime(0, 0, 0)
        self._timeEnd = QTime(23, 59, 59)
        self._alternatingRowColors = False
        self._cellWidth = 20
        self._cellHeight = 20
        self._first = True
        self._dateFormat = 'M/d/yy'
        self._timescale = XGanttWidget.Timescale.Month
        self._scrolling = False
        self._dirty = False

        # setup the palette colors
        palette = self.palette()
        color = palette.color(palette.Base)

        self._gridPen = QPen(color.darker(115))
        self._brush = QBrush(color)
        self._alternateBrush = QBrush(color.darker(105))

        weekendColor = color.darker(108)
        self._weekendBrush = QBrush(weekendColor)

        # setup the columns for the tree
        self.setColumns(['Name', 'Start', 'End', 'Calendar Days', 'Work Days'])

        header = self.uiGanttTREE.header()
        header.setFixedHeight(self._cellHeight * 2)
        headerItem = self.uiGanttTREE.headerItem()
        headerItem.setSizeHint(0, QSize(80, header.height()))

        # initialize the tree widget
        self.uiGanttTREE.setShowGrid(False)
        self.uiGanttTREE.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.uiGanttTREE.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.uiGanttTREE.setVerticalScrollMode(self.uiGanttTREE.ScrollPerPixel)
        self.uiGanttTREE.setResizeToContentsInteractive(True)
        self.uiGanttTREE.setEditable(True)
        self.uiGanttTREE.resize(500, 20)
        self.uiGanttTREE.setContextMenuPolicy(Qt.CustomContextMenu)

        # initialize the view widget
        self.uiGanttVIEW.setDragMode(self.uiGanttVIEW.RubberBandDrag)
        self.uiGanttVIEW.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.uiGanttVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft)
        self.uiGanttVIEW.setScene(XGanttScene(self))
        self.uiGanttVIEW.installEventFilter(self)
        self.uiGanttVIEW.horizontalScrollBar().setValue(50)
        self.uiGanttVIEW.setContextMenuPolicy(Qt.CustomContextMenu)

        # create connections
        self.uiGanttTREE.itemExpanded.connect(self.syncView)
        self.uiGanttTREE.itemCollapsed.connect(self.syncView)

        # connect scrollbars
        tree_bar = self.uiGanttTREE.verticalScrollBar()
        view_bar = self.uiGanttVIEW.verticalScrollBar()

        tree_bar.rangeChanged.connect(self._updateViewRect)
        tree_bar.valueChanged.connect(self._scrollView)
        view_bar.valueChanged.connect(self._scrollTree)

        # connect selection
        self.uiGanttTREE.itemSelectionChanged.connect(self._selectView)
        self.uiGanttVIEW.scene().selectionChanged.connect(self._selectTree)
        self.uiGanttTREE.itemChanged.connect(self.updateItemData)
        self.uiGanttTREE.customContextMenuRequested.connect(
            self.requestTreeMenu)
        self.uiGanttVIEW.customContextMenuRequested.connect(
            self.requestViewMenu)
Example #23
0
    def paint(self, painter, option, widget):
        """
        Draws this item with the inputed painter.
        
        :param      painter | <QPainter>
                    rect    | <QRect>
        """
        if self._dirty:
            self.rebuild()

        scene = self.scene()
        if not scene:
            return

        grid = scene.gridRect()
        typ = self.chartType()

        # draw the line chart
        if typ == XChartScene.Type.Line:
            painter.setRenderHint(painter.Antialiasing)

            # draw the path area
            area = self._buildData.get('path_area')
            if area and self.isShaded():
                clr = QColor(self.color())

                clr.setAlpha(120)
                painter.setPen(Qt.NoPen)
                painter.setBrush(clr)

                painter.drawPath(area)

            # draw the line data
            pen = QPen(self.color())
            pen.setWidth(2)

            painter.setPen(pen)
            painter.setBrush(Qt.NoBrush)

            painter.drawPath(self.path())

            if (self.showPointsInLine()):
                palette = QApplication.palette()
                pen = QPen(palette.color(palette.Base))
                pen.setWidth(2)

                painter.setBrush(self.color())
                painter.setPen(pen)

                for point in self._ellipses:
                    painter.drawEllipse(point, self.pointRadius(),
                                        self.pointRadius())

        # draw a bar chart
        elif typ == XChartScene.Type.Bar:
            painter.setRenderHint(painter.Antialiasing)

            pen = QPen(self.color())
            pen.setWidth(1)
            painter.setPen(pen)

            for key, value, sub_path in self._subpaths:
                gradient = QLinearGradient()

                clr = QColor(self.color())

                if (sub_path != self._hoveredPath):
                    clr.setAlpha(130)

                gradient.setColorAt(0.0, clr.lighter(140))
                gradient.setColorAt(0.1, clr.lighter(120))
                gradient.setColorAt(0.25, clr.lighter(110))
                gradient.setColorAt(1.0, clr.lighter(105))

                if (self.orientation() == Qt.Horizontal):
                    gradient.setStart(0, sub_path.boundingRect().top())
                    gradient.setFinalStop(0, sub_path.boundingRect().bottom())
                else:
                    gradient.setStart(sub_path.boundingRect().left(), 0)
                    gradient.setFinalStop(sub_path.boundingRect().right(), 0)

                painter.setBrush(gradient)
                painter.drawPath(sub_path)

        # draw a simple pie chart (calculated by scene)
        elif typ == XChartScene.Type.Pie:
            painter.setRenderHint(painter.Antialiasing)

            center = self.pieCenter()
            radius = self.radius()

            for key, value, sub_path in self._subpaths:
                clr = self.keyColor(key)

                gradient = QRadialGradient(QPointF(0, 0), radius)

                a = QColor(clr.lighter(140))
                b = QColor(clr.lighter(110))

                a.setAlpha(40)
                b.setAlpha(80)

                # look for mouse over
                if (sub_path == self._hoveredPath):
                    a.setAlpha(100)
                    b.setAlpha(200)

                gradient.setColorAt(0, a)
                gradient.setColorAt(1, b)

                pen = QPen(clr)
                pen.setWidth(1)

                painter.setBrush(gradient)
                painter.setPen(pen)

                painter.drawPath(sub_path)