Thanks for the reply Uwe. I got the waterfall working using the value method. What im doing is add my data to a buffer and shift out the old data with the new samples, this gets the waterfall scrolling nicely. The only problem is it slows down my system quite a bit, the gui becomes less responsive. I think its because the entire waterfall is being redrawn from scratch every time the value method is called. Is there a way i can shift the current waterfall by one pixel and only draw the last line? The buffer is about lengthXheightXsizeof(double)=1024x200x8=1.6MB big. Is this too much data?
This is my QwtRasterData::value() method implementation.
double WaterfallData::value(double x, double y) const
{
double returnValue = -90.0;
double height = interval(Qt::YAxis).maxValue();
double left = interval(Qt::XAxis).minValue();
double right = interval(Qt::XAxis).maxValue();
double ylen = static_cast<double>(_historyLength-1);
double xlen = static_cast<double>(_dataPoints-1);
const unsigned int intY = static_cast<unsigned int>((1.0 - y/height) * ylen);
const unsigned int intX = static_cast<unsigned int>((((x - left) / (right-left)) * xlen) + 0.5);
const int location = (intY * _dataPoints) + intX;
//ensure location is valid
if((location > -1) && (location < WATERFALL_AREA)){
returnValue = _waterfallDataBuffer[location];
}
return returnValue;
}
double WaterfallData::value(double x, double y) const
{
double returnValue = -90.0;
double height = interval(Qt::YAxis).maxValue();
double left = interval(Qt::XAxis).minValue();
double right = interval(Qt::XAxis).maxValue();
double ylen = static_cast<double>(_historyLength-1);
double xlen = static_cast<double>(_dataPoints-1);
const unsigned int intY = static_cast<unsigned int>((1.0 - y/height) * ylen);
const unsigned int intX = static_cast<unsigned int>((((x - left) / (right-left)) * xlen) + 0.5);
const int location = (intY * _dataPoints) + intX;
//ensure location is valid
if((location > -1) && (location < WATERFALL_AREA)){
returnValue = _waterfallDataBuffer[location];
}
return returnValue;
}
To copy to clipboard, switch view to plain text mode
Bookmarks