Solved Why my QChartView with QlineSeries finish with line from last data to the first one?
-
Hello, using textfile to insert data to my series with append, I have the last point = firstline, do you know why and how can I remove it?
void MainWindow::on_actionGraph() { chartView->repaint(); QFile fileOut("d:/Temp_Hygro.txt"); fileOut.open(QIODevice::ReadWrite | QIODevice::Text); while( !fileOut.atEnd())//loop until end of QTextStrem { QString line=fileOut.readLine(); if(line.size()>=51) { date=line.split(":")[0]; bool ok = false; temp=line.split(":")[2].toDouble(&ok); hygro=line.split(":")[4].replace(";","").toDouble(&ok); axisX->append(date,line_count); axisYtemp->append(QString::number(temp),temp); axisYhygro->append(QString::number(hygro),hygro); temperature->append(line_count,temp); qDebug()<<line_count<<" "<<temp; hygrometrie->append(line_count,hygro); } line_count++; } line_count=0; fileOut.close(); fileOut.remove(); const QByteArray data= m_serial->readAll(); readData(data); }
Thank you for your help
-
Hi,
You don't check whether your conversions are working properly so you might end with an invalid value. Or maybe the last value of your input is the same as the fist ?
-
@SGaist the problem was my upload add all values from file each time then add the new value, then to solve the problem, just make serie.clear().