Hello. I want some suggestions on how to my code a bit more versatile. I altered the SpectrogramData example for a discrete series of XYZ data simply by coupling the x and y to the discrete values of my Data->ZData vector.
Qt Code:
  1. class SpectrogramData: public QwtRasterData
  2. {
  3. public:
  4. ...
  5. virtual double value(double x, double y) const
  6. {
  7. double dx, dy;
  8. dx = (Data->Xdata.last()-Data->Xdata.first())/(Data->Xdata.size()-1);
  9. dy = (Data->Ydata.last()-Data->Ydata.first())/(Data->Ydata.size()-1);
  10. int i = (x-Data->Xdata.first())/dx, j = (y-Data->Ydata.first())/dy;
  11. return Data->Zdata[j][i];
  12. }
  13. ...
  14. }
To copy to clipboard, switch view to plain text mode 
This type of resampling works well if I am operating with linearly sampled data (XData and YData are equidistant). How can I improve this algorithm for a series of non-linearly scaled data (i.e. XData = [1 10 20 50 70 100 1000])?