久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <legend id='kFydv'><style id='kFydv'><dir id='kFydv'><q id='kFydv'></q></dir></style></legend>
      <bdo id='kFydv'></bdo><ul id='kFydv'></ul>
  1. <tfoot id='kFydv'></tfoot>

    <i id='kFydv'><tr id='kFydv'><dt id='kFydv'><q id='kFydv'><span id='kFydv'><b id='kFydv'><form id='kFydv'><ins id='kFydv'></ins><ul id='kFydv'></ul><sub id='kFydv'></sub></form><legend id='kFydv'></legend><bdo id='kFydv'><pre id='kFydv'><center id='kFydv'></center></pre></bdo></b><th id='kFydv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kFydv'><tfoot id='kFydv'></tfoot><dl id='kFydv'><fieldset id='kFydv'></fieldset></dl></div>

      <small id='kFydv'></small><noframes id='kFydv'>

    1. 將 QChartView 插入 ui

      Insert QChartView to ui(將 QChartView 插入 ui)

            <tbody id='VxDN1'></tbody>
          <tfoot id='VxDN1'></tfoot>
          <i id='VxDN1'><tr id='VxDN1'><dt id='VxDN1'><q id='VxDN1'><span id='VxDN1'><b id='VxDN1'><form id='VxDN1'><ins id='VxDN1'></ins><ul id='VxDN1'></ul><sub id='VxDN1'></sub></form><legend id='VxDN1'></legend><bdo id='VxDN1'><pre id='VxDN1'><center id='VxDN1'></center></pre></bdo></b><th id='VxDN1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VxDN1'><tfoot id='VxDN1'></tfoot><dl id='VxDN1'><fieldset id='VxDN1'></fieldset></dl></div>

            <small id='VxDN1'></small><noframes id='VxDN1'>

              • <bdo id='VxDN1'></bdo><ul id='VxDN1'></ul>

                <legend id='VxDN1'><style id='VxDN1'><dir id='VxDN1'><q id='VxDN1'></q></dir></style></legend>

                本文介紹了將 QChartView 插入 ui的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我試圖把

                <?xml version="1.0" encoding="UTF-8"?><ui版本="4.0"><class>主窗口</class><widget class="QMainWindow" name="MainWindow"><屬性名稱="幾何"><正確><x>0</x><y>0</y><寬度>800</寬度><身高>600</身高></正確></屬性><屬性名="windowTitle"><字符串>主窗口</字符串></屬性><widget class="QWidget" name="centralwidget"><widget class="QPushButton" name="pushButton"><屬性名稱="幾何"><正確><x>210</x><y>280</y><寬度>88</寬度><身高>33</身高></正確></屬性><屬性名稱="文本"><字符串>按鈕</字符串></屬性></小部件><widget class="QPushButton" name="pushButton_2"><屬性名稱="幾何"><正確><x>340</x><y>80</y><寬度>88</寬度><身高>33</身高></正確></屬性><屬性名稱="文本"><string>測試交易</string></屬性></小部件><widget class="QWidget" name="chart_container" native="true"><屬性名稱="幾何"><正確><x>29</x><y>29</y><寬度>291</寬度><身高>231</身高></正確></屬性></小部件></小部件><widget class="QMenuBar" name="menubar"><屬性名稱="幾何"><正確><x>0</x><y>0</y><寬度>800</寬度><身高>24</身高></正確></屬性></小部件><widget class="QStatusBar" name="statusbar"/></小部件><資源/><連接/></ui>

                然后通過布局將QChartView添加到容器中來實現代碼:

                導入系統從 PyQt5 導入 QtCore、QtWidgets、uic、QtChart# 加載兩個ui文件uifile_1 = "UI/main.ui"form_1,base_1 = uic.loadUiType(uifile_1)類示例(base_1,form_1):def __init__(self):超級(base_1,自我).__init__()self.setupUi(self)數據 = ((1, 7380, 7520, 7380, 7510, 7324),(2, 7520, 7580, 7410, 7440, 7372),(3, 7440, 7650, 7310, 7520, 7434),(4, 7450, 7640, 7450, 7550, 7480),(5, 7510, 7590, 7460, 7490, 7502),(6, 7500, 7590, 7480, 7560, 7512),(7, 7560, 7830, 7540, 7800, 7584),)系列 = QtChart.QCandlestickSeries()series.setDecreasingColor(QtCore.Qt.red)series.setIncreasingColor(QtCore.Qt.green)ma5 = QtChart.QLineSeries() # 5天平均數據線tm = [] # 存儲str類型數據# 在一個循環中,series 和 ma5 追加對應的數據對于數據中的 num、o、h、l、c、m:series.append(QtChart.QCandlestickSet(o, h, l, c))ma5.append(QtCore.QPointF(num, m))tm.append(str(num))圖表 = QtChart.QChart()chart.addSeries(series) # 蠟燭圖chart.addSeries(ma5) # ma5 線chart.setAnimationOptions(QtChart.QChart.SeriesAnimations)chart.createDefaultAxes()chart.legend().hide()chart.axisX(series).setCategories(tm)chart.axisX(ma5).setVisible(False)chartview = QtChart.QChartView(圖表)self.chart_container.setContentsMargins(0, 0, 0, 0)放置 = QtWidgets.QHBoxLayout(self.chart_container)lay.setContentsMargins(0, 0, 0, 0)lay.addWidget(chartview)如果 __name__ == "__main__":應用程序 = QtWidgets.QApplication(sys.argv)ex = 示例()ex.show()sys.exit(app.exec_())

                I am trying to put plot candlestick and 5-days average line on a same qtchart but give two x axis plot code into a UI loader

                import sys
                from PyQt5.QtWidgets import QApplication, QWidget
                from PyQt5.QtGui import QIcon
                from PyQt5 import uic
                import sys
                from PyQt5.QtChart import QCandlestickSeries, QChart, QChartView, QCandlestickSet
                from PyQt5.QtWidgets import QApplication, QMainWindow
                from PyQt5.QtCore import Qt, QPointF
                from PyQt5 import QtChart as qc
                
                # load both ui file
                uifile_1 = 'UI/main.ui'
                form_1, base_1 = uic.loadUiType(uifile_1)
                
                uifile_2 = 'UI/main1.ui'
                form_2, base_2 = uic.loadUiType(uifile_2)
                
                
                class Example(base_1, form_1):
                    def __init__(self):
                        super(base_1, self).__init__()
                        self.setupUi(self)
                        self.pushButton_2.clicked.connect(self.change)
                
                    def change(self):
                        self.main = MainPage()
                        self.main.show()
                        # self.close()
                
                
                class MainPage(base_2, form_2):
                    def __init__(self):
                        super(base_2, self).__init__()
                        self.setupUi(self)
                
                if __name__ == '__main__':
                    app = QApplication(sys.argv)
                    ex = Example()
                    ex.show()
                    sys.exit(app.exec_())
                

                I have tried putting a widget but have no idea what are promoted class name and header file for candlesticks.

                The reason I want to do this is that I want to update this candlestick chart at a regular interval of time and also insert some buttons on that window.

                UI

                <?xml version="1.0" encoding="UTF-8"?>
                <ui version="4.0">
                 <class>MainWindow</class>
                 <widget class="QMainWindow" name="MainWindow">
                  <property name="geometry">
                   <rect>
                    <x>0</x>
                    <y>0</y>
                    <width>800</width>
                    <height>600</height>
                   </rect>
                  </property>
                  <property name="windowTitle">
                   <string>MainWindow</string>
                  </property>
                  <widget class="QWidget" name="centralwidget">
                   <widget class="QPushButton" name="pushButton">
                    <property name="geometry">
                     <rect>
                      <x>210</x>
                      <y>280</y>
                      <width>88</width>
                      <height>33</height>
                     </rect>
                    </property>
                    <property name="text">
                     <string>PushButton</string>
                    </property>
                   </widget>
                   <widget class="QPushButton" name="pushButton_2">
                    <property name="geometry">
                     <rect>
                      <x>340</x>
                      <y>80</y>
                      <width>88</width>
                      <height>33</height>
                     </rect>
                    </property>
                    <property name="text">
                     <string>Test Trade</string>
                    </property>
                   </widget>
                   <widget class="PlotWidget" name="widget" native="true">
                    <property name="geometry">
                     <rect>
                      <x>140</x>
                      <y>100</y>
                      <width>120</width>
                      <height>80</height>
                     </rect>
                    </property>
                   </widget>
                  </widget>
                  <widget class="QMenuBar" name="menubar">
                   <property name="geometry">
                    <rect>
                     <x>0</x>
                     <y>0</y>
                     <width>800</width>
                     <height>25</height>
                    </rect>
                   </property>
                  </widget>
                  <widget class="QStatusBar" name="statusbar"/>
                 </widget>
                 <customwidgets>
                  <customwidget>
                   <class>PlotWidget</class>
                   <extends>QWidget</extends>
                   <header>qtgraph</header>
                   <container>1</container>
                  </customwidget>
                 </customwidgets>
                 <resources/>
                 <connections/>
                </ui>
                

                解決方案

                It is not necessary to promote a class, although it is a valid option, so that it can be displayed in a window generated based on a .ui since you can use empty QWidget (without promoting it) as a container, then place a layout, and within the layout the QChartView.

                The image shows an empty QWidget whose name is "chart_container" where the QChartView will be placed:

                <?xml version="1.0" encoding="UTF-8"?>
                <ui version="4.0">
                 <class>MainWindow</class>
                 <widget class="QMainWindow" name="MainWindow">
                  <property name="geometry">
                   <rect>
                    <x>0</x>
                    <y>0</y>
                    <width>800</width>
                    <height>600</height>
                   </rect>
                  </property>
                  <property name="windowTitle">
                   <string>MainWindow</string>
                  </property>
                  <widget class="QWidget" name="centralwidget">
                   <widget class="QPushButton" name="pushButton">
                    <property name="geometry">
                     <rect>
                      <x>210</x>
                      <y>280</y>
                      <width>88</width>
                      <height>33</height>
                     </rect>
                    </property>
                    <property name="text">
                     <string>PushButton</string>
                    </property>
                   </widget>
                   <widget class="QPushButton" name="pushButton_2">
                    <property name="geometry">
                     <rect>
                      <x>340</x>
                      <y>80</y>
                      <width>88</width>
                      <height>33</height>
                     </rect>
                    </property>
                    <property name="text">
                     <string>Test Trade</string>
                    </property>
                   </widget>
                   <widget class="QWidget" name="chart_container" native="true">
                    <property name="geometry">
                     <rect>
                      <x>29</x>
                      <y>29</y>
                      <width>291</width>
                      <height>231</height>
                     </rect>
                    </property>
                   </widget>
                  </widget>
                  <widget class="QMenuBar" name="menubar">
                   <property name="geometry">
                    <rect>
                     <x>0</x>
                     <y>0</y>
                     <width>800</width>
                     <height>24</height>
                    </rect>
                   </property>
                  </widget>
                  <widget class="QStatusBar" name="statusbar"/>
                 </widget>
                 <resources/>
                 <connections/>
                </ui>
                

                The code is then implemented by adding the QChartView to the container through a layout:

                import sys
                
                from PyQt5 import QtCore, QtWidgets, uic, QtChart
                
                # load both ui file
                uifile_1 = "UI/main.ui"
                form_1, base_1 = uic.loadUiType(uifile_1)
                
                
                class Example(base_1, form_1):
                    def __init__(self):
                        super(base_1, self).__init__()
                        self.setupUi(self)
                
                        data = (
                            (1, 7380, 7520, 7380, 7510, 7324),
                            (2, 7520, 7580, 7410, 7440, 7372),
                            (3, 7440, 7650, 7310, 7520, 7434),
                            (4, 7450, 7640, 7450, 7550, 7480),
                            (5, 7510, 7590, 7460, 7490, 7502),
                            (6, 7500, 7590, 7480, 7560, 7512),
                            (7, 7560, 7830, 7540, 7800, 7584),
                        )
                
                        series = QtChart.QCandlestickSeries()
                        series.setDecreasingColor(QtCore.Qt.red)
                        series.setIncreasingColor(QtCore.Qt.green)
                
                        ma5 = QtChart.QLineSeries()  # 5-days average data line
                        tm = []  # stores str type data
                
                        # in a loop,  series and ma5 append corresponding data
                        for num, o, h, l, c, m in data:
                            series.append(QtChart.QCandlestickSet(o, h, l, c))
                            ma5.append(QtCore.QPointF(num, m))
                            tm.append(str(num))
                
                        chart = QtChart.QChart()
                        chart.addSeries(series)  # candle
                        chart.addSeries(ma5)  # ma5 line
                
                        chart.setAnimationOptions(QtChart.QChart.SeriesAnimations)
                        chart.createDefaultAxes()
                        chart.legend().hide()
                
                        chart.axisX(series).setCategories(tm)
                        chart.axisX(ma5).setVisible(False)
                
                        chartview = QtChart.QChartView(chart)
                
                        self.chart_container.setContentsMargins(0, 0, 0, 0)
                        lay = QtWidgets.QHBoxLayout(self.chart_container)
                        lay.setContentsMargins(0, 0, 0, 0)
                        lay.addWidget(chartview)
                
                
                if __name__ == "__main__":
                    app = QtWidgets.QApplication(sys.argv)
                    ex = Example()
                    ex.show()
                    sys.exit(app.exec_())

                這篇關于將 QChartView 插入 ui的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)
                  <tbody id='y3zYd'></tbody>

                  <bdo id='y3zYd'></bdo><ul id='y3zYd'></ul>
                • <tfoot id='y3zYd'></tfoot>
                  • <i id='y3zYd'><tr id='y3zYd'><dt id='y3zYd'><q id='y3zYd'><span id='y3zYd'><b id='y3zYd'><form id='y3zYd'><ins id='y3zYd'></ins><ul id='y3zYd'></ul><sub id='y3zYd'></sub></form><legend id='y3zYd'></legend><bdo id='y3zYd'><pre id='y3zYd'><center id='y3zYd'></center></pre></bdo></b><th id='y3zYd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='y3zYd'><tfoot id='y3zYd'></tfoot><dl id='y3zYd'><fieldset id='y3zYd'></fieldset></dl></div>
                  • <small id='y3zYd'></small><noframes id='y3zYd'>

                    <legend id='y3zYd'><style id='y3zYd'><dir id='y3zYd'><q id='y3zYd'></q></dir></style></legend>

                        1. 主站蜘蛛池模板: 欧美日本韩国一区二区三区 | 欧美一区二区三区大片 | www.久久99 | 亚洲一区久久久 | 亚洲精品欧美一区二区三区 | 日韩精品视频在线观看一区二区三区 | 久草成人 | 91久久看片 | 亚洲精品一区二区二区 | 91精品国产日韩91久久久久久 | 国产中文| 91文字幕巨乱亚洲香蕉 | 国产片一区二区三区 | 国产精品区二区三区日本 | 亚洲精精品 | 国产日韩精品一区 | 99re视频| 欧美综合在线观看 | 国产激情视频在线免费观看 | 91原创视频| 在线观看中文字幕视频 | 日韩精品免费在线观看 | 国产精品免费av | 亚洲国产欧美在线人成 | 99精品亚洲国产精品久久不卡 | 丝袜一区二区三区 | 4hu最新网址 | www.久草.com| 欧美九九九 | 天天操操 | 鲁视频| 欧美 日韩 国产 成人 在线 91 | 日韩在线视频精品 | 久久新| 久久亚洲精品国产精品紫薇 | 一区二区精品 | 国产人成精品一区二区三 | 四季久久免费一区二区三区四区 | 中文字幕在线一区二区三区 | 精品一区二区三区在线观看国产 | 日韩中文一区二区三区 |