Hi,
Qwt Spectrogram looks great, but by default is uses double x, y, data as if the routine is supposed to perform some sort of maths on them. What I need to do is plot data from a few QList<double>'s. I have half stolen the code from the spectrogram example but I think my problem is in the value routine where it seems to crash. The data I am trying to plot is held in "QList<double> spectData[180];" Could you provide some pointers as to how to do it correctly?

Cheers.

Qt Code:
  1. class SpectrogramData: public QwtRasterData
  2. {
  3. public:
  4. QpnwPhasedArrayPlot * parent;
  5. // Provide pointer to QpnwPhasedArrayPlot so we can access the data
  6. SpectrogramData( QpnwPhasedArrayPlot * theParent ):
  7. QwtRasterData(QwtDoubleRect(-90, 0, 180, 2000)) // Left, bottom, width, height
  8. {
  9. parent = theParent;
  10. }
  11. // Left as example
  12. virtual QwtRasterData *copy() const
  13. {
  14. return new SpectrogramData(0);
  15. }
  16. // Left as example
  17. virtual QwtDoubleInterval range() const
  18. {
  19. return QwtDoubleInterval(0.0, 4096);
  20. }
  21. // Return data. Crashes here.
  22. virtual double value(double x, double y) const
  23. {
  24. QMessageBox::information(0,"","A");
  25. return parent->spectData[(unsigned int) x+90].at( (unsigned int) y );
  26. }
  27.  
  28. };
  29.  
  30.  
  31.  
  32. QpnwPhasedArrayPlot::QpnwPhasedArrayPlot(QwtPlot * thePlot)
  33. {
  34. DEBUG->print(QDateTime::currentDateTime().toString("dd.MM.yy hh:mm:ss.zzz") + ": " + "Initialising Plot");
  35.  
  36. // Create spectrogram
  37. spectrogram = new QwtPlotSpectrogram();
  38.  
  39. // Create some fake data
  40. for( int x = 0; x < 180; x++ )
  41. for( int y = 0; y < 2000; y++ )
  42. spectData[x].append(y);
  43. spectData[90].clear();
  44. for( int x = 0; x < 2000; x++ )
  45. spectData[90].append(x);
  46.  
  47. // Attach the data
  48. spectrogram->setData(SpectrogramData(this));
  49. spectrogram->attach(thePlot);
  50. }
  51. //
To copy to clipboard, switch view to plain text mode