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. Selecting the axis markers in QChart
Qt 6.11 is out! See what's new in the release blog

Selecting the axis markers in QChart

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 584 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.
  • A Offline
    A Offline
    adamahl
    wrote on last edited by
    #1

    I am using QtCharts and I am trying to figure out how to set the markers on the x- and y-axis to the values they are based on. With the code I have now the axis values are set with the default ticker I assume.

    chart->legend()->hide();
    chart->addSeries(motor_1);
    chart->createDefaultAxes();
    chart->setTitle("Motor 1");
    chart->setMargins(QMargins(0,0,0,0));
    int max_x = *std::max_element(duration_list.begin(),duration_list.end());
    chart->axisX()->setRange(0, round(max_x*1.1));
    int max_y = *std::max_element(endvalue_list.begin(),endvalue_list.end());
    chart->axisY()->setRange(0,round(max_y));
    ui->gridLayout->addWidget(chartview);
    chartview->setRenderHint(QPainter::Antialiasing);
    

    If the points I want too plot are (0,0),(5,0),(6,36),(30,36) I want markers on the x-axis with values; 0,5,6,30. And on the y-axis; 0,36.

    Is there some setting that lets me set the axis values myself?

    1 Reply Last reply
    0

    • Login

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