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

QtCharts QBarCategoryAxis Problem!

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.0k 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.
  • T Offline
    T Offline
    televerket
    wrote on last edited by
    #1

    So I am working on a project where I am going to use CandleCharts. I have solved most of the problem I have had but now it seems like I cannot display the category axis correct.
    If i do it this way

        categories << QString::number(20171213,'g',10) << QString::number(20171214,'g',10);
        axisX->setCategories(categories);
    

    Then I get the expected solution. But only two candles for obvious reasons.
    But if I do it in the following way, inside a loop,

    categories << QString::number(set->timestamp(),'g',10);
    

    Then I get this result
    candlestick
    And I don´t want the three dots.
    I have checked with the debug and they print exactly the same

    qDebug() << QString::number(set->timestamp(),'g',10) << QString::number(20171213,'g',10);
    // "20171213" "20171213" 
    

    Anyone that can help with getting this fixed?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      televerket
      wrote on last edited by
      #2

      I also tried doing it this way:

                 qlonglong str = set->timestamp();
                 QString qstr = QString::number(str);
                 qDebug() << qstr;
                 omx->append(set);
                 categories << qstr;
      

      But it gives the exact same problem, even though the print in the debugger is exactly the way it should/I want it to be.

      1 Reply Last reply
      0
      • Gojir4G Offline
        Gojir4G Offline
        Gojir4
        wrote on last edited by Gojir4
        #3

        Hi,

        Did you try :

        axisX->setTickCount(5); // or another value which works for you
        

        Otherwise, you could try to play with the second parameter of the method void QCategoryAxis::append(const QString &categoryLabel, qreal categoryEndValue) to limit the number of the tick on your chart. If I understood correctly his meaning.

        From the doc "categoryEndValue specifies the high end limit of the category. It has to be greater than the high end limit of the previous category. Otherwise the method returns without adding a new category."

        T 1 Reply Last reply
        0
        • Gojir4G Gojir4

          Hi,

          Did you try :

          axisX->setTickCount(5); // or another value which works for you
          

          Otherwise, you could try to play with the second parameter of the method void QCategoryAxis::append(const QString &categoryLabel, qreal categoryEndValue) to limit the number of the tick on your chart. If I understood correctly his meaning.

          From the doc "categoryEndValue specifies the high end limit of the category. It has to be greater than the high end limit of the previous category. Otherwise the method returns without adding a new category."

          T Offline
          T Offline
          televerket
          wrote on last edited by
          #4

          QBarCategoryAxis does not have a member setTickCount, so that didn't work. I never find the problem really, I changed to QDateTimeAxis instead.

          Gojir4G 1 Reply Last reply
          0
          • T televerket

            QBarCategoryAxis does not have a member setTickCount, so that didn't work. I never find the problem really, I changed to QDateTimeAxis instead.

            Gojir4G Offline
            Gojir4G Offline
            Gojir4
            wrote on last edited by
            #5

            @televerket My bad sorry ! I thought it was about QCategoryAxis.

            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