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 to change the increment of QAbstractAxis?
Qt 6.11 is out! See what's new in the release blog

How to change the increment of QAbstractAxis?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 633 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.
  • E Offline
    E Offline
    El3ctroGh0st
    wrote on last edited by
    #1

    Hello,
    I have this chart:
    0_1522759903912_00eba65a-8b1e-4537-96a3-573053ef7857-image.png
    However, I would like to change the increment of the x Axis to one so that it goes like {1,2,3,4,5...,12,13}. I have searched around the documentation of QAbstractAxis but I haven't been able to find anything that does something like that (maybe I'm just overlooking it, though). Is there a way to do this? (Also, it would be good if I could remove the .0 at the y Axis because I'm working with integers anyways).

    J.HilkJ 1 Reply Last reply
    0
    • E El3ctroGh0st

      Hello,
      I have this chart:
      0_1522759903912_00eba65a-8b1e-4537-96a3-573053ef7857-image.png
      However, I would like to change the increment of the x Axis to one so that it goes like {1,2,3,4,5...,12,13}. I have searched around the documentation of QAbstractAxis but I haven't been able to find anything that does something like that (maybe I'm just overlooking it, though). Is there a way to do this? (Also, it would be good if I could remove the .0 at the y Axis because I'm working with integers anyways).

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      hi @El3ctroGh0st
      you should be able to modify the axes with QValueAxis::setRange(qreal min, qreal max) and QValueAxis::setTickCount(int count)
      Also you might want to take a look at void QValueAxis::applyNiceNumbers() may help on your case as well


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      E 1 Reply Last reply
      4
      • J.HilkJ J.Hilk

        hi @El3ctroGh0st
        you should be able to modify the axes with QValueAxis::setRange(qreal min, qreal max) and QValueAxis::setTickCount(int count)
        Also you might want to take a look at void QValueAxis::applyNiceNumbers() may help on your case as well

        E Offline
        E Offline
        El3ctroGh0st
        wrote on last edited by
        #3

        @J.Hilk That fixed it, thank you!!

        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