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. Assign specific value to axis

Assign specific value to axis

Scheduled Pinned Locked Moved Unsolved General and Desktop
chartsaxisread
2 Posts 2 Posters 472 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 last edited by
    #1

    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);
    
    jsulmJ 1 Reply Last reply
    0
    • D deleted286

      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);
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @suslucoder said in Assign specific value to axis:

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

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

      1 Reply Last reply
      2

      • Login

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