Hello, i am new in qwt.
My task is plotting data on the spectrogram that come by timer.
For this purpose, I used the example "realtime" in qwt.
At the moment, I'm drawing a spectrogram (data come every 50ms, size of frame 100 points) by adding a new area:
QRect newArea(QPoint( pointX * 100 , pointY ),QSize(100,1));
QRectF rect = QwtScaleMap::transform(
canvasMap( QwtPlot::xBottom),
canvasMap( QwtPlot::yLeft),
newArea );
canvas()->repaint(rect.toRect());
But there is a problem with the speed of data rendering on spectrogram. The schedule is not drawn with the necessary speed.
I do not draw on the full screen. Size of plot is 1000 points on x-axis by 500 on y-axis (but size can be 10000 points on x-axis by 5000 on y-axis).
When drawing on the full screen the speed of data rendering on spectrogram decreases even more.

How can I solve this problem?
May be <qwt_plot glcanvas.h> can help me?
I looked at the topic http://www.qtcentre.org/archive/index.php/t-25795.html. But I did not understand how to use the overload PlotSpectrogram :: renderImage.

Here is my code that is responsible for plotting:

1. incrementalplot.h:

#include <qwt_plot.h>

class QwtPlotSpectrogram;

class IncrementalPlot : public QwtPlot
{
Q_OBJECT

public:
IncrementalPlot( QWidget *parent = NULL );
virtual ~IncrementalPlot();
QwtPlotSpectrogram *d_curve;

void appendPoints( const double, const double );
};


2. incrementalplot.cpp:

#include "incrementalplot.h"
#include <qwt_plot.h>
#include <qwt_plot_canvas.h>
#include <qwt_raster_data.h>
#include <qwt_matrix_raster_data.h>
#include <qwt_plot_spectrogram.h>
#include <qwt_painter.h>
#include "color.h"

class CurveData: public QwtMatrixRasterData
{

public:
double *dataCscan;
int numberOfScansInCscan;
CurveData()
{
//size
numColumns = 1000;
numRaws = 500;
numColors = 100;
//counters
numberOfScansInCscan = 0;
//vector and matrix
QVector <double> values(numColumns*numRaws,0);
dataCscan = values.data();
setValueMatrix( values, numColumns );
//intervals
setInterval( Qt::XAxis,QwtInterval( 0, numColumns, QwtInterval::ExcludeMaximum ) );
setInterval( Qt::YAxis,QwtInterval( 0, numRaws, QwtInterval::ExcludeMaximum ) );
setInterval( Qt::ZAxis, QwtInterval( 0, numColors ) );
}
//size variables
int numColumns;
int numRaws;
int numColors;
//task matrix size
void setMatrixSize()
{
QVector <double> values(numColumns*numRaws,0);
dataCscan = values.data();
setValueMatrix( values, numColumns );
}

void clearNumber()
{
numberOfScansInCscan = 0;
}

public:
//set new data
void rasterDataUpdate()
{
if (numberOfScansInCscan == numColumns*numRaws) qDebug() << "limit exceeded";
else
{
for (int i = 0; i < 100; i++)
dataCscan [ i + numberOfScansInCscan ] = i;
numberOfScansInCscan += 100;
}
}
};

IncrementalPlot::IncrementalPlot( QWidget *parent ):
QwtPlot( parent ),
d_curve( NULL )
{
if ( QwtPainter::isX11GraphicsSystem() )
{
canvas()->setAttribute( Qt::WA_PaintOnScreen, true );
}
//set curve
d_curve = new QwtPlotSpectrogram();
d_curve->setData( new CurveData() );
//set colormap
Color *color = new Color();
d_curve->setColorMap(color);

d_curve->attach( this );

setAutoReplot( false );
}

IncrementalPlot::~IncrementalPlot()
{
delete d_curve;
}

//append new points on curve
void IncrementalPlot::appendPoints( const double pointX, const double pointY)
{
CurveData *data = static_cast<CurveData *>( d_curve->data());
data->rasterDataUpdate();
const bool doClip = !canvas()->testAttribute( Qt::WA_PaintUnclipped );
//repaint part of graph
if ( doClip )
{
QRect newArea(QPoint( pointX * 100 , pointY ),QSize(100,1));
QRectF rect = QwtScaleMap::transform(
canvasMap( QwtPlot::xBottom),
canvasMap( QwtPlot::yLeft),
newArea );
canvas()->repaint(rect.toRect());
}
}

3. plot.h

#include "incrementalplot.h"
#include <qdatetime.h>

class RandomPlot: public IncrementalPlot
{
Q_OBJECT

public:
RandomPlot( QWidget *parent );

virtual QSize sizeHint() const;

//counter and variables for coordinates
int count;
double x;
double y;

public Q_SLOTS:
void stop();
void resetCount();

private Q_SLOTS:
void appendPoint();
};

4. plot.cpp

#include "plot.h"
#include <qglobal.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_layout.h>
#include <qwt_scale_widget.h>
#include <qwt_scale_draw.h>
#include <qwt_plot_curve.h>
#include "qwt_symbol.h"

const unsigned int c_rangeMax = 1000;

RandomPlot::RandomPlot( QWidget *parent ):
IncrementalPlot( parent )
{
setFrameStyle( QFrame::NoFrame );
setLineWidth( 0 );

plotLayout()->setAlignCanvasToScales( true );

QwtPlotGrid *grid = new QwtPlotGrid;
grid->setMajorPen( Qt::gray, 0, Qt:otLine );
grid->attach( this );

setCanvasBackground( QColor( 29, 100, 141 ) );

setAxisScale( xBottom, 0, c_rangeMax );
setAxisScale( yLeft, 0, c_rangeMax/2 );

//set coordinates and count
count = 0; x = 0; y =0;

//canvas
QwtPlotCanvas *plotCanvas = qobject_cast<QwtPlotCanvas *>( canvas() );
plotCanvas->setPaintAttribute( QwtPlotCanvas::BackingStore, false );
replot();
}

QSize RandomPlot::sizeHint() const
{
return QSize( 540, 400 );
}

//set x and y position, append points on curve
void RandomPlot::appendPoint()
{
if ( count % 10 == 0)
{
y++;
x = 1;
}
else x++;
IncrementalPlot::appendPoints(x - 1, y - 1);
count++;
}

//do not use
void RandomPlot::stop()
{
QwtPlotCanvas *plotCanvas = qobject_cast<QwtPlotCanvas *>( canvas() );
plotCanvas->setPaintAttribute( QwtPlotCanvas::BackingStore, true );
}

//do not use
void RandomPlot::resetCount()
{
count = 0;
x = 0;
y = 0;
}

5. mainwindow.h

#include <qmainwindow.h>
#include <qaction.h>

class QPushButton;
class RandomPlot;

class MainWindow: public QMainWindow
{
Q_OBJECT
public:
MainWindow();
RandomPlot *d_plot;
// start button
QPushButton *button;
};

6.mainwindow.cpp

#include "plot.h"
#include "mainwindow.h"
#include <QPushButton>

MainWindow::MainWindow()
{
//start button
button = new QPushButton("Paint");
button->show();
//spectrogram
d_plot = new RandomPlot( this );
const int margin = 4;
d_plot->setContentsMargins( margin, margin, margin, margin );

setCentralWidget( d_plot );
}

7. main

#include "mainwindow.h"
#include <QApplication>
#include <QTimer>
#include <QPushButton>
#include "plot.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow *w = new MainWindow;
//w->resize(500,300);
QTimer *time = new QTimer;
time->setInterval(50);
QObject::connect(w->button, SIGNAL(clicked()), time, SLOT(start()));
QObject::connect(time, SIGNAL(timeout()), w->d_plot, SLOT(appendPoint()));
w->show();
return a.exec();
}

8. colormap

#include<qwt_color_map.h>
class Color: public QwtLinearColorMap
{
public:
Color(): QwtLinearColorMap(Qt::white, Qt::darkRed)
{
//set color
addColorStop(0.10,Qt::blue);
addColorStop(0.25,Qt::darkBlue);
addColorStop(0.40,Qt::green);
addColorStop(0.55,Qt::darkGreen);
addColorStop(0.70,Qt::yellow);
addColorStop(0.80,Qt::darkYellow);
addColorStop(0.90,Qt::red);
}
};

I apologize for such a big post.
Thank you for attention, Anton