How can I add txt file datas in QLineSeries?
Unsolved
General and Desktop
-
I want to read my datas from txt file. They are hold in "allLines". For creating a chart in that datas, I write such thing:
QChart *chart = new QChart(); chart->legend()->hide(); QLineSeries *series = new QLineSeries();
When I tried to chart->addSeries(allLines) ı get an error ---> conversion from QStringList' to 'QtCharts::QAbstract Series.
How can i fix it?
-
@suslucoder As the error message tells you addSeries takes a QAbstractSeries, not a string list as parameter. You have to pass it one of the QAreaSeries, QBoxPlotSeries, QCandlestickSeries, QPieSeries, and QXYSeries.
You also should tell us what data your file actually contains? If it contains x/y values then you first have to convert the data to numbers and create a QXYSeries instance and fill it with that data (https://doc.qt.io/qt-5/qxyseries.html#append).