Results 1 to 2 of 2

Thread: How to fix Plot Marker Label displaying outside of frame/ canvas

  1. #1
    Join Date
    Jun 2016
    Qt products

    Default How to fix Plot Marker Label displaying outside of frame/ canvas

    I have a plot marker that I want to put a label on. The label is 3 lines (marker #, x coor, y coord). The bottom line is always inside the canvas/ plot window, but the top 2 lines go outside the frame and cannot be seen if the point is close to the y limits of the canvas. I'm not sure how to fix this, I've tried changing the alignment and it doesn't seem to help.

    QwtPlotMarker *temp = marker;

    QString label;
    label.sprintf("Marker %d\nX: %.2f\nY: %.2f", i+1,xVal, yVal);
    QwtText text;

  2. #2
    Join Date
    Feb 2006
    Munich, Germany
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    MacOS X Unix/X11 Windows

    Default Re: How to fix Plot Marker Label displaying outside of frame/ canvas

    Unfortunately there is no public API, where you can modify the bounding rectangle of the label text - all what you have is to overload QwtPlotMarker::drawLabel.
    But the implementation of QwtPlotMarker::drawLabel is no rocket science and you can simply copy out the code to your overloaded method and somehow include the canvas rectangle,


  3. The following user says thank you to Uwe for this useful post:

    scoutycat (25th July 2016)

Similar Threads

  1. Replies: 10
    Last Post: 7th March 2014, 09:40
  2. Replies: 2
    Last Post: 12th September 2012, 07:43
  3. Zooming the plot without the marker
    By raghvendramisra in forum Qwt
    Replies: 1
    Last Post: 17th May 2012, 17:24
  4. Moving plot marker with the mouse
    By viridis in forum Qwt
    Replies: 2
    Last Post: 23rd September 2008, 20:39
  5. Label for frame
    By brcain in forum Qt Tools
    Replies: 2
    Last Post: 25th September 2006, 23:13


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.