Results 1 to 3 of 3

Thread: how to draw labels on the qwtPlotCurve representing the curve points

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to draw labels on the qwtPlotCurve representing the curve points

    hi,
    I have plotted the curve using setSamples(QVector<QPointF>) . now i want to display the points ex(X1,Y1) on the top of the curve for each points the curve used to plot. so how i can add points or labels on the QwtPlotCurve.

    Please help me.
    "Behind every great fortune lies a crime" - Balzac

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

    Default Re: how to draw labels on the qwtPlotCurve representing the curve points

    You could add QwtPlotMarkers for each curve point - but I wouldn't recommend it if you have trillions of points.
    Otherwise you could overload QwtPlotCurve::drawSeries like this:

    Qt Code:
    1. void YourPlotCurve::drawSeries( QPainter *painter,
    2. const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    3. const QRectF &canvasRect, int from, int to ) const
    4. {
    5. QwtPlotCurve::drawSeries( painter, ... );
    6. drawTextLabels( painter, xMap, yMap, canvasRect, from, to );
    7. }
    8.  
    9. void YourPlotCurve::drawTextLabels( QPainter *painter, const QwtSymbol &symbol,
    10. const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    11. const QRectF &canvasRect, int from, int to ) const
    12. {
    13. // maybe have a look at the implementation of QwtPlotCurve::drawSymbols
    14. ...
    15. }
    To copy to clipboard, switch view to plain text mode 

    Uwe

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

    wagmare (9th May 2016)

  4. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to draw labels on the qwtPlotCurve representing the curve points

    thanks Uwe.
    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. Replies: 8
    Last Post: 9th February 2014, 13:37
  2. Replies: 1
    Last Post: 1st June 2011, 08:39
  3. Replies: 4
    Last Post: 29th April 2010, 07:11
  4. Replies: 1
    Last Post: 22nd January 2010, 15:34
  5. Replies: 5
    Last Post: 10th October 2008, 07:44

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.