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 set QScatterSeries axis to draw between them?
Forum Updated to NodeBB v4.3 + New Features

How to set QScatterSeries axis to draw between them?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 534 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.
  • M.H.HM Offline
    M.H.HM Offline
    M.H.H
    wrote on last edited by
    #1

    Hi there,

    I want to know how I can bind chart & QScatterSeries to the axis max & min. I expect the chart to draw the points based on the axis rather than expanding itself.

        axisX = new QValueAxis();
        axisX->setTitleText("Elevation");
        axisX->setLabelFormat("%i");
        axisX->setTickCount(10);
        axisX->setRange( -20,  20);
    
        chart()->addAxis(axisX, Qt::AlignBottom);
    
        axisY = new QValueAxis();
        axisY->setTitleText("Azimuth");
        axisY->setLabelFormat("%i");
        axisY->setTickCount(10);
        axisY->setRange( -20,  20);
        chart()->addAxis(axisY, Qt::AlignLeft);
    
        series0->setMarkerShape(QScatterSeries::MarkerShapeCircle);
        series0->setMarkerSize(10.1);
        series0->setColor( Qt::blue );
        series0->append(10,5);
        series0->append(2.5,-5);
        series0->attachAxis(axisX);
        series0->attachAxis(axisY);
        chart()->addSeries(series0);
    

    Untitled.jpg

    As you can see the points were not positioned base on the axis. In fact, the chart expands itself base on the max values of the points.

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

      what are the coordinates of these three blue points?

      1 Reply Last reply
      0
      • M.H.HM Offline
        M.H.HM Offline
        M.H.H
        wrote on last edited by
        #3

        @M-H-H said in How to set QScatterSeries axis to draw between them?:

        Top of the center is the indicator of series.

        But other 2 points are :
        series0->append(10,5);
        series0->append(2.5,-5);

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

          https://code.qt.io/cgit/qt/qtcharts.git/tree/examples/charts/multiaxis/main.cpp?h=5.15
          I tested 5.9.5 one which works fine.

          M.H.HM 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            https://code.qt.io/cgit/qt/qtcharts.git/tree/examples/charts/multiaxis/main.cpp?h=5.15
            I tested 5.9.5 one which works fine.

            M.H.HM Offline
            M.H.HM Offline
            M.H.H
            wrote on last edited by
            #5

            @JoeCFD
            Yes, it works. But it is not what I mentioned.
            To see my point try to add X-axis and Y-axis range wider than the point values.

            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