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 : put min and max of y-axis manually
Forum Updated to NodeBB v4.3 + New Features

QtCharts : put min and max of y-axis manually

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 4.2k Views 2 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.
  • halimaH Offline
    halimaH Offline
    halima
    wrote on last edited by halima
    #1

    Hello everyone,
    Does someone know how can I set the min-max of y-axis from the QchartView (GUI) ?
    Thanks for your help
    0_1564066902787_examples_logvalueaxis.png

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      Is it a good idea to pop up a dialog outside QChartView or by right click inside QChartView to set ranges of X-Y axes

      halimaH 1 Reply Last reply
      1
      • JoeCFDJ JoeCFD

        Is it a good idea to pop up a dialog outside QChartView or by right click inside QChartView to set ranges of X-Y axes

        halimaH Offline
        halimaH Offline
        halima
        wrote on last edited by
        #3

        @joecfd Hello,thanks for your reply
        yes why not it is an intermediate solution, but I wonder if it is possible to change the values directly on the ChartView :)

        Pl45m4P 1 Reply Last reply
        0
        • halimaH halima

          @joecfd Hello,thanks for your reply
          yes why not it is an intermediate solution, but I wonder if it is possible to change the values directly on the ChartView :)

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @halima

          You are probably looking for this QAbstactAxis#setRange.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          halimaH 1 Reply Last reply
          2
          • Pl45m4P Pl45m4

            @halima

            You are probably looking for this QAbstactAxis#setRange.

            halimaH Offline
            halimaH Offline
            halima
            wrote on last edited by
            #5

            @pl45m4
            yes absolutely i need to use QAbstactAxis#setRange from the view.

            For this I guess that I have to use paintEvent, to draw a LineEdit for the min and max, like this I can put the new min/max .

            Pl45m4P 1 Reply Last reply
            0
            • halimaH halima

              @pl45m4
              yes absolutely i need to use QAbstactAxis#setRange from the view.

              For this I guess that I have to use paintEvent, to draw a LineEdit for the min and max, like this I can put the new min/max .

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by
              #6

              @halima said in QtCharts : put min and max of y-axis manually:

              For this I guess that I have to use paintEvent, to draw a LineEdit for the min and max, like this I can put the new min/max

              No. Just get your current Y-Axis from your QChart and set your values as new range (Min, Max).

              QAbstractAxis *yAxis = myChart->axis(Qt::Vertical); // Only works, if you have 1 series, otherwise you have to pass the series after the orientation
              yAxis->setRange(min, max);
              

              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              halimaH 1 Reply Last reply
              2
              • Pl45m4P Pl45m4

                @halima said in QtCharts : put min and max of y-axis manually:

                For this I guess that I have to use paintEvent, to draw a LineEdit for the min and max, like this I can put the new min/max

                No. Just get your current Y-Axis from your QChart and set your values as new range (Min, Max).

                QAbstractAxis *yAxis = myChart->axis(Qt::Vertical); // Only works, if you have 1 series, otherwise you have to pass the series after the orientation
                yAxis->setRange(min, max);
                
                halimaH Offline
                halimaH Offline
                halima
                wrote on last edited by halima
                #7

                @pl45m4
                Thanks for your help and reply :)
                I think I'm not explained my problem well. my problem is more in the HMI. how can I write the min and max that I want in the Qchartview to pass them to QAbstactAxis#setRange.

                0_1564131013987_examples_logvalueaxis.png

                Pl45m4P 1 Reply Last reply
                0
                • halimaH halima

                  @pl45m4
                  Thanks for your help and reply :)
                  I think I'm not explained my problem well. my problem is more in the HMI. how can I write the min and max that I want in the Qchartview to pass them to QAbstactAxis#setRange.

                  0_1564131013987_examples_logvalueaxis.png

                  Pl45m4P Offline
                  Pl45m4P Offline
                  Pl45m4
                  wrote on last edited by Pl45m4
                  #8

                  @halima

                  There is no function / GUI object inside QChart / QChartView to set the range of the axis directly, but you could use QSliders to adjust the range (maybe horizontal slider for X-Axis and vertical slider for Y-Axis).


                  If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                  ~E. W. Dijkstra

                  halimaH 1 Reply Last reply
                  2
                  • Pl45m4P Pl45m4

                    @halima

                    There is no function / GUI object inside QChart / QChartView to set the range of the axis directly, but you could use QSliders to adjust the range (maybe horizontal slider for X-Axis and vertical slider for Y-Axis).

                    halimaH Offline
                    halimaH Offline
                    halima
                    wrote on last edited by
                    #9

                    @pl45m4 Ok thanks a lot ;)

                    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