How to set QScatterSeries axis to draw between them?
Unsolved
General and Desktop
-
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);
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.
-
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.