06-14-2006 01:02 PM
06-14-2006 05:37 PM
06-15-2006 12:12 PM
06-15-2006 06:40 PM
06-16-2006 08:36 AM
Carl:
In my opinion you really would be better off trying to reduce the amount of data you are trying to plot. The screen doesn't have the resolution, so why give the plotting function so much work to do? (Ok, I know it's the easy option)
If simply omitting points won't work for you, you could try what I normally do, which is to just plot the maximum and minimum values over a range of samples.
e.g. if you have an array of 50000 points
double inData[50000];
of the data you want to plot, then you could reduce this to (say) 10000 samples in a second array:
double plotData[10000];
using the following algorithm (there are all sorts of things you can do to speed this up, I've kept it simple):
int indx, kndx;
for (indx=kndx=0;indx<50000;indx+=10)
{
int jndx;
double maxVal = inData[indx];
double minVal = maxVal;
for (jndx=1;jndx<10;jndx++) // Note get maximum and minimum vals, so 10 points reduces to 2 points
{
if (inData[indx+jndx]<minVal)
minVal = inData[indx+jndx];
else if (inData[indx+jndx]>maxVal)
maxVal = inData[indx+jndx];
}
plotData[kndx++] = minVal;
plotData[kndx++] = maxVal;
}
Whilst this takes some processing, the plot routines won't have to do all that scaling and line drawing, so you usually win in terms of execution speed.