Component: GLCD Graph Creator (Displays: Graphical)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 1.2 (Release)
Category Displays: Graphical


Image 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.


GraphCreatorProp.jpg


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.


FC6 Icon.png Graph Creator Demo


GraphCreatorDemo.jpg


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.