2 Attachment(s)
Placing multiple QwtText or QString at different heights on a QwtPlot
Hello everyone! Please help, I'm trying to place different inscriptions on a QwtPlot object. I can't find in the documentation how to place inscriptions using a QPoint object. I could only find how to place QwtText using Qt::AlignmentFlag, in which case it is impossible to place one inscription above another.
I am attaching an example of what I would like to receive.
Attachment 13858
This is a code snippet from the documentation that I used as a reference and tried to find similar methods to set text at the desired position in other classes (e.g. QwtPlotTextLabel, QwtText, QwtTextLabel, QwtPlotItem, QwtLegend, QwtLegendLabel etc.)
Attachment 13859
Re: Placing multiple QwtText or QString at different heights on a QwtPlot
You can control the position using the margin property of the item and the alignment ( QwtText::renderFlags ) of the text.
If this is not good enough you can also overload QwtPlotTextLabel::textRect() and return the bounding rectangle for the text being calculated from whatever you like.
HTH,
Uwe
Re: Placing multiple QwtText or QString at different heights on a QwtPlot
Quote:
Originally Posted by
nayaga
Hello everyone! Please help, I'm trying to place different inscriptions on a QwtPlot object. I can't find in the documentation how to place inscriptions using a QPoint object. I could only find how to place QwtText using Qt::AlignmentFlag, in which case it is impossible to place one inscription above another.
I am attaching an example of what I would like to receive.
Attachment 13858
This is a code snippet from the documentation that I used as a reference and tried to find similar methods to set text at the desired position in other classes (e.g. QwtPlotTextLabel, QwtText, QwtTextLabel, QwtPlotItem, QwtLegend, QwtLegendLabel etc.)
Attachment 13859
Start with the QwtPlotMarker code—tweak X/Y values to fit your plot. If you share your axis ranges or more code, I can fine-tune it. What’s your Qwt version (6.1.x, 6.2)? And what’s the plot for—data viz, science, art?
Moderator note: @helendam: Next time you make a post with a hidden spam URL, you will be banned.