Draws this item with the inputed painter.
        
        :param      painter | <QPainter>
                    rect    | <QRect>

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)