Difference between revisions of "Component: GLCD Graph Creator (Displays: Graphical)"
(2 intermediate revisions by the same user not shown) | |||
Line 41: | Line 41: | ||
* The width should be equal to or a multiple of the number of points | * The width should be equal to or a multiple of the number of points | ||
− | * The height should be equal to or a | + | * The height should be equal to or a division of the input range - Min Value 0 to Max Value 255 = input range of 256 |
* If Show Border is enabled then Width and Height should be as above plus 2 to account for the border pixels | * If Show Border is enabled then Width and Height should be as above plus 2 to account for the border pixels | ||
Line 89: | Line 89: | ||
==Simulation macro reference== | ==Simulation macro reference== | ||
− | === | + | ===<span style="font-weight: normal;"><u><tt>ExportToCSV</tt></u></span>=== |
Exports the data in the graph to a CSV file. | Exports the data in the graph to a CSV file. | ||
− | + | '''Parameters''' | |
− | :[[Variable Types| | + | :[[Variable Types|<- STRING]] ''Filename'' |
− | :: | + | ::''This parameter may be returned back to the caller'' |
− | + | '''Return value''' | |
− | : | + | :''This call does not return a value'' |
==Property reference== | ==Property reference== | ||
Line 107: | Line 107: | ||
This property is of type ''Panel object'' and can be referenced with the variable name ''glcd_obj''. | This property is of type ''Panel object'' and can be referenced with the variable name ''glcd_obj''. | ||
− | Graphical LCD Object to draw the | + | Graphical LCD Object to draw the graph on |
<span style="font-weight: normal;"><u>ColourDisplay</u></span> | <span style="font-weight: normal;"><u>ColourDisplay</u></span> | ||
Line 114: | Line 114: | ||
Automatically detects if the graphical LCD object is colour or monochrome | Automatically detects if the graphical LCD object is colour or monochrome | ||
+ | |||
+ | <span style="font-weight: normal;"><u>X Coord</u></span> | ||
+ | |||
+ | This property is of type ''Unsigned integer'' and can be referenced with the variable name ''XC''. | ||
+ | |||
+ | X coordinate for the top left of the graph container rectangle | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Y Coord</u></span> | ||
+ | |||
+ | This property is of type ''Unsigned integer'' and can be referenced with the variable name ''YC''. | ||
+ | |||
+ | Y coordinate for the top left of the graph container rectangle | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Width</u></span> | ||
+ | |||
+ | This property is of type ''Unsigned integer'' and can be referenced with the variable name ''WP''. | ||
+ | |||
+ | Horizontal size of the graph in pixels | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Height</u></span> | ||
+ | |||
+ | This property is of type ''Unsigned integer'' and can be referenced with the variable name ''HP''. | ||
+ | |||
+ | Vertical size of the graph in pixels | ||
<span style="font-weight: normal;"><u>Number Of Plots</u></span> | <span style="font-weight: normal;"><u>Number Of Plots</u></span> | ||
Line 128: | Line 152: | ||
Number of data points the graph can store, multiplied by the number of plots. | Number of data points the graph can store, multiplied by the number of plots. | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Scrolling</u></span> | ||
+ | |||
+ | This property is of type ''True or false'' and can be referenced with the variable name ''Scrolling''. | ||
+ | |||
+ | Controls how data is drawn onto the display. | ||
+ | |||
+ | Scrolling is useful for slower data where you want a constant plot with the right hand side always being the latest data. | ||
+ | |||
+ | None scrolling is useful for faster data such as audio snippets. | ||
<span style="font-weight: normal;"><u>Graph Style</u></span> | <span style="font-weight: normal;"><u>Graph Style</u></span> | ||
Line 133: | Line 167: | ||
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''GraphStyle''. | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''GraphStyle''. | ||
− | + | Controls the graph draw style. | |
+ | Point - Draws a single point | ||
+ | Line - Draws a line from the last point to the new point | ||
<span style="font-weight: normal;"><u>Min Value</u></span> | <span style="font-weight: normal;"><u>Min Value</u></span> | ||
Line 141: | Line 177: | ||
This property is of type ''Signed integer'' and can be referenced with the variable name ''MinVal''. | This property is of type ''Signed integer'' and can be referenced with the variable name ''MinVal''. | ||
− | + | Value to represent the bottom Y axis on the graph | |
− | |||
− | |||
<span style="font-weight: normal;"><u>Max Value</u></span> | <span style="font-weight: normal;"><u>Max Value</u></span> | ||
Line 149: | Line 183: | ||
This property is of type ''Signed integer'' and can be referenced with the variable name ''MaxVal''. | This property is of type ''Signed integer'' and can be referenced with the variable name ''MaxVal''. | ||
− | + | Value to represent the top Y axis on the graph | |
+ | |||
+ | <span style="font-weight: normal;"><u>Show Border</u></span> | ||
+ | This property is of type ''True or false'' and can be referenced with the variable name ''ShowBorder''. | ||
+ | Decides if a border for the graph is generated | ||
<span style="font-weight: normal;"><u>Show Grid</u></span> | <span style="font-weight: normal;"><u>Show Grid</u></span> | ||
Line 157: | Line 195: | ||
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''ShowGrid''. | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''ShowGrid''. | ||
− | + | Decides if a X or Y grid is shown for the graph | |
− | |||
− | |||
<span style="font-weight: normal;"><u>Background Colour</u></span> | <span style="font-weight: normal;"><u>Background Colour</u></span> | ||
Line 167: | Line 203: | ||
Determines the graph background colour. | Determines the graph background colour. | ||
− | <span style="font-weight: normal;"><u>Plot | + | <span style="font-weight: normal;"><u>Plot 0 Colour</u></span> |
This property is of type ''Color picker'' and can be referenced with the variable name ''P1Col''. | This property is of type ''Color picker'' and can be referenced with the variable name ''P1Col''. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Determines the graph plot colour. | Determines the graph plot colour. |
Latest revision as of 16:08, 12 March 2019
Author | Matrix TSL |
Version | 1.2 (Release) |
Category | Displays: Graphical |
Contents
GLCD Graph Creator component
A component to simplify the process of drawing graphs and charts using a graphical LCD.
Examples
The graph creator component must be linked to the graphical LCD using the gLCD Object property.
The X Coord, Y Coord, Width and Height component properties set the size and position of the graph on the gLCD.
In the attached example the ADC component sets the input to the graph. Every 50ms a sample is taken and added to the graph.
Any size of graph can be created. For efficiency it is best to try and stick to the following rules.
- The width should be equal to or a multiple of the number of points
- The height should be equal to or a division of the input range - Min Value 0 to Max Value 255 = input range of 256
- If Show Border is enabled then Width and Height should be as above plus 2 to account for the border pixels
Downloadable macro reference
AddPoint
Adds a new data point to the graph.
Parameters
- UINT Data
- Data Value to plot
- BYTE Index
- Plot Index: Range 0-7
Return value
- This call does not return a value
Initialise
Initialises the graph object on the GLCD to the specified dimensions.
X, Y coordinates dictate the top left corner of the graph.
Width, Height measurements dictate the size of the graph.
Parameters
- UINT X
- UINT Y
- UINT Width
- UINT Height
Return value
- This call does not return a value
Simulation macro reference
ExportToCSV
Exports the data in the graph to a CSV file.
Parameters
- <- STRING Filename
- This parameter may be returned back to the caller
Return value
- This call does not return a value
Property reference
gLCD Object
This property is of type Panel object and can be referenced with the variable name glcd_obj.
Graphical LCD Object to draw the graph on
ColourDisplay
This property is of type True or false and can be referenced with the variable name Colour_Display.
Automatically detects if the graphical LCD object is colour or monochrome
X Coord
This property is of type Unsigned integer and can be referenced with the variable name XC.
X coordinate for the top left of the graph container rectangle
Y Coord
This property is of type Unsigned integer and can be referenced with the variable name YC.
Y coordinate for the top left of the graph container rectangle
Width
This property is of type Unsigned integer and can be referenced with the variable name WP.
Horizontal size of the graph in pixels
Height
This property is of type Unsigned integer and can be referenced with the variable name HP.
Vertical size of the graph in pixels
Number Of Plots
This property is of type Fixed list of ints and can be referenced with the variable name NumPlots.
Determines the number of plots that can be displayed simultaneously on the graph.
Monochrome displays can only support a single plot.
Number Of Points
This property is of type Unsigned integer and can be referenced with the variable name NumPoints.
Number of data points the graph can store, multiplied by the number of plots.
Scrolling
This property is of type True or false and can be referenced with the variable name Scrolling.
Controls how data is drawn onto the display.
Scrolling is useful for slower data where you want a constant plot with the right hand side always being the latest data.
None scrolling is useful for faster data such as audio snippets.
Graph Style
This property is of type Fixed list of ints and can be referenced with the variable name GraphStyle.
Controls the graph draw style.
Point - Draws a single point
Line - Draws a line from the last point to the new point
Min Value
This property is of type Signed integer and can be referenced with the variable name MinVal.
Value to represent the bottom Y axis on the graph
Max Value
This property is of type Signed integer and can be referenced with the variable name MaxVal.
Value to represent the top Y axis on the graph
Show Border
This property is of type True or false and can be referenced with the variable name ShowBorder.
Decides if a border for the graph is generated
Show Grid
This property is of type Fixed list of ints and can be referenced with the variable name ShowGrid.
Decides if a X or Y grid is shown for the graph
Background Colour
This property is of type Color picker and can be referenced with the variable name BgCol.
Determines the graph background colour.
Plot 0 Colour
This property is of type Color picker and can be referenced with the variable name P1Col.
Determines the graph plot colour.