All default qcustomplot axis values show up on the left side.
How can it be made on the right side of the plot.
Simple things like these is missing in the documentation. It is so frustrating.
All default qcustomplot axis values show up on the left side.
How can it be made on the right side of the plot.
Simple things like these is missing in the documentation. It is so frustrating.
I am trying with this but no result
qcustomchart->yAxis->setRangeReversed(true);
Sorry but this is super easy to find out by just reading the beginner tutorial on the website, and reading the documentation.
yAxis->setVisible(false); yAxis2->setVisible(true);
would be a start...
The demo screenshots on the website main page also have plots where right/top axes are shown. Click on the screenshots to see the code.
@DerManu
The example gives example on Graph. What if I want to create a text? Only One text inside the chart.
QCPItemText *textLabel = new QCPItemText(obj); textLabel->position->setCoords(*x1,*y1); textLabel->setText(text);
This code doesnt work.
Also when i try to plot rectangles ,the rectangles are not plotted if I use this code
rect = new QCPItemRect(qcustomplotobj); rect->topLeft->setCoords(*x1, *y1); rect->bottomRight->setCoords(*x2, *y2); rect->setBrush(QBrush((*baseColor))); rect->setPen(Qt::NoPen);
Thanks @DerManu for the good documentation. The below line saved for.
textLabel->position->setAxes(obj->xAxis,obj->yAxis2);
For anyone else stumbling to the following code. The total code for rectangle and text is as follows
rect = new QCPItemRect(obj); rect->position->setAxes(obj->xAxis,obj->yAxis2); rect->topLeft->setCoords(*x1, *y1); rect->bottomRight->setCoords(*x2, *y2); rect->setBrush(QBrush((*baseColor))); rect->setPen(Qt::NoPen);
Ignore the previous post.
The correct code is following
Rectangle
rect = new QCPItemRect(obj); rect->topLeft->setAxes(obj->xAxis,obj->yAxis2); rect->topLeft->setCoords(*x1, *y1); rect->bottomRight->setAxes(obj->xAxis,obj->yAxis2); rect->bottomRight->setCoords(*x2, *y2); rect->setBrush(QBrush((*baseColor))); rect->setPen(Qt::NoPen);
Text
QCPItemText *textLabel = new QCPItemText(obj); textLabel->position->setAxes(obj->xAxis,obj->yAxis2); textLabel->position->setCoords(*x1,*y1); // place position at center/top of axis rect textLabel->setText(text);