Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Assign specific value to axis
suslucoder last edited by
For axis Y, I want to assing specific line. I have a txt file for reading. I want to assign axis Y the 3rd column. How can i do it?
QDateTimeAxis *axisX = new QDateTimeAxis; axisX->setTickCount(5); axisX->setFormat("MMM yyyy"); axisX->setTitleText("Date"); / chart->addAxis(axisX, Qt::AlignBottom); series->attachAxis(axisX); QValueAxis *axisY = new QValueAxis(); axisY->setTitleText("Values"); axisY->setLabelFormat("%g"); chart->addAxis(axisY, Qt::AlignLeft); series->attachAxis(axisY);
I want to assign axis Y the 3rd column. How can i do it?
The axis does not know anything about that file and columns inside it. You simply need to read your file and put data from that third column as data for Y axis. See https://doc.qt.io/qt-5/qxyseries.html
If you read documentation https://doc.qt.io/qt-5/qxyseries.html#append you will see that you have to provide X AND Y...