Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Qt Graphs. Building 2d plot using c++ only.
QtWS25 Last Chance

Qt Graphs. Building 2d plot using c++ only.

Scheduled Pinned Locked Moved Unsolved Qt 6
16 Posts 4 Posters 1.5k 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.
  • V Vernat
    16 Oct 2024, 16:57

    @Pl45m4 Thanks, but you didn't answer my question. How to build 2D plot using c++ only ? I read this documentation and did not find it. Could you show me a small example without the QML code ?

    P Offline
    P Offline
    Pl45m4
    wrote on 16 Oct 2024, 18:35 last edited by
    #4

    @Vernat

    • https://doc.qt.io/qt-6/qtcharts-examples.html

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

    ~E. W. Dijkstra

    V 1 Reply Last reply 16 Oct 2024, 19:38
    0
    • P Pl45m4
      16 Oct 2024, 18:35

      @Vernat

      • https://doc.qt.io/qt-6/qtcharts-examples.html
      V Offline
      V Offline
      Vernat
      wrote on 16 Oct 2024, 19:38 last edited by
      #5

      @Pl45m4 They are about using Qt Charts, not about Qt Graphs. I saw https://doc.qt.io/qt-6/graphs-examples-2d.html. They all are about using Qt Graphs from qml side. They use https://doc.qt.io/qt-6/qml-qtgraphs-graphsview.html as the main type for showing a plot. I tried to find its C++ representation and did not find it. That is why I started this topic. Is it possible to build 2d in C++ using Qt Graphs?

      P 1 Reply Last reply 16 Oct 2024, 22:13
      0
      • V Vernat
        16 Oct 2024, 19:38

        @Pl45m4 They are about using Qt Charts, not about Qt Graphs. I saw https://doc.qt.io/qt-6/graphs-examples-2d.html. They all are about using Qt Graphs from qml side. They use https://doc.qt.io/qt-6/qml-qtgraphs-graphsview.html as the main type for showing a plot. I tried to find its C++ representation and did not find it. That is why I started this topic. Is it possible to build 2d in C++ using Qt Graphs?

        P Offline
        P Offline
        Pl45m4
        wrote on 16 Oct 2024, 22:13 last edited by
        #6

        @Vernat said in Qt Graphs. Building 2d plot using c++ only.:

        Is it possible to build 2d in C++ using Qt Graphs?

        Yes, just look at the module documentation and the C++ classes. That's what I said above.
        But AFAICS there are no Qt Graph C++ Examples yet.
        Most 2D plotting is still in QtCharts. As you can read there, the module is under maintenance.
        Most parts will be moved to the new QtGraphs, which unites QML, C++, 2D and 3D plotting.


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

        ~E. W. Dijkstra

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vernat
          wrote on 17 Oct 2024, 13:04 last edited by
          #7

          QValueAxis from the charts is not the same as QValueAxis from the graphs, I hope it will be fixed

          P 1 Reply Last reply 17 Oct 2024, 13:31
          0
          • V Vernat
            17 Oct 2024, 13:04

            QValueAxis from the charts is not the same as QValueAxis from the graphs, I hope it will be fixed

            P Offline
            P Offline
            Pl45m4
            wrote on 17 Oct 2024, 13:31 last edited by Pl45m4
            #8

            @Vernat

            Note: The Qt Charts module is in the maintenance phase. For new projects, consider using the Qt Graphs module. To render 2D charts, QtGraphs uses Qt Quick Shapes, which is a more modern GUI technology compared to the outdated Qt Graphics View Framework used by the Qt Charts module.
            ( https://doc.qt.io/qt-6/qtcharts-index.html )

            You said you don't want to deal with QML, but in the future the backend and how Graphs are rendered will be QML even in C++ use cases.

            @Vernat said in Qt Graphs. Building 2d plot using c++ only.:

            QValueAxis from the charts is not the same as QValueAxis from the graphs.

            What is different?
            Make your own axis?!

            I hope it will be fixed

            I don't think they will revert "improvements" to where it was before in QtChart with GraphicsView backend/rendering.


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

            ~E. W. Dijkstra

            1 Reply Last reply
            1
            • S Offline
              S Offline
              SandSnip3r
              wrote on 18 Mar 2025, 17:18 last edited by
              #9

              Damn @Pl45m4, idk why you're being so rude. I found this thread quite helpful because the Qt documentation on this topic is very confusing. The charts page says

              Note: The Qt Charts module is in the maintenance phase. For new projects, consider using the Qt Graphs module. To render 2D charts, QtGraphs uses Qt Quick Shapes, which is a more modern GUI technology compared to the outdated Qt Graphics View Framework used by the Qt Charts module.

              Then looking at QtGraphs docs, you just get a bunch of QML source. There's nothing mentioning that 2d charts/graphs are still using the old system.

              P 1 Reply Last reply 18 Mar 2025, 17:43
              0
              • S SandSnip3r
                18 Mar 2025, 17:18

                Damn @Pl45m4, idk why you're being so rude. I found this thread quite helpful because the Qt documentation on this topic is very confusing. The charts page says

                Note: The Qt Charts module is in the maintenance phase. For new projects, consider using the Qt Graphs module. To render 2D charts, QtGraphs uses Qt Quick Shapes, which is a more modern GUI technology compared to the outdated Qt Graphics View Framework used by the Qt Charts module.

                Then looking at QtGraphs docs, you just get a bunch of QML source. There's nothing mentioning that 2d charts/graphs are still using the old system.

                P Offline
                P Offline
                Pl45m4
                wrote on 18 Mar 2025, 17:43 last edited by Pl45m4
                #10

                @SandSnip3r

                Where I was rude?!
                BTW: Exactly that bit you quoted from the documentation, I've linked and quoted above already ;-)
                It is the way it is... the new QtGraphs module uses a QML backend for rendering, even when you use its C++ / QtWidget API


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

                ~E. W. Dijkstra

                J 1 Reply Last reply 18 Mar 2025, 17:53
                2
                • P Pl45m4
                  18 Mar 2025, 17:43

                  @SandSnip3r

                  Where I was rude?!
                  BTW: Exactly that bit you quoted from the documentation, I've linked and quoted above already ;-)
                  It is the way it is... the new QtGraphs module uses a QML backend for rendering, even when you use its C++ / QtWidget API

                  J Offline
                  J Offline
                  JonB
                  wrote on 18 Mar 2025, 17:53 last edited by
                  #11

                  @Pl45m4 said in Qt Graphs. Building 2d plot using c++ only.:

                  Where I was rude?!

                  You were not rude anywhere, only helpful/to the point. Maybe @SandSnip3r misread or misunderstood.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SandSnip3r
                    wrote on 19 Mar 2025, 23:13 last edited by
                    #12

                    Maybe I misunderstood.

                    Sorry, I'm still having trouble understanding how to use a 2d "QtGraph" from C++. You said "the new QtGraphs module uses a QML backend for rendering, even when you use its C++ / QtWidget API." That's fine, but how do you construct & interact with a 2d "Qt Graph" (which uses a "QML backend")?

                    I see that there are C++ classes for Qt Graphs, like https://doc.qt.io/qt-6/qlineseries.html, but this seems to just be a class which represents data? What's the C++ class which I use as the view? Is there some QWidget-based class which I'd then add the series to?

                    P 1 Reply Last reply 20 Mar 2025, 04:22
                    0
                    • S SandSnip3r
                      19 Mar 2025, 23:13

                      Maybe I misunderstood.

                      Sorry, I'm still having trouble understanding how to use a 2d "QtGraph" from C++. You said "the new QtGraphs module uses a QML backend for rendering, even when you use its C++ / QtWidget API." That's fine, but how do you construct & interact with a 2d "Qt Graph" (which uses a "QML backend")?

                      I see that there are C++ classes for Qt Graphs, like https://doc.qt.io/qt-6/qlineseries.html, but this seems to just be a class which represents data? What's the C++ class which I use as the view? Is there some QWidget-based class which I'd then add the series to?

                      P Offline
                      P Offline
                      Pl45m4
                      wrote on 20 Mar 2025, 04:22 last edited by
                      #13

                      @SandSnip3r said in Qt Graphs. Building 2d plot using c++ only.:

                      What's the C++ class which I use as the view? Is there some QWidget-based class which I'd then add the series to?

                      The QtGraphs Module is still under development.
                      I think the correct class is QGraphsView, but it doesn't seem to exist yet.

                      It's mentioned here as this function returns this type.

                      • https://doc.qt.io/qt-6/qabstractseries.html#graph

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

                      ~E. W. Dijkstra

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SandSnip3r
                        wrote on 20 Mar 2025, 19:13 last edited by
                        #14

                        Isn't the Graphs moved out of technical preview as of 6.8? I thought I saw something, but cant find it again, about the qt widgets support for 2d graphs being lagging. Do you know if Qt communicates this roadmap externally? I don't see anything about it the Jira board of known issues.

                        P 1 Reply Last reply 26 Mar 2025, 01:17
                        0
                        • S Offline
                          S Offline
                          SandSnip3r
                          wrote on 26 Mar 2025, 00:17 last edited by
                          #15

                          Does Graphs even aim to replace the current 2d qt charts? Or is Graphs just meant to be a 3d thing?

                          If it does, is there a way to use the qml-based Qt Graphs from C++?

                          1 Reply Last reply
                          0
                          • S SandSnip3r
                            20 Mar 2025, 19:13

                            Isn't the Graphs moved out of technical preview as of 6.8? I thought I saw something, but cant find it again, about the qt widgets support for 2d graphs being lagging. Do you know if Qt communicates this roadmap externally? I don't see anything about it the Jira board of known issues.

                            P Offline
                            P Offline
                            Pl45m4
                            wrote on 26 Mar 2025, 01:17 last edited by Pl45m4
                            #16

                            @SandSnip3r said in Qt Graphs. Building 2d plot using c++ only.:

                            Isn't the Graphs moved out of technical preview as of 6.8?

                            Should be but as you can see from OPs question QGraphsView, the C++ API to access the QML backend is mentioned in the documentation but not implemented nor it has it's own documentation page... the links lead to nowhere... :(

                            Maybe use the QML interface for now and handle it like any other hybrid QML/C++ app

                            QGraphs should be 2D and 3D + C++ and QML... but not everything seem to work right now.


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

                            ~E. W. Dijkstra

                            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