Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiDemoFiremonkeyIOSOSXWindows

Draw Cos and Sin On A TPlotGrid In Delphi XE6 Firemonkey On Android And IOS

Delphi XE6 Firemonkey Plot Grid Component ExampleEmbarcadero has a sample that comes with Delphi XE6 Firemonkey which demonstrates plotting lines on a grid using the TPlotGrid component. The TPlotGrid component is basically a grid component where you can draw things like lines or charts and have them match up with the grid background of the component. This component works on Android, IOS, Windows, and OSX. In the sample simple Sin and Cos lines are plotted into a TPolygon and then drawn on the plot grid in the OnPaint event. It has two functions CalculateCos and CalculateSin where the TPolygon is filled up and then DrawPolygon is used to draw it out. There is a function called SetParams where the resolution, radian, origin, and interval of the points is calculated based on the size of the component. Resolution is the precision of the graph. Radian is the angle. Origin is the middle point of the TPlotGrid. And interval is the space between two points. Here is the SetParams function from the sample:

Head over and check out the write up about TPlotGrid on the Embarcadero docwiki.

BONUS: Video demonstrates plotting all kinds of different lines with TPlotGrid.


Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes


Ryzen 9 5950x: One Billion Lines Of Delphi Code Compiled In ~5 Minutes On 16 Cores


DelphiCon 2020 FireMonkey Sessions Available Starting November 19


Powerful Commercial Gorilla3D Framework Upgraded For Delphi FireMonkey On Windows And Android

Sign up for our Newsletter and
stay informed

Leave a Reply