Beispiel #1
0
 def findRenderer(self, name):
     """
     Returns the renderer based on the inputed name.
     
     :return     <str>
     """
     return XChartRenderer.plugin(name)
Beispiel #2
0
 def findRenderer(self, name):
     """
     Returns the renderer based on the inputed name.
     
     :return     <str>
     """
     return XChartRenderer.plugin(name)
Beispiel #3
0
 def assignRenderer(self, action):
     """
     Assigns the renderer for this chart to the current selected
     renderer.
     """
     name = nativestring(action.text()).split(" ")[0]
     self._renderer = XChartRenderer.plugin(name)
     self.uiTypeBTN.setDefaultAction(action)
     self.recalculate()
Beispiel #4
0
 def assignRenderer(self, action):
     """
     Assigns the renderer for this chart to the current selected
     renderer.
     """
     name = nativestring(action.text()).split(' ')[0]
     self._renderer = XChartRenderer.plugin(name)
     self.uiTypeBTN.setDefaultAction(action)
     self.recalculate()
Beispiel #5
0
    def setRenderer(self, renderer):
        """
        Sets the current renderer associated with this plot.
        
        :param      renderer | <XChartRenderer> || <str>
        
        :return     <bool> | success
        """
        if not isinstance(renderer, XChartRenderer):
            renderer = XChartRenderer.plugin(nativestring(renderer))

        if renderer is None:
            return False

        self._renderer = renderer

        for act in self.uiTypeBTN.actions():
            if act.text() == "%s Chart" % renderer.name():
                self.uiTypeBTN.setDefaultAction(act)
                break

        return True
Beispiel #6
0
    def setRenderer(self, renderer):
        """
        Sets the current renderer associated with this plot.
        
        :param      renderer | <XChartRenderer> || <str>
        
        :return     <bool> | success
        """
        if not isinstance(renderer, XChartRenderer):
            renderer = XChartRenderer.plugin(nativestring(renderer))

        if renderer is None:
            return False

        self._renderer = renderer

        for act in self.uiTypeBTN.actions():
            if act.text() == '%s Chart' % renderer.name():
                self.uiTypeBTN.setDefaultAction(act)
                break

        return True
Beispiel #7
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)
Beispiel #8
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)