Plotting a thumbnail of line graph

G

Gouri

Hi,

Got a query regarding plotting a preview / thumbnail for a graph
which reads data from a binary file. The preview should should take
very less time, look exactly like the original graph i.e. not miss the
peaks and curves should look similar. Is there algorithm or anyway to
do this in C#.Net.

I have tried plotting points on regular intervals. Saves time but I
m missing peaks and curves don't resemble.

Thanks and Regards,
Gouri
 
G

Gouri

Thanks Eric for the suggestion. However I m already using
ZedGraph for plotting. The problem is regarding the algorithm used for
plotting.

-Gouri
 
E

Eric

Gouri said:
Thanks Eric for the suggestion. However I m already using
ZedGraph for plotting. The problem is regarding the algorithm used for
plotting.

You need to pre-process the data you're reading from the file. You can
do a "sticky" calculation to grab the "lowest low" or "highest high" in
every group of 10 or 100 points. However, the problem will be: should
you use the "lowest low" or the "highest high" for a particular set of
10 points. That will depend on whether the overall curve is going up or
down, but you also need to consider if this group of 10 includes a
change in direction.

Some kind of smoothing algorithm is probably what you want.

But it speed isn't the main concern, I'd just make a fullsize plot,
then stick it in a Bitmap and reduce the size down to a thumbnail. .NET
can easily do this for you, but it might lose some of those sticky
inflection points you want to keep.

There are many different algorithms for reducing the size of an image,
and some of them work better for plots. You can google "image scaling",
"linear interpolation", "Bilinear interpolation", and "Bicubic
interpolation". This article is one I was reading the other day:

http://www.compuphase.com/graphic/scale2.htm

He's using "directional averaging", using what appears to be a
convolution matrix. His application is photo reducing, but the ideas
may help you.

Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top