A
A
Andrew Grinev @Andrew2014-10-15 16:22:45
Delphi
Andrew Grinev @Andrew, 2014-10-15 16:22:45

Delphi - How to optimize the drawing of a sine curve with more than 1.000.000 samples?

In general, the following problem arose: there are more than 1,000,000 points in the buffer, it is necessary to display a graph with the least amount of time. At the moment I'm using MoveTo - LineTo, but as you can imagine, it's very slow. I tried to use the Ramer-Douglas-Pecker algorithm to reduce the points of the curve, it works quite well, but slowly. I also calculated that the points of the curve would fall into the screen pixel and simply drew a solid line, thereby reducing the number of calls to the LineTo method. The result is also not impressive. Any suggestions for optimization?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Fedoryan, 2014-10-15
@AnnTHony

There are also special components, TChart for example. Try it.

M
Myu2, 2014-10-15
@Myu2

How do you scale it all?
Please provide a piece of code with a MoveTo-LineTo loop and calculations

B
Be Joy, 2014-10-15
@bejoy

It's not entirely clear what exactly "slows down" for you. Are you trying to draw 1,000,000-1 lines on the canvas, or is it a scroll canvas? It is difficult to give any advice on optimizing what is hard to imagine.
Alternatively, you can try to average adjacent values, which will reduce the amount of data by half.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question