示例#1
0
    def updateUI(self):
        theme = self.m_themeComboBox.itemData(
            self.m_themeComboBox.currentIndex())

        if self.m_charts[0].chart().theme() != theme:
            for chartView in self.m_charts:
                chartView.chart().setTheme(theme)

            pal = self.window().palette()

            if theme == QChart.ChartThemeLight:
                pal.setColor(QPalette.Window, QColor(0xf0f0f0))
                pal.setColor(QPalette.WindowText, QColor(0x404044))
            elif theme == QChart.ChartThemeDark:
                pal.setColor(QPalette.Window, QColor(0x121218))
                pal.setColor(QPalette.WindowText, QColor(0xd6d6d6))
            elif theme == QChart.ChartThemeBlueCerulean:
                pal.setColor(QPalette.Window, QColor(0x40434a))
                pal.setColor(QPalette.WindowText, QColor(0xd6d6d6))
            elif theme == QChart.ChartThemeBrownSand:
                pal.setColor(QPalette.Window, QColor(0x9e8965))
                pal.setColor(QPalette.WindowText, QColor(0x404044))
            elif theme == QChart.ChartThemeBlueNcs:
                pal.setColor(QPalette.Window, QColor(0x018bba))
                pal.setColor(QPalette.WindowText, QColor(0x404044))
            elif theme == QChart.ChartThemeHighContrast:
                pal.setColor(QPalette.Window, QColor(0xffab03))
                pal.setColor(QPalette.WindowText, QColor(0x181818))
            elif theme == QChart.ChartThemeBlueIcy:
                pal.setColor(QPalette.Window, QColor(0xcee7f0))
                pal.setColor(QPalette.WindowText, QColor(0x404044))
            else:
                pal.setColor(QPalette.Window, QColor(0xf0f0f0))
                pal.setColor(QPalette.WindowText, QColor(0x404044))

            self.window().setPalette(pal)

        checked = self.m_antialiasCheckBox.isChecked()
        for chartView in self.m_charts:
            chartView.setRenderHint(QPainter.Antialiasing, checked)

        options = QChart.AnimationOptions(
            self.m_animatedComboBox.itemData(
                self.m_animatedComboBox.currentIndex()))

        if self.m_charts[0].chart().animationOptions() != options:
            for chartView in self.m_charts:
                chartView.chart().setAnimationOptions(options)

        alignment = self.m_legendComboBox.itemData(
            self.m_legendComboBox.currentIndex())

        for chartView in self.m_charts:
            legend = chartView.chart().legend()

            if alignment == 0:
                legend.hide()
            else:
                legend.setAlignment(Qt.Alignment(alignment))
                legend.show()
示例#2
0
    def updateUI(self):

        thema = self.m_themaComboBox.itemData(self.m_themaComboBox.currentIndex())

        if self.m_chartView.chart().theme() != thema:
            self.m_chartView.chart().setTheme(thema)

            pal = self.window().palette()

            if thema == QChart.ChartThemeLight:
                pal.setColor(QPalette.Window, QColor(0xf0f0f0))
                pal.setColor(QPalette.WindowText, QColor(0x404044))
            elif thema == QChart.ChartThemeDark:
                pal.setColor(QPalette.Window, QColor(0x121218))
                pal.setColor(QPalette.WindowText, QColor(0xd6d6d6))

            self.window().setPalette(pal)

        options = QChart.AnimationOptions(QChart.AllAnimations)

        if self.m_chartView.chart().animationOptions() != options:
            self.m_chartView.chart().setAnimationOptions(options)

        label = self.m_chartView.chart().legend()

        labelPosition = self.m_labelComboBox.itemData(self.m_labelComboBox.currentIndex())

        if labelPosition == 0:
            label.hide()
        else:
            label.setAlignment(Qt.Alignment(labelPosition))
            label.show()

        indicatorMarker = self.m_indicatorMarkerComboBox.itemData(
            self.m_indicatorMarkerComboBox.currentIndex())

        if label != indicatorMarker:
            label.setMarkerShape(indicatorMarker)

        showLabel = self.m_showLabelCheckBox.isChecked()
        self.m_chartView.chart().series()[0].setLabelsVisible(showLabel)
示例#3
0
    def actualizarUI(self):

        # ====================== CONFIGURAR TEMA =====================

        tema = self.m_temaComboBox.itemData(self.m_temaComboBox.currentIndex())

        if self.m_grafico.chart().theme() != tema:
            self.m_grafico.chart().setTheme(tema)

            pal = self.window().palette()

            if tema == QChart.ChartThemeLight:
                pal.setColor(QPalette.Window, QColor(0xf0f0f0))
                pal.setColor(QPalette.WindowText, QColor(0x404044))
            elif tema == QChart.ChartThemeDark:
                pal.setColor(QPalette.Window, QColor(0x121218))
                pal.setColor(QPalette.WindowText, QColor(0xd6d6d6))
            elif tema == QChart.ChartThemeBlueCerulean:
                pal.setColor(QPalette.Window, QColor(0x40434a))
                pal.setColor(QPalette.WindowText, QColor(0xd6d6d6))
            elif tema == QChart.ChartThemeBrownSand:
                pal.setColor(QPalette.Window, QColor(0x9e8965))
                pal.setColor(QPalette.WindowText, QColor(0x404044))
            elif tema == QChart.ChartThemeBlueNcs:
                pal.setColor(QPalette.Window, QColor(0x018bba))
                pal.setColor(QPalette.WindowText, QColor(0x404044))
            elif tema == QChart.ChartThemeHighContrast:
                pal.setColor(QPalette.Window, QColor(0xffab03))
                pal.setColor(QPalette.WindowText, QColor(0x181818))
            elif tema == QChart.ChartThemeBlueIcy:
                pal.setColor(QPalette.Window, QColor(0xcee7f0))
                pal.setColor(QPalette.WindowText, QColor(0x404044))
            else:
                pal.setColor(QPalette.Window, QColor(0xf0f0f0))
                pal.setColor(QPalette.WindowText, QColor(0x404044))

            self.window().setPalette(pal)

    # =================== CONFIGURAR ANIMACIÓN ===================

        opciones = QChart.AnimationOptions(
            self.m_animacionComboBox.itemData(
                self.m_animacionComboBox.currentIndex()))

        if self.m_grafico.chart().animationOptions() != opciones:
            self.m_grafico.chart().setAnimationOptions(opciones)

    # ====================== OBTENER LEYENDA =====================

        leyenda = self.m_grafico.chart().legend()

        # ================ CONFIGURAR POSICIÓN LEYENDA ===============

        alineacion = self.m_leyendaComboBox.itemData(
            self.m_leyendaComboBox.currentIndex())

        if alineacion == 0:
            leyenda.hide()
        else:
            leyenda.setAlignment(Qt.Alignment(alineacion))
            leyenda.show()

    # ================ CONFIGURAR MARCADOR LEYENDA ===============

        marcador = self.m_marcadorLeyendaComboBox.itemData(
            self.m_marcadorLeyendaComboBox.currentIndex())

        if leyenda != marcador:
            leyenda.setMarkerShape(marcador)

    # =============== CONFIGURAR POSICIÓN ETIQUETA ===============

        posicionEtiqueta = self.m_posicionEtiquetaComboBox.itemData(
            self.m_posicionEtiquetaComboBox.currentIndex())
        self.m_grafico.chart().series()[0].setLabelsPosition(posicionEtiqueta)

        # ============== CONFIGURAR VISIBILIDAD ETIQUETA =============

        visibilidadEtiqueta = self.m_visibilidadEtiquetaCheckBox.isChecked()
        self.m_grafico.chart().series()[0].setLabelsVisible(
            visibilidadEtiqueta)
 def changeAnimations(self):
     """Slot for changing the animation style of the chart."""        
     animation = QChart.AnimationOptions(
         self.animations_cb.itemData(self.animations_cb.currentIndex()))
     self.chart.setAnimationOptions(animation)
示例#5
0
 def on_comboAnimation_currentIndexChanged(self,index):
    animation=QChart.AnimationOptions(index)
    self.__chart.setAnimationOptions(animation)
示例#6
0
    def update_initUI(self):
        #Actualización tema_seleccionado-Interactivo

        #Valor seleccionado
        tema_seleccionado = self.color_fondo.itemData(
            self.color_fondo.currentIndex())

        if self.grafica.chart().theme() != tema_seleccionado:

            self.grafica.chart().setTheme(tema_seleccionado)
            #Paleta de colores
            paleta = self.window().palette()

            if tema_seleccionado == QChart.ChartThemeLight:
                paleta.setColor(QPalette.Window, QColor(0xf0f0f0))
                paleta.setColor(QPalette.WindowText, QColor(0x404044))

            elif tema_seleccionado == QChart.ChartThemeDark:
                paleta.setColor(QPalette.Window, QColor(0x121218))
                paleta.setColor(QPalette.WindowText, QColor(0xd6d6d6))

            elif tema_seleccionado == QChart.ChartThemeBlueCerulean:
                paleta.setColor(QPalette.Window, QColor(0x40434a))
                paleta.setColor(QPalette.WindowText, QColor(0xd6d6d6))

            elif tema_seleccionado == QChart.ChartThemeBrownSand:
                paleta.setColor(QPalette.Window, QColor(0x9e8965))
                paleta.setColor(QPalette.WindowText, QColor(0x404044))

            elif tema_seleccionado == QChart.ChartThemeBlueNcs:
                paleta.setColor(QPalette.Window, QColor(0x018bba))
                paleta.setColor(QPalette.WindowText, QColor(0x404044))

            elif tema_seleccionado == QChart.ChartThemeHighContrast:
                paleta.setColor(QPalette.Window, QColor(0xffab03))
                paleta.setColor(QPalette.WindowText, QColor(0x181818))

            elif tema_seleccionado == QChart.ChartThemeBlueIcy:
                paleta.setColor(QPalette.Window, QColor(0xcee7f0))
                paleta.setColor(QPalette.WindowText, QColor(0x404044))

            else:
                paleta.setColor(QPalette.Window, QColor(0xf0f0f0))
                paleta.setColor(QPalette.WindowText, QColor(0x404044))

            #Asignar el tema seleccionado
            self.window().setPalette(paleta)

        #-------------------Animación----------------------
        opciones = QChart.AnimationOptions(
            self.animacion_grafica.itemData(
                self.animacion_grafica.currentIndex()))

        if self.grafica.chart().animationOptions() != opciones:
            self.grafica.chart().setAnimationOptions(opciones)

        #-------------------Obtener leyenda----------------------

        leyenda = self.grafica.chart().legend()

        #-------------------leyenda grafica----------------------
        alineacion = self.leyenda_grafica.itemData(
            self.leyenda_grafica.currentIndex())

        if alineacion == 0:
            leyenda.hide()
        else:
            leyenda.setAlignment(Qt.Alignment(alineacion))
            leyenda.show()

        #-------------------marcador----------------------
        marcador = self.marcador_grafica.itemData(
            self.marcador_grafica.currentIndex())

        if leyenda != marcador:
            leyenda.setMarkerShape(marcador)

        #-------------------Posoción etiqueta----------------------
        posicionEtiqueta = self.posicion_grafica.itemData(
            self.posicion_grafica.currentIndex())
        self.grafica.chart().series()[0].setLabelsPosition(posicionEtiqueta)

        #-------------------Mostrar/Oculatar etiquta----------------------
        visibilidadEtiqueta = self.mostrar_ocultar_leyenda.isChecked()
        self.grafica.chart().series()[0].setLabelsVisible(visibilidadEtiqueta)