qchart

How to update/redraw QChart after data is added to QLineSeries?

依然范特西╮ 提交于 2021-02-18 22:09:05
问题 I am generating some data that I want to chart using QChart & friends. This is my first time using QChart , and so basically what I did was copy the QLineSeries Example and modify it to my needs. My current code looks like this: quint64 last=0; quint64 *lastp=&last; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , series( nullptr ) { ui->setupUi(this); QChart *chart = new QChart(); series=new QLineSeries(chart); chart->legend()->hide(); chart->addSeries

How to update/redraw QChart after data is added to QLineSeries?

不打扰是莪最后的温柔 提交于 2021-02-18 22:01:36
问题 I am generating some data that I want to chart using QChart & friends. This is my first time using QChart , and so basically what I did was copy the QLineSeries Example and modify it to my needs. My current code looks like this: quint64 last=0; quint64 *lastp=&last; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , series( nullptr ) { ui->setupUi(this); QChart *chart = new QChart(); series=new QLineSeries(chart); chart->legend()->hide(); chart->addSeries

How to create Subplot using QCharts?

﹥>﹥吖頭↗ 提交于 2021-02-11 09:45:31
问题 I want to create two subplots (like 2 rows), the first plot will show the line series graph based on Analog to Digital Converter counts stored in a text file and the second plot will show the line series graph based on Temperature values stored in a text file. I am able to plot the line series in the same plot, but I want to plot it in two separate subplots. #include <QApplication> #include <QMainWindow> #include <QFile> #include <QTextStream> #include <QDateTime> #include <QTime> #include

QT insert widget inside an other widget

被刻印的时光 ゝ 提交于 2020-01-11 10:47:20
问题 I've created an UI with qt Creator,in this UI there is just a button and a widget (let's call it respectively button and char_container); I need to add a chartview programmatically inside the chart_container. I didn't change the default layout. I've tried the following code,but it does not work: void MainWindow::button_slot(){ QtCharts::QChart *chart = new QtCharts::QChart(); QtCharts::QChartView *chartView = new QtCharts::QChartView(chart); chartView->setParent(ui->chart_container); this

How to map QChart coordinate to QChartView point?

青春壹個敷衍的年華 提交于 2019-12-11 17:36:30
问题 I want to make a rubber band window in QChart, but I don't know how to map a coordinate of QChart to QChartView. e.g. (0, 0) is a QChart coordinate, maybe it in QChartView is (10, 10), how to transform it? I have saw the answer of Get mouse coordinates in QChartView's axis system But it seems like that it is reversed with my requirement. import sys from PyQt5.QtChart import QChart, QChartView, QLineSeries from PyQt5.QtCore import QPointF, QEvent, QPoint, QRect from PyQt5.QtWidgets import

How to change one QBarSet bar/element color in qt?

女生的网名这么多〃 提交于 2019-12-10 18:50:01
问题 I connected to the hovered signal of QBarSet to a slot, which will change the QBarSet color when mouse hovers on the bar set and reset the color when mouse leaves. The code snippet looks like this: void BarChart::hoverTest(bool status, int index) { if(status == true) { set->setColor(Qt::red); //changes to bar set color to red mouse when hovers on bar set } else { set->setColor(QColor(52, 152, 219)); //reset the color when mouse leaves } } And those are the pics before hovering and when hovers

How to insert QChartView in form with Qt Designer?

谁说我不能喝 提交于 2019-11-29 09:20:21
I want to add QChart to the form. But I can't find it in the Widget Box. So I created it in the code. How can I insert it in QWidget or QFrame or something else? I want to set area of that widget in QtDesigner. Option 1: Promoted I suppose you mean inserting a QChartView, because QChartView inherits from QGraphicsView, this would be a good option, for this we do the following: first add QT += charts in the .pro place the QGraphicsView to the design. Right click on the QGraphicsView and select Promote to... When doing the above, a menu appears, in the menu it should be set in QChartView in

How to insert QChartView in form with Qt Designer?

南楼画角 提交于 2019-11-28 02:39:47
问题 I want to add QChart to the form. But I can't find it in the Widget Box. So I created it in the code. How can I insert it in QWidget or QFrame or something else? I want to set area of that widget in QtDesigner. 回答1: Option 1: Promoted I suppose you mean inserting a QChartView, because QChartView inherits from QGraphicsView, this would be a good option, for this we do the following: first add QT += charts in the .pro place the QGraphicsView to the design. Right click on the QGraphicsView and