Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I add txt file datas in QLineSeries?
QtWS25 Last Chance

How can I add txt file datas in QLineSeries?

Scheduled Pinned Locked Moved Unsolved General and Desktop
readfilechart
2 Posts 2 Posters 514 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deleted286
    wrote on 4 Jan 2021, 07:42 last edited by
    #1

    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?

    J 1 Reply Last reply 4 Jan 2021, 08:11
    0
    • D deleted286
      4 Jan 2021, 07:42

      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?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 4 Jan 2021, 08:11 last edited by
      #2

      @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).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      1/2

      4 Jan 2021, 07:42

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved