Results 1 to 3 of 3

Thread: Draw a single point into a qwt plot

  1. #1
    Join Date
    Nov 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Draw a single point into a qwt plot

    How can i draw a single point into a Qwt-Plot?

    I tried:
    Whats wrong?


    QwtPlotCurve *cCos = new QwtPlotCurve("y = cos(x)");
    cCos->setRenderHint(QwtPlotItem::RenderAntialiased);
    cCos->setLegendAttribute(QwtPlotCurve::LegendShowLine , true);
    cCos->setPen(QPen(Qt::green));
    QVector<double> xWerte,yWerte;
    xWerte[0]=1;
    yWerte[0]=0;
    QwtSeriesData<QPointF> point;
    point=QwtPointArrayData(xWerte,yWerte);
    cCos->setData(point);
    cCos->attach(ui->qwtPlot);
    }

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draw a single point into a qwt plot

    Set a marker for the curve. A line goes to nowhere if it is a point. How can you see it. A point has no size, does it.
    use
    Qt Code:
    1. QwtPlotCurve::setSymbol(new QwtSymbol(QwtSymbol::Style, QBrush, Qpen, Qsize))
    To copy to clipboard, switch view to plain text mode 

    Hope that helps,
    Cheers.

  3. #3
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Draw a single point into a qwt plot

    Even simpler (and more appropriate) would be to use a marker than a curve.

    Qt Code:
    1. m->setSymbol( QwtSymbol( QwtSymbol::Diamond, Qt::red, Qt::NoPen, QSize( 10, 10 ) ) );
    2. m->setValue( QPointF( 1.5, 2.2 ) );
    3. m->attach( plot );
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 16th May 2011, 08:06
  2. Replies: 2
    Last Post: 5th May 2011, 06:53
  3. draw a point
    By Malek in forum Newbie
    Replies: 14
    Last Post: 26th August 2010, 20:13
  4. display a plot point by point
    By oswalidos in forum Newbie
    Replies: 32
    Last Post: 13th March 2009, 15:37
  5. draw point with mouseevent
    By konvex in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2008, 04:49

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.