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. QValueAxis::setTickInterval() has no effect
Forum Updated to NodeBB v4.3 + New Features

QValueAxis::setTickInterval() has no effect

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 250 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Stephan Lorenzen
    wrote on last edited by
    #1

    Dear Forum,

    I Have a QChart with some QLineSeries all attached to the same X and Y axis. However, the scaling of the axes is very weird; Qt always divides the complete range by four and sets that as tick interval. Since my range is some odd number, I end up with crooked tick intervals. I tried to set the tick interval myself; however, that had no effect.

    muell.png

    My code is

    QValueAxis *xAxis = new QValueAxis(this);
    QValueAxis *yAxis = new QValueAxis(this);
    xAxis->setRange(0, maxX());
    yAxis->setRange(0, maxY());
    addAxis(xAxis, Qt::AlignBottom);
    addAxis(yAxis, Qt::AlignLeft);
    xAxis->setTickInterval(unit(maxX(), NTICKS));
    yAxis->setTickInterval(unit(maxY(), NTICKS));
    
    

    The axis is still shown with crooked tick intervals. I expect that the axis shows tick intervals as I set them.

    I am using Qt6.

    Best

    Stephan

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Stephan Lorenzen
      wrote on last edited by
      #2

      I found the answer myself, you have to specify dynamic ticks.

      xAxis->setTickType(QValueAxis::TicksDynamic);
      yAxis->setTickType(QValueAxis::TicksDynamic);
      
      

      Now it works.

      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