Results 1 to 5 of 5

Thread: QwtPlotHistogram

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Posts
    12
    Qt products
    Qt3 Qt4 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: QwtPlotHistogram

    hey,
    Any one knows how to set some text on each histogram bar ?
    I have used QwtPlotHistogram to plot my histogram.
    I want diffetent labels on each bars of histogram

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

    Default Re: QwtPlotHistogram

    Overload QwtPlotHistogram ::drawColumn(),

    Uwe

  3. #3
    Join Date
    Dec 2010
    Posts
    33
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    7

    Default Re: QwtPlotHistogram

    Could you please elaborate a little more on exactly what is to be done ?
    I wrote
    Qt Code:
    1. class Histogram: public QwtPlotHistogram
    2. {
    3. public:
    4. Histogram(const QString &, const QColor &);
    5. void setColor(const QColor &);
    6. void setValues(uint numValues, const double *);
    7. void drawColumn(QPainter *painter,const QwtColumnRect &rect,const QwtIntervalSample &samples);
    8. };
    To copy to clipboard, switch view to plain text mode 
    and wrote this function
    Qt Code:
    1. void Histogram::drawColumn(QPainter *painter,const QwtColumnRect &rect,const QwtIntervalSample &sample)
    2. {
    3. drawColumn(painter,rect,samples);
    4. QString s="My Text";
    5. painter->drawText(50,100,s);
    6. }
    To copy to clipboard, switch view to plain text mode 

    but no text appeared..

Tags for this Thread

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.