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
Forum Updated to NodeBB v4.3 + New Features

Assign specific value to axis

Scheduled Pinned Locked Moved Unsolved General and Desktop
chartsaxisread
2 Posts 2 Posters 501 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 6 Jan 2021, 06:33 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);
    
    J 1 Reply Last reply 7 Jan 2021, 06:43
    0
    • D deleted286
      6 Jan 2021, 06:33

      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);
      
      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 7 Jan 2021, 06:43 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

      2/2

      7 Jan 2021, 06:43

      • Login

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