LineGraph State Transmission

Description

This transmission carries all necessary parameter to define the state of a LineGraph Property.

Some important points before using the LineGraph:

  • The LineGraph-State can be updated through a state update or a Fast-Data-Setter transmission
  • The LineGraph-data is transmitted in a data string, the syntax for this string is described below.
  • The grid of the LineGraph is adapted to the line-data, on every update. This could be a bad UX when the graph is consistently updated. In this case it is recommended to define a static min/max scope for every axis.
Layout

Byte-Index Description Type
8 Flag Value Dual hex Char
9 Flag Value Dual hex Char
10 Transmission Type Single Char
11 .. LineGraph Data String
.. End Delimiter <CR> Char
Flag Value (8:9)

The flag value defines some preferences which affect the visual state and the behavior. The format is an 8bit hexadecimal value as string (2 char).

Flag Description
0x01 Draw Grid Lines (The LineGraph background will be drawn with grid-lines. The intersection of the grid could be defined with the LineGraph-data string.
0x02 Draw Axis Values (Intersection values will be drawn on each grid-line.)
Transmission Type (10)

This parameter defines how the LineGraph-data should be applied.

Char Transmission Type
0 Override existing state (all state data is cleared and the new data is set)
1 Update existing state (the parameter in the transmission will be applied to the current state)
LineGraph-Data (11..End)

The LineGraph data string has a special syntax to provide the data for the LineGraph view. Simple coordinates for the line can be transmitted as well as configuration paramter. Both can be mixed.

Simple Coordinate Transmission

For simple coordinate transmission a X and Y position value is required, separated with a colon and finalized with a semicolon to separate different points.

     
xPosition:yPosition;;

// line-data with 3 points:
char lData[] = "-30:-20;-5.3:0;27.4:50;";
    
Configuration Parameter Transmission

With the config parameter the LineGraph grid could be defined and the update behaviour is adaptable. The syntax for setting the paramter is the same as setting a point, but the X Coordinate is an accessor for the appropriate config parameter.

accessor Description
xmin X-Axis minimum value (Lower end of the x-axis scope)
xmax X-Axis maximum value (Upper end of the x-axis scope)
ymin Y-Axis minimum value (Lower end of the y-axis scope)
ymax Y-Axis maximum value (Upper end of the y-axis scope)
xisc X-Axis intersection value (determins where grid-lines should be drawn)
yisc Y-Axis intersection value (determins where grid-lines should be drawn)
xsc+ / xsc- X-Axis shift value with direction (+/-)
ysc+ / ysc- Y-Axis shift value with direction (+/-)
padd Add point command (if set, the transmitted points will be added to the existing points in the LineGraph)
     
// example for a LineGraph-data string to configure the grid:
char lData[] = "xmin:-5;xmax:100;ymin:-5;ymax:50;xisc:10;yisc:5;";
// x-axis scope: -5 to 100 with a grid intersection line all 10 points (0, 10, 20, 30,..)
// y-axis scope: -5 to 50 with a grid intersection line all 5 points (0, 5, 10, ..)
    
padd

The mnemonic 'padd' is a special keyword. It has the effect, that the transmitted point(s) are added to the existing points in the LineGraph. This could be used to achieve a live output of measured value from a sensor or something. The keyword is transmitted without a value:

     
padd;

// line-data with 3 points added to the existing points:
char lData[] = "30:52.5;32.5:60;40:62;padd;";
    
Shift the axis grid

Instead of the need of reconfiguring the whole grid when points are added, the grid scope can be shifted in positive or negative direction:

     
// example:
xsc+:1;; // shift the x-axis grid 1 point in positive direction
ysc-:2;; // shift the y-axis grid 2 points in negative direction

// one line-data point added to the existing points and x-axis is shifted:
char lData[] = "105:45;padd;xsc+10;";