A
A
ars-bars2017-10-13 11:46:37
C++ / C#
ars-bars, 2017-10-13 11:46:37

C# GDI+ draw graph with 30,000 points?

Hello!
Using C # Graphics to draw a graph of 30,000 points is, in general, not difficult. But then working with it (zoom in, for example) is costly in terms of resources. It's probably reasonable to draw as many points as can physically fit in the current pixel size.
Suppose there is an array of 30,000 points. How to build such a graph at a width of 800px by "middle" (I don't know how to do it right) points? And then increase any specific area so that the graph is updated and becomes clearer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Makarov, 2017-10-13
@DmitryITWorksMakarov

It is not necessary to build all 30,000 points.
In "good" plots at small scales, the plots are linear, so can be replaced by linear interpolation.
That is:
1. select all points in the required range.
2. Next, we sequentially take points from this range only if the X distance to the previous one exceeds deltaXminGraph in pixels.
3. We connect the previous and current point with a straight line.
It makes sense for the current scale to remember / cache the points used.
But it will work if the graphs are "good"....smooth....
If there is some noise....any noise, impulses.....then you need to filter it first...
If this noise also needs to be drawn, then different options appear here ..... depending on what exactly is interesting ....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question