Results 1 to 3 of 3

Thread: Placing multiple QwtText or QString at different heights on a QwtPlot

  1. #1
    Join Date
    Jun 2024
    Posts
    4
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default 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.

    Снимок экрана 2025-03-12 192228.jpg

    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.)

    Снимок экрана 2025-03-12 193004.png

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default 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

  3. #3

    Default Re: Placing multiple QwtText or QString at different heights on a QwtPlot

    Quote Originally Posted by nayaga View Post
    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.

    Снимок экрана 2025-03-12 192228.jpg

    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.)

    Снимок экрана 2025-03-12 193004.png
    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.
    Last edited by d_stranz; 3rd April 2025 at 16:46. Reason: removed URL

Similar Threads

  1. Replies: 2
    Last Post: 1st September 2022, 20:41
  2. Replies: 3
    Last Post: 2nd May 2015, 17:14
  3. Replies: 0
    Last Post: 21st November 2013, 06:39
  4. QwtPlotRenderer for multiple QwtPlot
    By Momergil in forum Qwt
    Replies: 1
    Last Post: 18th January 2013, 11:09
  5. QwtPlot - multiple axis
    By MukundanAR in forum Qwt
    Replies: 1
    Last Post: 7th March 2012, 07:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.