Changing scales in Quickwin App's

Changing scales in Quickwin App's

I am creating a quickwin application to create runtime monitoring plots of engineering computations. I am plotting "real-time" simulation results, and at some time need to rescale the plot. I call SETWINDOW with a new x and y limit to rescale the plot, and this works fine. The problem is all data previously plotted is stuck in the old scaling and is not automatically rescaled. So if I am plotting a sine wave with magnitude of 1, and my original y limits were -1 to 1, the plot first fills the entire y-axis. If halfway through I change the window units to extend from -2, 2 in the y-range, then all new data fills half the window, but the old plotted data still fills the entire window, giving the false impression that the old data extended from -2,2 instead of -1,1. I do not and practically speaking cannot store the old data and rescale it myself and then replot it, so consider that any data already plotted on the screen is lost and cannot be retrieved by me. Is there some other function or methodology I can use to change my plot scale and have old data plotted automatically rescaled

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Um, no, there isn't. What you actually want is to do "StretchBlt" (see Win32 API function of that name) which takes an image and then stretches
it to an area of different size. There is no - AFAIK - an equivalent QuickWin function.

However, you could probably write your own algorithm for that using GetPixelsRGB line-by-line and then SetPixelsRGB to display every even
line (if stretching is always by 1/2) "scanned" by GetPixelsRGB.
If diagrams are relatively smooth, I think that would work fine (not very fast, though); if not, you could "refine" the algorithm by adding some
"smoothing" or "anti-aliasing"...




I know you asked us to treat this as an assumption, but..

I've faced a similar problem in a 2D plotting routine that displays experimental data as it is being acquired. Since you can't know the scale before you've taken the data, you must be able to rescale the plot on the fly. At first, I too thought that I couldn't store the data that had previously been plotted. Then I realized that the highly digested form I was actually plotting was much smaller than the raw data I thought I needed to keep.

The screen has only so many pixels, you can only display so much information, and that amount of information can easily be stored and rescaled when necessary.

At least, that's how it worked out for me. The user can select scale changes at will during the experiment, or even select "Auto" scale. When necessary, the program blanks the screen and completely redraws the entire plot, in some cases as often as 3 times per second. All this while running the experiment in real-time under WinNT on a P133.

Just my two cents. Good Luck.

Leave a Comment

Please sign in to add a comment. Not a member? Join today