Hi to all! Some time ago I downloaded Qwt. All OK. Compiling OK. Installing OK.
A troubles with using in project was resolved successfully. But I need a histogram.
Well, there is an example present in source code. Good. Building... OK.
Trying to start examples one by one.
bode - segmentation fault 
cpuplot - symbol lookup error: ./cpuplot: undefined symbol: _ZNK9QwtLegend4findEPK20QwtLegendItemManager ????
curvedemo1, curvedemo1 - segmentation fault 
 
data_plot - segmentation fault :-/
dials - ok :-D
event_filter - ok :-)
histogram - segmentation fault :-/
radio - ok :-D
realtime - segmentation fault :-/
simple - segmentation fault :-/
sliders - ok :-D
spectrogram - segmentation fault >:-/
sysinfo - ok :-)
So, it`s a pity, but I can`t see most interesting examples. Well. I`m trying to write a histogram for my project. Step by step I`m trying to understand what`s wrong with example "histogram". As I understood there are no class like QwtHistogram. So, in example I have 
	
	{
public:
    explicit HistogramItem
(const QwtText &title
);
     virtual ~HistogramItem();
 
 
    void setColor
(const QColor &);
  
    virtual QwtDoubleRect boundingRect() const;
 
    virtual int rtti() const;
 
 
    void setBaseline(double reference);
    double baseline() const;
 
    enum HistogramAttribute
    {
        Auto = 0,
        Xfy = 1
    };
 
    void setHistogramAttribute(HistogramAttribute, bool on = true);
    bool testHistogramAttribute(HistogramAttribute) const;
 
protected:
        Qt
::Orientation o, 
const QRect &) const;
 
private:
    void init();
 
    class PrivateData;
    PrivateData *d_data;
};
        class HistogramItem: public QwtPlotItem
{
public:
    explicit HistogramItem(const QString &title = QString::null);
    explicit HistogramItem(const QwtText &title);
    virtual ~HistogramItem();
    void setData(const QwtIntervalData &data);
    const QwtIntervalData &data() const;
    void setColor(const QColor &);
    QColor color() const;
    virtual QwtDoubleRect boundingRect() const;
    virtual int rtti() const;
    virtual void draw(QPainter *, const QwtScaleMap &xMap, 
        const QwtScaleMap &yMap, const QRect &) const;
    void setBaseline(double reference);
    double baseline() const;
    enum HistogramAttribute
    {
        Auto = 0,
        Xfy = 1
    };
    void setHistogramAttribute(HistogramAttribute, bool on = true);
    bool testHistogramAttribute(HistogramAttribute) const;
protected:
    virtual void drawBar(QPainter *,
        Qt::Orientation o, const QRect &) const;
private:
    void init();
    class PrivateData;
    PrivateData *d_data;
};
To copy to clipboard, switch view to plain text mode 
  
I wrote a test as copy of example:
	
	#include <stdlib.h>
#include <qapplication.h>
#include <qpen.h>
#include <qwt_plot.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_marker.h>
#include <qwt_interval_data.h>
#include "histogram_item.h"
 
int main(int argc, char **argv)
{
 
    plot
->setCanvasBackground
(QColor(Qt
::white));
    plot->setTitle("Histogram");
 
    grid->enableXMin(true);
    grid->enableYMin(true);
    grid
->setMajPen
(QPen(Qt
::black, 
0, Qt
::DotLine));
    grid
->setMinPen
(QPen(Qt
::gray, 
0 , Qt
::DotLine));
    grid->attach(plot);
 
    HistogramItem *histogram = new HistogramItem();
    histogram->setColor(Qt::darkCyan);
 
    const int numValues = 20;
 
    QwtArray<QwtDoubleInterval> intervals(numValues);
    QwtArray<double> values(numValues);
 
    double pos = 0.0;
    for ( int i = 0; i < (int)intervals.size(); i++ )
    {
        const int width = 5 + rand() % 15;
        const int value = rand() % 100;
 
        values[i] = value; 
 
        pos += width;
    }
 
    histogram->attach(plot);
 
    plot
->setAxisScale
(QwtPlot::yLeft, 
0.0, 
100.0);
    plot
->setAxisScale
(QwtPlot::xBottom, 
0.0, pos
);
    plot->replot();
 
#if QT_VERSION < 0x040000
    a.setMainWidget(&plot);
#endif
 
    plot->resize(600,400);
    plot->show();
 
    return a.exec(); 
}
        #include <stdlib.h>
#include <qapplication.h>
#include <qpen.h>
#include <qwt_plot.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_marker.h>
#include <qwt_interval_data.h>
#include "histogram_item.h"
int main(int argc, char **argv)
{
    QApplication a(argc, argv);
    QwtPlot* plot = new QwtPlot(0);
    plot->setCanvasBackground(QColor(Qt::white));
    plot->setTitle("Histogram");
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin(true);
    grid->enableYMin(true);
    grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
    grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
    grid->attach(plot);
    HistogramItem *histogram = new HistogramItem();
    histogram->setColor(Qt::darkCyan);
    const int numValues = 20;
    QwtArray<QwtDoubleInterval> intervals(numValues);
    QwtArray<double> values(numValues);
    double pos = 0.0;
    for ( int i = 0; i < (int)intervals.size(); i++ )
    {
        const int width = 5 + rand() % 15;
        const int value = rand() % 100;
        intervals[i] = QwtDoubleInterval(pos, pos + double(width));
        values[i] = value; 
        pos += width;
    }
    histogram->setData(QwtIntervalData(intervals, values));
    histogram->attach(plot);
    plot->setAxisScale(QwtPlot::yLeft, 0.0, 100.0);
    plot->setAxisScale(QwtPlot::xBottom, 0.0, pos);
    plot->replot();
#if QT_VERSION < 0x040000
    a.setMainWidget(&plot);
#endif
    plot->resize(600,400);
    plot->show();
    return a.exec(); 
}
To copy to clipboard, switch view to plain text mode 
  and got segmentation fault in return a.exec();
Can you help me?  Were is problem may be? May be another way present to make histogram? 
Thanks a lot everyone!
				
			
Bookmarks