Ejemplo n.º 1
0
 def renderers(self):
     """
     Returns the renderer instances associated with this chart.
     
     :return     [<XChartRenderer>, ..]
     """
     return map(XChartRenderer.plugin, XChartRenderer.plugins())
Ejemplo n.º 2
0
 def renderers(self):
     """
     Returns the renderer instances associated with this chart.
     
     :return     [<XChartRenderer>, ..]
     """
     return map(XChartRenderer.plugin, XChartRenderer.plugins())
Ejemplo n.º 3
0
    def __init__(self, parent=None):
        super(XChart, self).__init__(parent)

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

        # define custom properties
        self._renderer = None
        self._chartTitle = ""
        self._axes = []
        self._datasets = []
        self._horizontalAxis = None
        self._verticalAxis = None
        self._showDatasetToolbar = True
        self._showTypeButton = True
        self._dataChanged = False
        self._showGrid = True
        self._showRows = True
        self._showColumns = True
        self._showXAxis = True
        self._showYAxis = True

        # set default properties
        self.uiChartVIEW.setScene(XChartScene(self))
        self.uiXAxisVIEW.setScene(XChartScene(self))
        self.uiYAxisVIEW.setScene(XChartScene(self))
        self.uiChartVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft)
        self.uiXAxisVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft)
        self.uiYAxisVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft)

        self.uiDatasetTBAR.setFixedHeight(32)

        self.uiXAxisVIEW.hide()
        self.uiYAxisVIEW.hide()

        self.setAutoFillBackground(True)
        self.setBackgroundRole(QPalette.Base)
        self.setStyleSheet(STYLE)
        self.uiChartVIEW.setMouseTracking(True)
        self.uiDatasetTBAR.setStyleSheet(TOOLBAR_STYLE)

        # load renderers
        for renderer in XChartRenderer.plugins():
            act = QAction("%s Chart" % renderer, self)
            ico = "img/chart/%s.png" % renderer.lower()
            act.setIcon(QIcon(resources.find(ico)))
            self.uiTypeBTN.addAction(act)

            # assign the default renderer
            if not self.uiTypeBTN.defaultAction():
                self._renderer = XChartRenderer.plugin(renderer)
                self.uiTypeBTN.setDefaultAction(act)

        # create connections
        chart_hbar = self.uiChartVIEW.horizontalScrollBar()
        chart_vbar = self.uiChartVIEW.verticalScrollBar()

        x_bar = self.uiXAxisVIEW.horizontalScrollBar()
        y_bar = self.uiYAxisVIEW.verticalScrollBar()

        chart_hbar.valueChanged.connect(self.syncScrollbars)
        chart_hbar.rangeChanged.connect(self.syncScrollbars)
        y_bar.valueChanged.connect(self.syncScrollbars)
        y_bar.rangeChanged.connect(self.syncScrollbars)
        self.uiTypeBTN.triggered.connect(self.assignRenderer)
Ejemplo n.º 4
0
    def __init__(self, parent=None):
        super(XChart, self).__init__(parent)

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

        # define custom properties
        self._renderer = None
        self._chartTitle = ''
        self._axes = []
        self._datasets = []
        self._horizontalAxis = None
        self._verticalAxis = None
        self._showDatasetToolbar = True
        self._showTypeButton = True
        self._dataChanged = False
        self._showGrid = True
        self._showRows = True
        self._showColumns = True
        self._showXAxis = True
        self._showYAxis = True

        # set default properties
        self.uiChartVIEW.setScene(XChartScene(self))
        self.uiXAxisVIEW.setScene(XChartScene(self))
        self.uiYAxisVIEW.setScene(XChartScene(self))
        self.uiChartVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft)
        self.uiXAxisVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft)
        self.uiYAxisVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft)

        self.uiDatasetTBAR.setFixedHeight(32)

        self.uiXAxisVIEW.hide()
        self.uiYAxisVIEW.hide()

        self.setAutoFillBackground(True)
        self.setBackgroundRole(QPalette.Base)
        self.setStyleSheet(STYLE)
        self.uiChartVIEW.setMouseTracking(True)
        self.uiDatasetTBAR.setStyleSheet(TOOLBAR_STYLE)

        # load renderers
        for renderer in XChartRenderer.plugins():
            act = QAction('%s Chart' % renderer, self)
            ico = 'img/chart/%s.png' % renderer.lower()
            act.setIcon(QIcon(resources.find(ico)))
            self.uiTypeBTN.addAction(act)

            # assign the default renderer
            if not self.uiTypeBTN.defaultAction():
                self._renderer = XChartRenderer.plugin(renderer)
                self.uiTypeBTN.setDefaultAction(act)

        # create connections
        chart_hbar = self.uiChartVIEW.horizontalScrollBar()
        chart_vbar = self.uiChartVIEW.verticalScrollBar()

        x_bar = self.uiXAxisVIEW.horizontalScrollBar()
        y_bar = self.uiYAxisVIEW.verticalScrollBar()

        chart_hbar.valueChanged.connect(self.syncScrollbars)
        chart_hbar.rangeChanged.connect(self.syncScrollbars)
        y_bar.valueChanged.connect(self.syncScrollbars)
        y_bar.rangeChanged.connect(self.syncScrollbars)
        self.uiTypeBTN.triggered.connect(self.assignRenderer)