How to do it...

This recipe has a background thread acting like an analog signal generator that is able to generate a sine-style stream of data and a graph that plots this data. The resulting application is as follows:

Figure 5.7: The main form showing a sine function generated by a background thread

You can adjust the resolution of the plot (number of points used to draw the sine) using the track bar on the left-hand side. Let's see the most important parts.

The thread used as a signal generator is very simple. As shown in the following code, it uses the System.Math.Sin function to generate a sine wave form. Roughly every 10 milliseconds, ...

Get Delphi Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.