Back to Blog
Delphi fmx grid6/14/2023 ![]() Origin := PointF(PlotGrid.Width / 2, // Calculate the center point of the plot grid YPixels := PlotGrid.Height / 4 // Contain graph height within a quarter of the grid height (actually half because of neg values) XPixels := PlotGrid.Width / 4 // Contain graph width within a quarter of the grid width (actually half because of neg values) ![]() Radian := -2.0 * Pi // Start angle at -2Pi Resolution := 200 // Set resolution to 200 points Here is the SetParams function from the sample: And interval is the space between two points. Origin is the middle point of the TPlotGrid. Resolution is the precision of the graph. 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. It has two functions CalculateCos and CalculateSin where the TPolygon is filled up and then DrawPolygon is used to draw it out. In the sample simple Sin and Cos lines are plotted into a TPolygon and then drawn on the plot grid in the OnPaint event. This component works on Android, IOS, Windows, and OSX. 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. Embarcadero has a sample that comes with Delphi XE6 Firemonkey which demonstrates plotting lines on a grid using the TPlotGrid component.
0 Comments
Read More
Leave a Reply. |