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. I'm not getting QValueAxis and chart->createDefaultAxes()
Qt 6.11 is out! See what's new in the release blog

I'm not getting QValueAxis and chart->createDefaultAxes()

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 Posters 2.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
    thippu
    wrote on last edited by
    #1

    Hi Guys,
    I read the QValueAxis doc and also used createDefaultAxes()
    but I can't understand the QValueAxis usages and advantages over createDefaultAxes().

    If you have any thoughts about them please help me in understanding them with examples,
    Thanks in advance.

    Gojir4G T 2 Replies Last reply
    0
    • T thippu

      Hi Guys,
      I read the QValueAxis doc and also used createDefaultAxes()
      but I can't understand the QValueAxis usages and advantages over createDefaultAxes().

      If you have any thoughts about them please help me in understanding them with examples,
      Thanks in advance.

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

      @thippu Hi,

      The advantage of QValueAxis is that you can customize the axis according to your need, by changing font, colors, tick count, (see also AbstractAxis properties), etc... But usually createDefaultAxes() will make the job.

      Personnaly I have used it only to make the font smaller for displaying on Mobile.

      Here is a simple example:

       ChartView{
          //...    
          LineSeries {
              //...
              axisY: ValueAxis{
                  labelsFont.pointSize: 8
                  color: "blue"
                  labelsAngle: 20
              }
          }
       }
      
      T 1 Reply Last reply
      0
      • T thippu

        Hi Guys,
        I read the QValueAxis doc and also used createDefaultAxes()
        but I can't understand the QValueAxis usages and advantages over createDefaultAxes().

        If you have any thoughts about them please help me in understanding them with examples,
        Thanks in advance.

        T Offline
        T Offline
        thippu
        wrote on last edited by
        #3

        @thippu `
        Let's say clarify my doubt
        code:

        // I have defined QChart object 
        QValueAxis *AxisX=new QValueAxis;
        axisX->setRange(0,2000);
        axisX->setLableFormat("%g");
        axisX->setTitleText("Samplees");
        
        QValuesAxis *axisY=new QValueAxis;
        axisY->setRange(-1,1);
        axisY->setTitleText("Audio level");
        
        
        chart->setAxisX(axisX,series);
        chart->setAxisY(axisY,series);
        chart->setAxisX(axisX,series2);
        chart->setAxisY(axisY,series2);
        
        
        
        // I have two dynamic QLineSeries objs those are series and series2 have defined them and now I want to plot them on the chart, In this series2 is not getting plotted on the chart, there is no lose or empty data on the series2, both series objects are connected to same data source,
        //chart is displaying only series object data.
        
        

        So, Is there any mistakes in the setAxes to the chart?

        Gojir4G 1 Reply Last reply
        0
        • Gojir4G Gojir4

          @thippu Hi,

          The advantage of QValueAxis is that you can customize the axis according to your need, by changing font, colors, tick count, (see also AbstractAxis properties), etc... But usually createDefaultAxes() will make the job.

          Personnaly I have used it only to make the font smaller for displaying on Mobile.

          Here is a simple example:

           ChartView{
              //...    
              LineSeries {
                  //...
                  axisY: ValueAxis{
                      labelsFont.pointSize: 8
                      color: "blue"
                      labelsAngle: 20
                  }
              }
           }
          
          T Offline
          T Offline
          thippu
          wrote on last edited by
          #4

          @Gojir4 okay, thanks for the reply I'm using c++

          Gojir4G 1 Reply Last reply
          0
          • T thippu

            @Gojir4 okay, thanks for the reply I'm using c++

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

            @thippu Sorry. Anyway that's the same in C++

            1 Reply Last reply
            0
            • T thippu

              @thippu `
              Let's say clarify my doubt
              code:

              // I have defined QChart object 
              QValueAxis *AxisX=new QValueAxis;
              axisX->setRange(0,2000);
              axisX->setLableFormat("%g");
              axisX->setTitleText("Samplees");
              
              QValuesAxis *axisY=new QValueAxis;
              axisY->setRange(-1,1);
              axisY->setTitleText("Audio level");
              
              
              chart->setAxisX(axisX,series);
              chart->setAxisY(axisY,series);
              chart->setAxisX(axisX,series2);
              chart->setAxisY(axisY,series2);
              
              
              
              // I have two dynamic QLineSeries objs those are series and series2 have defined them and now I want to plot them on the chart, In this series2 is not getting plotted on the chart, there is no lose or empty data on the series2, both series objects are connected to same data source,
              //chart is displaying only series object data.
              
              

              So, Is there any mistakes in the setAxes to the chart?

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

              @thippu said in I'm not getting QValueAxis and chart->createDefaultAxes():

              both series objects are connected to same data source

              Does that mean that both series display the same data ?
              In this case maybe you see only one series in your chart because serires2 is hidden under series1 ?

              T 1 Reply Last reply
              0
              • Gojir4G Gojir4

                @thippu said in I'm not getting QValueAxis and chart->createDefaultAxes():

                both series objects are connected to same data source

                Does that mean that both series display the same data ?
                In this case maybe you see only one series in your chart because serires2 is hidden under series1 ?

                T Offline
                T Offline
                thippu
                wrote on last edited by
                #7

                @Gojir4 Yes, same data stream is given to the both but I have changed the QPen colors of them so we can see the changes through this think.

                Gojir4G 1 Reply Last reply
                0
                • T thippu

                  @Gojir4 Yes, same data stream is given to the both but I have changed the QPen colors of them so we can see the changes through this think.

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

                  @thippu I don't think so, if they have same width you will only see the one which is at "front". Maybe try to increase the pen width of the one which is at "back".
                  I'm pretty sure that if you display different data in series2 you will see it.

                  T 1 Reply Last reply
                  0
                  • Gojir4G Gojir4

                    @thippu I don't think so, if they have same width you will only see the one which is at "front". Maybe try to increase the pen width of the one which is at "back".
                    I'm pretty sure that if you display different data in series2 you will see it.

                    T Offline
                    T Offline
                    thippu
                    wrote on last edited by
                    #9

                    @Gojir4 I did increase the width. Before this I should understand the QValueAxis properly. Is there any video or documents with example

                    Gojir4G 1 Reply Last reply
                    0
                    • T thippu

                      @Gojir4 I did increase the width. Before this I should understand the QValueAxis properly. Is there any video or documents with example

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

                      @thippu You can find many examples in Qt Charts Examples and some useful documentation in Qt Charts Overview.

                      You can also find many tutorials by typing "qt charts" in Youtube.

                      1 Reply Last reply
                      1

                      • Login

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