class Widget(QDialog):
        def __init__(self, parent=None):
            super(Widget, self).__init__(parent)
            self.setWindowTitle('Financieële grafieken externe werken')
            self.setWindowIcon(QIcon('./images/logos/logo.jpg'))
            self.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint
                                | Qt.WindowMinMaxButtonsHint)

            grid = QGridLayout()
            grid.setSpacing(20)

            metadata = MetaData()
            resultaten = Table('resultaten', metadata,
                               Column('resID', Integer(), primary_key=True),
                               Column('statusweek', String),
                               Column('btotaal', Float),
                               Column('wtotaal', Float),
                               Column('betaald_bedrag', Float),
                               Column('meerminderwerk', Float),
                               Column('onderhandenwerk', Float),
                               Column('aanneemsom', Float),
                               Column('blonen', Float),
                               Column('wlonen', Float),
                               Column('bmaterialen', Float),
                               Column('wmaterialen', Float),
                               Column('bmaterieel', Float),
                               Column('wmaterieel', Float),
                               Column('bprojectkosten', Float),
                               Column('wprojectkosten', Float),
                               Column('binhuur', Float),
                               Column('winhuur', Float),
                               Column('bdiensten', Float),
                               Column('wdiensten', Float),
                               Column('bruto_winst', Float),
                               Column('boekweek', String))
            params = Table('params', metadata,
                           Column('paramID', Integer(), primary_key=True),
                           Column('tarief', String))
            engine = create_engine(
                'postgresql+psycopg2://postgres@localhost/bisystem')
            con = engine.connect()

            selpar1 = select([params]).where(params.c.paramID == 97)
            rppar1 = con.execute(selpar1).first()
            bo_incr = rppar1[1] / 52  #begrote omzet per week
            selpar2 = select([params]).where(params.c.paramID == 98)
            rppar2 = con.execute(selpar2).first()
            bw_incr = rppar2[1] / 52  #begrote winst per week

            jaar = jrwk[0:4]
            engine = create_engine(
                'postgresql+psycopg2://postgres@localhost/bisystem')
            con = engine.connect()
            selres = select([resultaten]).where(and_(resultaten.c.boekweek == jrwk,\
              resultaten.c.statusweek.like(jaar+'%'))).order_by(resultaten.c.statusweek)
            rpres = con.execute(selres)
            if keuze == '1':
                s1 = 2
                s2 = 3
                t1 = 'Kosten totaal begroot'
                t2 = 'Kosten totaal werkelijk'
                t3 = 'Kosten totaal '
                c1 = Qt.red
                c2 = Qt.blue
                ysch = 160000000
            elif keuze == '2':
                s1 = 8
                s2 = 9
                t1 = 'Lonen begroot'
                t2 = 'Lonen werkelijk'
                t3 = 'Lonen '
                c1 = Qt.green
                c2 = Qt.darkBlue
                ysch = 100000000
            elif keuze == '3':
                s1 = 10
                s2 = 11
                t1 = 'Materialen begroot'
                t2 = 'Materialen werkelijk'
                t3 = 'Materialen'
                c1 = Qt.cyan
                c2 = Qt.magenta
                ysch = 60000000
            elif keuze == '4':
                s1 = 12
                s2 = 13
                t1 = 'Materiëel begroot'
                t2 = 'Materiëel werkelijk'
                t3 = 'Materiëel '
                c1 = Qt.darkYellow
                c2 = Qt.darkGreen
                ysch = 20000000
            elif keuze == '5':
                s1 = 16
                s2 = 17
                t1 = 'Inhuur begroot'
                t2 = 'Inhuur werkelijk'
                t3 = 'Inhuur '
                c1 = Qt.darkBlue
                c2 = Qt.darkRed
                ysch = 30000000
            elif keuze == '6':
                s1 = 18
                s2 = 19
                t1 = 'Diensten begroot'
                t2 = 'Diensten werkelijk'
                t3 = 'Diensten '
                c1 = Qt.red
                c2 = Qt.blue
                ysch = 30000000
            elif keuze == '7':
                s1 = 14
                s2 = 15
                t1 = 'Projektkosten begroot'
                t2 = 'Projektkosten werkelijk'
                t3 = 'Projektkosten '
                c1 = Qt.darkYellow
                c2 = Qt.darkCyan
                ysch = 10000000
            elif keuze == '8':
                y3 = [
                    0,
                ]
                y3val = 0
                x1 = [
                    0,
                ]
                xval1 = 0
                # prognose winst
                for teller in range(0, 53):
                    y3val = y3val + bw_incr
                    y3 = y3 + [(y3val)]
                    xval1 = xval1 + 1
                    x1 = x1 + [(xval1)]
                s1 = 20
                s2 = 20
                t1 = 'Bruto winst prognose'
                t2 = 'Bruto winst actueel'
                t3 = 'Bruto winst - prognose / aktueel '
                c1 = Qt.darkCyan
                c2 = Qt.darkMagenta
                ysch = 20000000
            elif keuze == '9':
                s1 = 6
                s2 = 4
                t1 = 'Onderhandenwerk'
                t2 = 'Betaald bedrag'
                t3 = 'Onderhandenwerk - Betaald bedrag '
                c1 = Qt.yellow
                c2 = Qt.green
                ysch = 160000000
            elif keuze == 'A':
                y4 = [
                    0,
                ]
                y4val = 0
                x2 = [
                    0,
                ]
                xval2 = 0
                #prognose omzet
                for teller in range(0, 53):
                    y4val = y4val + bo_incr
                    y4 = y4 + [(y4val)]
                    xval2 = xval2 + 1
                    x2 = x2 + [(xval2)]
                s1 = 7
                s2 = 7
                t1 = 'Omzet prognose'
                t2 = 'Omzet aktueel'
                t3 = 'Omzet '
                c1 = Qt.red
                c2 = Qt.blue
                ysch = 160000000
            elif keuze == 'B':
                s1 = 20
                s2 = 5
                t1 = 'Bruto winst werkelijk'
                t2 = 'Meerminderwerk'
                t3 = 'Bruto winst werkelijk / Meerminderwerk '
                c1 = Qt.darkRed
                c2 = Qt.darkBlue
                ysch = 30000000

            x = [
                0,
            ]
            y1 = [
                0,
            ]
            y2 = [
                0,
            ]
            idx = 0
            yval1 = 0
            yval2 = 0
            for row in rpres:
                yval1 = y1[idx] + row[s1]
                y1 = y1 + [(yval1)]
                yval2 = y2[idx] + row[s2]
                y2 = y2 + [(yval2)]
                x = x + [(int(row[1][4:]))]
                idx += 1

            series1 = QLineSeries()
            if keuze == '8':
                for t, val in zip(x1, y3):
                    series1.append(int(t), val)
            elif keuze == 'A':
                for t, val in zip(x2, y4):
                    series1.append(int(t), val)
            else:
                for t, val in zip(x, y1):
                    series1.append(int(t), val)
            series2 = QLineSeries()
            for t, val in zip(x, y2):
                series2.append(int(t), val)

            chart = QChart()
            chart.addSeries(series1)
            chart.addSeries(series2)

            series1.setColor(QColor(c1))
            series2.setColor(QColor(c2))
            series1.setName(t1)
            series2.setName(t2)
            chart.legend().setVisible(True)

            font = QFont()
            font.setPixelSize(22)
            chart.setTitleFont(font)
            chart.setTitle(t3 + jaar)
            chart.setTitleBrush(QBrush(Qt.black))
            chart.legend().setLabelBrush(QColor(Qt.black))

            axisX = QCategoryAxis()
            axisY = QCategoryAxis()

            axisX.setTitleText('Jaar ' + jaar + ' - Weeknummers')
            axisX.setTitleBrush(QBrush(Qt.black))
            font = QFont("Sans Serif")
            axisX.setTitleFont(font)

            axisPen = QPen(QColor(100, 100, 100))  # 100,100,100
            axisPen.setWidth(3)
            axisX.setLinePen(axisPen)
            axisY.setLinePen(axisPen)

            axisBrush = QBrush(Qt.black)
            axisX.setLabelsBrush(axisBrush)
            axisY.setLabelsBrush(axisBrush)

            axisX.setGridLineVisible(False)
            axisY.setGridLineVisible(True)
            axisX.setShadesBrush(QBrush(QColor(245, 245, 245)))
            axisX.setShadesVisible(True)
            for x in range(1, 54):
                axisX.append(jaar + "-" + ("0" + str(x))[-2:], x)
            axisX.setRange(0, 53)
            axisX.setLabelsAngle(-90)

            axisY = QValueAxis()
            axisY.setTickCount(33)
            axisY.setTitleText("Bedragen in Euro")
            axisY.setTitleFont(font)
            axisY.setLabelFormat('%d')
            axisY.setTitleBrush(QBrush(Qt.black))
            axisY.setRange(0, ysch)  #disable for automatic Y scale
            #axisY.applyNiceNumbers() #enable by automatic Y scale

            Lfont = QFont("Sans Serif")
            Dfont = QFont("Sans Serif")
            Lfont.setPixelSize(10)
            Dfont.setPixelSize(10)
            axisX.setLabelsFont(Dfont)
            axisY.setLabelsFont(Lfont)

            axisPen = QPen(QColor('black'))
            axisPen = QPen()
            axisPen.setWidth(2)
            axisX.setLinePen(axisPen)
            axisX.setLabelsColor(QColor('black'))
            axisY.setLinePen(axisPen)
            axisY.setLabelsColor(QColor('black'))

            chart.addAxis(axisX, Qt.AlignBottom)
            series1.attachAxis(axisX)
            axisX.setLabelsAngle(-90)

            chart.addAxis(axisY, Qt.AlignLeft)
            series1.attachAxis(axisY)
            series2.attachAxis(axisY)

            self.chartView = QChartView(chart)
            self.chartView.setRenderHint(QPainter.Antialiasing)

            buttonPreview = QPushButton('Afdrukvoorbeeld')
            buttonPreview.clicked.connect(self.handle_preview)
            buttonPreview.setStyleSheet(
                "color: black;  background-color: gainsboro")
            buttonPrint = QPushButton('Printen')
            buttonPrint.clicked.connect(self.handle_print)
            buttonPrint.setStyleSheet(
                "color: black;  background-color: gainsboro")
            buttonSluit = QPushButton('Sluiten')
            buttonSluit.clicked.connect(lambda: sluit(self, m_email))
            buttonSluit.setStyleSheet(
                "color: black;  background-color: gainsboro")
            grid.addWidget(self.chartView, 0, 0, 0, 3)
            grid.addWidget(buttonSluit, 1, 0)
            grid.addWidget(buttonPrint, 1, 1)
            grid.addWidget(buttonPreview, 1, 2)

            self.setLayout(grid)
            self.setGeometry(200, 40, 1395, 930)

        def handle_print(self):
            printer = QPrinter(QPrinter.HighResolution)
            printer.setOrientation(QPrinter.Landscape)
            dialog = QPrintDialog(printer, self)
            if dialog.exec_() == QPrintDialog.Accepted:
                self.handle_paint_request(printer)

        def handle_preview(self):
            dialog = QPrintPreviewDialog()
            dialog.setWindowIcon(QIcon('./images/logos/logo.jpg'))
            dialog.setWindowFlags(dialog.windowFlags()
                                  | Qt.WindowSystemMenuHint
                                  | Qt.WindowMinMaxButtonsHint)
            dialog.paintRequested.connect(self.handle_paint_request)
            dialog.resize(1470, 980)
            #dialog.setMinimumSize(1470, 980)
            dialog.exec_()

        def handle_paint_request(self, printer):
            printer.setPageOrientation(QPageLayout.Landscape)
            painter = QPainter(printer)
            painter.setViewport(self.chartView.rect())
            painter.setWindow(self.chartView.rect())
            self.chartView.render(painter)
            painter.end()
Exemple #2
1
    class Window(QDialog):
        def __init__(self):
            QDialog.__init__(self)
            self.setWindowTitle(
                "Printen grafiek aantal externe werken per status over jaar " +
                jrwk[0:4])
            self.setWindowIcon(QIcon('./images/logos/logo.jpg'))
            self.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint
                                | Qt.WindowMinMaxButtonsHint)
            self.chart = QChart()
            self.chart_view = QChartView(self.chart)
            self.chart_view.setRenderHint(QPainter.Antialiasing)
            self.buttonPreview = QPushButton('Afdrukvoorbeeld', self)
            self.buttonPreview.clicked.connect(self.handle_preview)
            self.buttonPreview.setStyleSheet(
                "color: navy;  background-color: gainsboro")
            self.buttonPrint = QPushButton('Printen', self)
            self.buttonPrint.clicked.connect(self.handle_print)
            self.buttonPrint.setStyleSheet(
                "color: navy;  background-color: gainsboro")
            self.buttonSluit = QPushButton('Sluiten', self)
            self.buttonSluit.clicked.connect(lambda: sluit(self, m_email))
            self.buttonSluit.setStyleSheet(
                "color: navy;  background-color: gainsboro")
            self.buttonInfo = QPushButton('Info', self)
            self.buttonInfo.clicked.connect(lambda: info(self))
            self.buttonInfo.setStyleSheet(
                "color: navy;  background-color: gainsboro")

            layout = QGridLayout(self)
            layout.addWidget(self.chart_view, 0, 0, 1, 4)
            layout.addWidget(self.buttonInfo, 1, 0)
            layout.addWidget(self.buttonSluit, 1, 1)
            layout.addWidget(self.buttonPrint, 1, 2)
            layout.addWidget(self.buttonPreview, 1, 3)
            self.create_chart()

        def create_chart(self):
            self.chart.setTitle(
                'Grafiek aantal externe werken per status - opnameweek ' +
                jrwk)
            font = QFont("Sans Serif", 10)
            font.setWeight(QFont.Bold)
            self.chart.setTitleFont(font)
            set0 = QBarSet('Aantal externe werken per status')

            set0 << rpr[0][2] << rpr[1][2] << rpr[2][2] << rpr[3][2] << rpr[4][
                2] << rpr[5][2] << rpr[6][2] << rpr[7][2]

            barseries = QBarSeries()
            barseries.append(set0)
            barseries.append

            categories = [
                "Status A", "Status B", "Status C", "Status D", "Status E",
                "Status F", "Status G", "Status H"
            ]

            self.chart.addSeries(barseries)
            self.chart.axisX()
            self.chart.createDefaultAxes()
            axisX = QBarCategoryAxis()
            axisX.append(categories)
            self.chart.setAxisX(axisX, barseries)
            axisX.setRange(str("Status A"), str("Status H"))

        def handle_print(self):
            printer = QPrinter(QPrinter.HighResolution)
            printer.setOrientation(QPrinter.Landscape)
            dialog = QPrintDialog(printer, self)
            if dialog.exec_() == QPrintDialog.Accepted:
                self.handle_paint_request(printer)

        def handle_preview(self):
            dialog = QPrintPreviewDialog()
            dialog.setWindowIcon(QIcon('./images/logos/logo.jpg'))
            dialog.setWindowFlags(dialog.windowFlags()
                                  | Qt.WindowSystemMenuHint
                                  | Qt.WindowMinMaxButtonsHint)
            dialog.resize(1485, 990)
            #dialog.setMinimumSize(1485, 990)
            dialog.paintRequested.connect(self.handle_paint_request)
            dialog.exec_()

        def handle_paint_request(self, printer):
            painter = QPainter(printer)
            painter.setViewport(self.chart_view.rect())
            painter.setWindow(self.chart_view.rect())
            printer.setPageOrientation(QPageLayout.Landscape)
            self.chart_view.render(painter)
            painter.end()
Exemple #3
1
    class Window(QDialog):
        def __init__(self):
            QDialog.__init__(self)
            self.setWindowTitle(
                "Printen grafiek status van externe werken over jaar " +
                jrwk[0:4])
            self.setWindowIcon(QIcon('./images/logos/logo.jpg'))
            self.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint
                                | Qt.WindowMinMaxButtonsHint)
            self.chart = QChart()
            self.chart.legend().show()
            self.chart.legend().setAlignment(Qt.AlignRight)
            self.view = QChartView(self.chart)
            self.view.setRenderHint(QPainter.Antialiasing)
            self.buttonPreview = QPushButton('Afdrukvoorbeeld', self)
            self.buttonPreview.clicked.connect(self.handle_preview)
            self.buttonPreview.setStyleSheet(
                "color: black;  background-color: gainsboro")
            self.buttonPrint = QPushButton('Printen', self)
            self.buttonPrint.clicked.connect(self.handle_print)
            self.buttonPrint.setStyleSheet(
                "color: black;  background-color: gainsboro")
            self.buttonSluit = QPushButton('Sluiten', self)
            self.buttonSluit.clicked.connect(lambda: sluit(self, m_email))
            self.buttonSluit.setStyleSheet(
                "color: black;  background-color: gainsboro")
            self.buttonInfo = QPushButton('Info', self)
            self.buttonInfo.clicked.connect(lambda: info(self))
            self.buttonInfo.setStyleSheet(
                "color: black;  background-color: gainsboro")
            layout = QGridLayout(self)
            layout.addWidget(self.view, 0, 0, 1, 4)
            layout.addWidget(self.buttonInfo, 1, 0)
            layout.addWidget(self.buttonSluit, 1, 1)
            layout.addWidget(self.buttonPrint, 1, 2)
            layout.addWidget(self.buttonPreview, 1, 3)
            self.create_chart()

        def create_chart(self):
            self.chart.setTitle(
                'Grafiek aantal externe werken per status - opnameweek ' +
                jrwk)
            font = QFont("Sans Serif", 10)
            font.setWeight(QFont.Bold)
            self.chart.setTitleFont(font)

            series = QPieSeries()
            slice_ = QPieSlice()
            series.setUseOpenGL(enable=True)
            series.append('Status A = ' + str(rpr[0][2]), rpr[0][2])
            series.append('Status B = ' + str(rpr[1][2]), rpr[1][2])
            series.append('Status C = ' + str(rpr[2][2]), rpr[2][2])
            series.append('Status D = ' + str(rpr[3][2]), rpr[3][2])
            series.append('Status E = ' + str(rpr[4][2]), rpr[4][2])
            series.append('Status F = ' + str(rpr[5][2]), rpr[5][2])
            series.append('Status G = ' + str(rpr[6][2]), rpr[6][2])
            series.append('Status H = ' + str(rpr[7][2]), rpr[7][2])

            for i, slice_ in enumerate(series.slices()):
                slice_.setLabelVisible()
                #slice_.setLabelPosition(3)
                if i == 0:
                    slice_.setPen(QPen(Qt.black, 2))
                    slice_.setBrush(Qt.green)
                elif i == 1:
                    slice_.setPen(QPen(Qt.black, 2))
                    slice_.setBrush(Qt.red)
                elif i == 2:
                    slice_.setExploded()
                    slice_.setPen(QPen(Qt.black, 2))
                    slice_.setBrush(Qt.yellow)
                elif i == 3:
                    slice_.setPen(QPen(Qt.black, 2))
                    slice_.setBrush(Qt.magenta)
                elif i == 4:
                    slice_.setPen(QPen(Qt.black, 2))
                    slice_.setBrush(Qt.cyan)
                elif i == 5:
                    slice_.setPen(QPen(Qt.black, 2))
                    slice_.setBrush(Qt.blue)
                elif i == 6:
                    slice_.setPen(QPen(Qt.black, 2))
                    slice_.setBrush(Qt.darkYellow)
                elif i == 7:
                    slice_.setPen(QPen(Qt.black, 2))
                    slice_.setBrush(Qt.darkRed)

            self.chart.addSeries(series)

        def handle_print(self):
            printer = QPrinter(QPrinter.HighResolution)
            printer.setOrientation(QPrinter.Landscape)
            dialog = QPrintDialog(printer, self)
            if dialog.exec_() == QPrintDialog.Accepted:
                self.handle_paint_request(printer)

        def handle_preview(self):
            dialog = QPrintPreviewDialog()
            dialog.setWindowIcon(QIcon('./images/logos/logo.jpg'))
            dialog.setWindowFlags(dialog.windowFlags()
                                  | Qt.WindowSystemMenuHint
                                  | Qt.WindowMinMaxButtonsHint)
            dialog.resize(1050, 700)
            #dialog.setMinimumSize(1050, 700)
            dialog.paintRequested.connect(self.handle_paint_request)
            dialog.exec_()

        def handle_paint_request(self, printer):
            printer.setPageOrientation(QPageLayout.Landscape)
            painter = QPainter(printer)
            painter.setViewport(self.view.rect())
            painter.setWindow(self.view.rect())
            self.view.render(painter)
            painter.end()
Exemple #4
1
    class Window(QDialog):
        def __init__(self):
            QDialog.__init__(self)
            self.setWindowTitle("Printen grafiek magazijnvoorraad bedragen")
            self.setWindowIcon(QIcon('./images/logos/logo.jpg'))
            self.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint
                                | Qt.WindowMinMaxButtonsHint)
            self.chart = QChart()
            self.chart_view = QChartView(self.chart)
            self.chart_view.setRenderHint(QPainter.Antialiasing)
            self.buttonPreview = QPushButton('Afdrukvoorbeeld', self)
            self.buttonPreview.setStyleSheet(
                "color: black;  background-color: gainsboro")
            self.buttonPreview.clicked.connect(self.handle_preview)
            self.buttonPrint = QPushButton('Printen', self)
            self.buttonPrint.setStyleSheet(
                "color: black;  background-color: gainsboro")
            self.buttonPrint.clicked.connect(self.handle_print)
            self.sluiten = QPushButton('Sluiten', self)
            self.sluiten.setStyleSheet(
                "color: black;  background-color: gainsboro")
            self.sluiten.clicked.connect(lambda: sluiten(self, m_email))
            layout = QGridLayout(self)
            layout.addWidget(self.buttonPrint, 1, 1)
            layout.addWidget(self.sluiten, 1, 0)
            layout.addWidget(self.chart_view, 0, 0, 1, 3)
            layout.addWidget(self.buttonPreview, 1, 2)
            self.create_chart()

        def create_chart(self):
            self.chart.setTitle('Grafiek financieën magazijnvoorraad')
            font = QFont("Sans Serif", 10)
            font.setWeight(QFont.Bold)
            self.chart.setTitleFont(font)

            set0 = QBarSet('Totaal')
            set1 = QBarSet('Courant')
            set2 = QBarSet('Incourant')

            set0 << rpvrd[0][1] << rpvrd[1][1] << rpvrd[2][1] << rpvrd[3][
                1] << rpvrd[4][1] << rpvrd[5][1] << rpvrd[6][1] << rpvrd[7][
                    1] << rpvrd[8][1] << rpvrd[9][1] << rpvrd[10][1] << rpvrd[
                        11][1]
            set1 << rpvrd[0][2] << rpvrd[1][2] << rpvrd[2][2] << rpvrd[3][
                2] << rpvrd[4][2] << rpvrd[5][2] << rpvrd[6][2] << rpvrd[7][
                    2] << rpvrd[8][2] << rpvrd[9][2] << rpvrd[10][2] << rpvrd[
                        11][2]
            set2 << rpvrd[0][3] << rpvrd[1][3] << rpvrd[2][3] << rpvrd[3][
                3] << rpvrd[4][3] << rpvrd[5][3] << rpvrd[6][3] << rpvrd[7][
                    3] << rpvrd[8][3] << rpvrd[9][3] << rpvrd[10][3] << rpvrd[
                        11][3]

            barseries = QBarSeries()
            barseries.append(set0)
            barseries.append(set1)
            barseries.append(set2)

            categories = [rpvrd[0][0],rpvrd[1][0],rpvrd[2][0],rpvrd[3][0],rpvrd[4][0],\
                          rpvrd[5][0],rpvrd[6][0],rpvrd[7][0],rpvrd[8][0],rpvrd[9][0],\
                          rpvrd[10][0],rpvrd[11][0]]

            self.chart.addSeries(barseries)
            self.chart.axisX()
            self.chart.createDefaultAxes()
            axisX = QBarCategoryAxis()
            axisX.append(categories)
            axisX.setTitleText('Voortschrijdende periode over 12 maanden')
            self.chart.setAxisX(axisX, barseries)
            axisX.setRange(rpvrd[0][0], rpvrd[11][0])
            axisX.setLabelsAngle(-90)

        def handle_print(self):
            printer = QPrinter(QPrinter.HighResolution)
            printer.setOrientation(QPrinter.Landscape)
            dialog = QPrintDialog(printer, self)
            if dialog.exec_() == QPrintDialog.Accepted:
                self.handle_paint_request(printer)

        def handle_preview(self):
            dialog = QPrintPreviewDialog()
            dialog.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint
                                  | Qt.WindowMinMaxButtonsHint)
            dialog.setWindowIcon(QIcon('./images/logos/logo.jpg'))
            dialog.setWindowFlags(dialog.windowFlags()
                                  | Qt.WindowSystemMenuHint
                                  | Qt.WindowMinMaxButtonsHint)
            dialog.resize(1200, 800)
            #dialog.setMinimumSize(1200, 800)
            dialog.paintRequested.connect(self.handle_paint_request)
            dialog.exec_()

        def handle_paint_request(self, printer):
            printer.setPageOrientation(QPageLayout.Landscape)
            painter = QPainter(printer)
            painter.setViewport(self.chart_view.rect())
            painter.setWindow(self.chart_view.rect())
            self.chart_view.render(painter)
            painter.end()