guiGraphCreate (Function) |
Top Previous Next |
This function creates a new graph on the provided form. Wrap = TRUE
Graphs can be used to visualize data, supporting both a bar graph and line graphs.
The total size of the graph depends on the x_scale and x_count parameters. If the product of these parameters are larger than the available area for the graph, the graph can be scrolled by clicking on the left and right thirds.
The entries can be set in two different ways. It can be set using the index of the entry to update. This is suited to e.g. show historic data or data where each bar shows a specific reading. Alternatively, data can be added to a buffer and then appended to the end of the graph when guiGraphScrollNext is called, dropping the oldest data if the graph is full. This is suited for showing the history of a reading, e.g. a temperature sensor.
Input: Wrap = FALSE form : SYSHANDLE A handle to the form that the graph is created on.
x : SINT default 1 The horizontal location of the graph.
y : SINT default 1 The vertical location of the graph.
w : SINT default 1 The width of the graph.
h : SINT default 1 The height of the graph.
tag : DINT The tag value to store.
y_min : INT default -100 The minimum value to show on the graph.
y_max : INT default 100 The maximum value to show on the graph.
x_scale : INT (1..25) default 5 The width of each entry in pixels. This is the width of the bar and the space until the next bar for bar graphs, and the distance from one point on the line graph to the next.
x_count : INT (1..240) default 20 The number of entries to store in the graph. This determines how many entries that can be added before the graph is full.
bars : INT (0,1) default 0 Set to 1 to show the bar graph, set to 0 to disable the bar graph.
lines : INT (0..4) default 0 Determines the number of line graphs to show.
wrap : BOOL default FALSE Determines how the graph reacts when entries are appended when it is full. Set to TRUE, the graph will wrap around when it is full, similar to how an oscilloscope works. It shows a vertical line just after the latest data. Set to FALSE, the entry is added at the end and the graph is scrolled, dropping the first entry.
Output: graph : SYSHANDLE The handle to the new graph.
Returns: INT
Declaration: FUNCTION guiGraphCreate : INT;
Example: INCLUDE rtcu.inc |