Repository navigation
User JSON GearsTextIndicator
Back to list | Indicator page | Русский
This page describes the JSON template of the gearsText indicator for manual editing of .vttp: which fields exist and which values are allowed.
{
"name": "com.velitask.plagin.official.gearsText",
"data": {
"maket": { "preset": "auto" },
"properties": {
"Gears": {},
"font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
"textAlign": {"value":4},
"textTemplate": {"template":"{frontTeeth}x{rearTeeth}","vars":{"front":"%d","rear":"%d","frontTeeth":"%d","rearTeeth":"%d","ratio":"%.2f"}}
}
}
}Chooses the sensor the value is taken from.
{
"Gears": {}
}| Field | Values | What it does |
|---|---|---|
sourceId |
{"value": number} |
The source identifier in the project. Absent in a template. |
sensorId |
{"value": number} |
The sensor identifier in the source. Absent in a template. |
In a template, leave an empty object {}: the source and sensor will be picked when the indicator is added to a project.
Changes the font, style, size and color of the text.
{
"font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}}
}| Field | Values | What it does |
|---|---|---|
name |
string, the font name; Dialog by default |
The font family. |
style |
0, 1, 2
|
Style: 0 plain, 1 bold, 2 italic. |
size |
integer 1..999; 48 by default |
The font size; it is recalculated proportionally when the layer is scaled. |
color |
object r, g, b, a
|
The text color, see below. |
| Field | Values | What it does |
|---|---|---|
r |
0..255 |
Red channel. |
g |
0..255 |
Green channel. |
b |
0..255 |
Blue channel. |
a |
0..255 |
Transparency: 0 is fully transparent, 255 is opaque. |
Chooses the position of the text inside the layer.
{
"textAlign": {"value":4}
}| Field | Values | What it does |
|---|---|---|
value |
integer 0..8; 4 by default |
The number of the text position. |
value |
Text position |
|---|---|
0 |
top left |
1 |
top center |
2 |
top right |
3 |
vertically centered, left |
4 |
centered (default) |
5 |
vertically centered, right |
6 |
bottom left |
7 |
bottom center |
8 |
bottom right |
A value outside the range 0..8 is treated as 3 (vertically centered, left).
Sets the text with the indicator values.
{
"textTemplate": {"template":"{frontTeeth}x{rearTeeth}","vars":{"front":"%d","rear":"%d","frontTeeth":"%d","rearTeeth":"%d","ratio":"%.2f"}}
}| Field | Values | What it does |
|---|---|---|
template |
string | The resulting text with variables in curly braces. |
vars |
object | The variable formats: the key is the variable name without braces, the value is the format. |
| Variable | Default format | What it shows |
|---|---|---|
{front} |
%d |
The front sprocket (gear) number, as reported by the device. |
{rear} |
%d |
The rear sprocket (gear) number, as reported by the device. |
{frontTeeth} |
%d |
The number of teeth on the front sprocket. |
{rearTeeth} |
%d |
The number of teeth on the rear sprocket. |
{ratio} |
%.2f |
The gear ratio: the front sprocket teeth divided by the rear sprocket teeth (0 if there are no rear teeth). |
For {front}, {rear}, {frontTeeth} and {rearTeeth} the format is applied to an integer (%d, %02d and the like), for {ratio} to a fractional number (%.2f, %.1f and the like). An unsuitable format gives an empty string instead of the variable.
The "Compact" skin replaces template with {front}-{rear}; the vars fields stay the same.