class RasterData: public QwtRasterData{public: RasterData() { } virtual double value( double x, double y) const { return x; }}; /***кусок кода***/double waterfall_data_max = 0;for (int i = 0; i < size; i++){ if (waterfall_data_max < waterfall_data[i]) waterfall_data_max = waterfall_data[i];}spectre_data->setInterval(Qt::XAxis, QwtInterval( 0.0, size ));spectre_data->setInterval(Qt::YAxis, QwtInterval( 0.0, 100.0 ));spectre_data->setInterval(Qt::ZAxis, QwtInterval( 0.0, waterfall_data_max)); for (int i = 0; i < size; i++){ spectre_data->value(waterfall_data[i], i);}spectrogram->setData(spectre_data);spectrogram->attach(ui.channel_1_waterfall_plot);ui.channel_1_waterfall_plot->replot();
class RasterData: public QwtRasterData{ test_app* m_app;public: //test_app ui; RasterData(test_app* app) { m_app = app; setInterval( Qt::XAxis, QwtInterval( 0.0, 1024.0 ) ); //отсчеты, график влево-вправо от - до + по Х setInterval( Qt::YAxis, QwtInterval( 0.0, 50.0 ) ); //время, график вверх-вниз setInterval( Qt::ZAxis, QwtInterval( 0.0, 10.0 ) ); } virtual double value( double x, double y) const { test_app *mw = m_app; if (mw) { for (int i = 0; i < 1024; i++) { return mw->waterfall_data[i]; } } }};
virtual double value( double x, double y) const{ test_app *mw = m_app; if (mw) { int i = 0; i = x; return mw->waterfall_data[i]; }}