Results 1 to 10 of 10

Thread: qwt overlay plot

  1. #1
    Join Date
    Mar 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default qwt overlay plot

    Hi,

    i have a plot in qwt. i would like to add some overlay to show that a curve is violated from point t to t+x.

    Is there a way to achieve this feature?
    e.g.
    https://community.dynatrace.com/comm...4014427&api=v2

    Thanks,

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

    Default Re: qwt overlay plot

    Your link doesn't work for me.

    Uwe

  3. #3
    Join Date
    Mar 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qwt overlay plot

    hm....

    i also upload an image, can you see it now? i refer to the red rectangle overlay indicating a violation in the graph... Screen Shot 2015-06-14 at 3.07.15 PM.jpg
    Last edited by Surfman19; 14th June 2015 at 14:17.

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

    Default Re: qwt overlay plot

    Well this looks simply like filling some area with a red pen and a semitransparent red brush ( guess with an alpha about 100 ).
    Candidates for the implementation are QwtPlotShapeItem or QwtPlotZoneItem.

    Uwe

  5. #5
    Join Date
    Mar 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qwt overlay plot

    thanks for the info.
    i have a problem with qwtplotshapeitem: it does not overlay with the plot, any idea?

    how can i set the coordinate of the rectangle to the ymax, ymin and to the plot item x=10 till x = 100?

    Qt Code:
    1. QColor color(255,0,0,100);
    2.  
    3. path.addRect(20, 20, 60, 60);
    4.  
    5. QwtPlotShapeItem *pitem = new QwtPlotShapeItem();
    6. pitem->setItemAttribute(QwtPlotItem::Legend, true);
    7. pitem->setRenderHint(QwtPlotItem::RenderAntialiased, true);
    8. pitem->setShape(path);
    9. pitem->setPen(color);
    10. pitem->setBrush(color);
    11. pitem->attach(plot.get());
    12.  
    13. plot->replot();
    To copy to clipboard, switch view to plain text mode 
    Last edited by Surfman19; 14th June 2015 at 19:15.

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

    Default Re: qwt overlay plot

    Quote Originally Posted by Surfman19 View Post
    i have a problem that the qwtplotshapeitem does not overlay with the plot, any idea?
    Probably - if I would know, what is meant by "does not overlay".

    how can i set the coordinate of the rectangle to the ymax, ymin and to the plot item x=10 till x = 100?
    If ymin/ymax simply mean top/bottom of the plot canvas, than your looking for QwtPlotZoneItem.

    Uwe

  7. #7
    Join Date
    Mar 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qwt overlay plot

    i mean that the qwtplotshapeitem should be on top of my QwtPlotCurve, at the moment the qwtplotshapeitem moves the QwtPlotCurve to the bottom...
    see here:
    http://img.ctrlv.in/img/15/06/14/557dd35c189d0.jpg

    how can i extract the x coords from my QwtPlotCurve and pass it to qwtplotshapeitem? from x=10 to x=100
    ymax = top, ymin = bottom of the qwtplot.

    edit: i solved the problem.... just used wrong coords for QPaintPath, addRect.... i only need to specific the region of the violation with the coordinates of .addRect...

    how should the QwtPlotZoneItem be useful here? can you show an example?

    does qwt use opengl in the behind the scenes per default? could you use it? do people use it to render the plot?
    Last edited by Surfman19; 14th June 2015 at 20:35.

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

    Default Re: qwt overlay plot

    Quote Originally Posted by Surfman19 View Post
    i mean that the qwtplotshapeitem should be on top of my QwtPlotCurve, at the moment the qwtplotshapeitem moves the QwtPlotCurve to the bottom...
    It doesn't - your rectangle simply doesn't match the y coordinates of your curve ( those are much smaller ) and in its default settings it has an effect on the autoscaler.
    how can i extract the x coords from my QwtPlotCurve and pass it to qwtplotshapeitem? from x=10 to x=100
    ymax = top, ymin = bottom of the qwtplot.
    QwtPlotCurve inherits the API of QwtSeriesStore<QPointF>.

    Uwe

  9. #9
    Join Date
    Mar 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qwt overlay plot

    ok, will look into it.

    how can i detach the qwtplotshapeitem after i dont need it any more? i dont want to delete the object, bc i activate the qwtplotshapeitem again later...
    Last edited by Surfman19; 14th June 2015 at 20:56.

  10. #10
    Join Date
    Dec 2013
    Location
    Toronto, Canada
    Posts
    62
    Thanked 16 Times in 15 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: qwt overlay plot

    i dont want to delete the object, bc i activate the qwtplotshapeitem again later
    Have a look at
    QwtPlotDict::detachItems(...)

Similar Threads

  1. Video and OSD Overlay
    By akhilesh_s in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 12th September 2012, 13:46
  2. QGLWidget with overlay
    By pandora-qt in forum Qt Programming
    Replies: 0
    Last Post: 29th February 2008, 10:44
  3. QScrollView Overlay
    By EricTheFruitbat in forum Qt Programming
    Replies: 5
    Last Post: 27th December 2006, 09:29
  4. Pixmap Overlay
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 22nd June 2006, 20:19
  5. Overlay
    By ToddAtWSU in forum Qt Programming
    Replies: 21
    Last Post: 24th May 2006, 13:15

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.