Repository navigation
User JSON SlopeTextIndicator
Back to list | Indicator page | Русский
This page describes the JSON template of the slopeText indicator for editing .vttp files by hand. The template string in the full template is given for the English locale.
{
"name": "com.velitask.plagin.official.slopeText",
"data": {
"maket": { "preset": "auto" },
"properties": {
"Slope": {},
"font": {
"name": "Dialog",
"style": 0,
"size": 48,
"color": { "r": 255, "g": 255, "b": 255, "a": 255 }
},
"textAlign": { "value": 4 },
"measurement": {
"system": { "value": 0 },
"format": { "value": 0 },
"distance": { "value": "MM" },
"altitude": { "value": 0 }
},
"textTemplate": {
"template": "{type} {pc}% ({curr}{currUnit} / {length}{lengthUnit})",
"vars": {
"type": "%s",
"typec": "%s",
"pc": "%.1f",
"curr": "%.3f",
"currUnit": "%s",
"length": "%.2f",
"lengthUnit": "%s",
"height": "%.0f",
"heightUnit": "%s",
"ele": "%.0f",
"eleUnit": "%s",
"eleCurr": "%.1f",
"up": "%.0f",
"down": "%.0f"
}
}
}
}
}Selects the slope sensor ("Slope"). Leave it empty in a template: the sensor is picked automatically when the indicator is added to a project.
{
"Slope": {}
}| Field | Values | What it does |
|---|---|---|
sourceId |
{"value": source id} |
In a real project it selects the data source. Absent in a template. |
sensorId |
{"value": sensor id} |
In a real project it selects the specific sensor. Absent in a template. |
The font and color of the text ("Font").
{
"font": {
"name": "Dialog",
"style": 0,
"size": 48,
"color": { "r": 255, "g": 255, "b": 255, "a": 255 }
}
}| Field | Values | What it does |
|---|---|---|
name |
string, font name | Font name ("Font Name"); Dialog by default. |
style |
0, 1, 2
|
Font style ("Font Style"). |
size |
integer 1..999
|
Font size ("Font Size"); 48 by default. |
color |
r, g, b, a
|
Text color ("Color"); white by default. |
Values of style:
| Value | Style |
|---|---|
0 |
Plain |
1 |
Bold |
2 |
Italic |
Text color:
| Field | Values | What it does |
|---|---|---|
r |
0..255 |
Red channel. |
g |
0..255 |
Green channel. |
b |
0..255 |
Blue channel. |
a |
0..255 |
Opacity: 0 is fully transparent, 255 is opaque. |
The position of the text inside the layer ("Text Alignment"). The default is 4 - centered.
{
"textAlign": { "value": 4 }
}| Field | Values | What it does |
|---|---|---|
value |
integer 0..8
|
Number of the position from the table below. |
| Value | Position |
|---|---|
0 |
Top left |
1 |
Top center |
2 |
Top right |
3 |
Center left |
4 |
Center |
5 |
Center right |
6 |
Bottom left |
7 |
Bottom center |
8 |
Bottom right |
The units of distance and elevation ("Units").
{
"measurement": {
"system": { "value": 0 },
"format": { "value": 0 },
"distance": { "value": "MM" },
"altitude": { "value": 0 }
}
}| Field | Values | What it does |
|---|---|---|
system.value |
0..4
|
The measurement system. |
format.value |
0..3
|
The format of the unit label. In the template the default is 0 - full. |
distance.value |
string: MM, CM, M, KM, IN, FT, YD, MI, NM
|
The distance unit. Used when system.value is not 0. |
altitude.value |
0, 1
|
The elevation unit. Used when system.value is not 0. |
Values of system.value:
| Value | System |
|---|---|
0 |
From global settings |
1 |
Metric |
2 |
Imperial |
3 |
Nautical |
4 |
Mixed |
Values of format.value:
| Value | Format |
|---|---|
0 |
Full (kilometers) |
1 |
Normal (km) |
2 |
Short |
3 |
Symbol |
Allowed distance.value by system: metric - KM, M, CM, MM; imperial - MI, YD, FT, IN; nautical - NM, YD, FT; mixed - any of the nine. Values of altitude.value: 0 - meters, 1 - feet.
With system.value = 0, the distance units are picked automatically, and the elevation unit comes from the global settings.
The text and the variable formats ("Text Template"). It assembles the data of the current slope section.
{
"textTemplate": {
"template": "{type} {pc}% ({curr}{currUnit} / {length}{lengthUnit})",
"vars": {
"type": "%s",
"typec": "%s",
"pc": "%.1f",
"curr": "%.3f",
"currUnit": "%s",
"length": "%.2f",
"lengthUnit": "%s",
"height": "%.0f",
"heightUnit": "%s",
"ele": "%.0f",
"eleUnit": "%s",
"eleCurr": "%.1f",
"up": "%.0f",
"down": "%.0f"
}
}
}| Field | Values | What it does |
|---|---|---|
template |
string | The resulting text with variables in curly braces. |
vars |
object | The format of each variable (printf style). |
Skins change only template; the vars formats stay at their defaults:
| Skin | template |
|---|---|
| Short | {typec} {pc}% |
| Detailed | {type} {pc}% ele:{ele}{eleUnit} up:{up}{eleUnit} down:{down}{eleUnit} |
| Variable | Default format | What it shows |
|---|---|---|
{type} |
%s |
The section type as a word: "Uphill", "Downhill", "Flat". |
{typec} |
%s |
The section type as a symbol: ↑, ↓, or an empty string for flat ground. |
{pc} |
%.1f |
The slope percentage of the section; negative on a descent. |
{curr} |
%.3f |
The distance from the start of the section to the current point in the selected units. |
{currUnit} |
%s |
The unit label for {curr}. |
{length} |
%.2f |
The full length of the section in the selected units. |
{lengthUnit} |
%s |
The unit label for {length}. |
{height} |
%.0f |
The elevation difference over the whole section; negative on a descent. |
{heightUnit} |
%s |
The unit label for {height}. |
{ele} |
%.0f |
The elevation at the current point. |
{eleUnit} |
%s |
The elevation unit label (meters or feet). |
{eleCurr} |
%.1f |
The elevation change from the start of the section to the current point, unsigned. |
{up} |
%.0f |
The accumulated climb up to the current point. |
{down} |
%.0f |
The accumulated descent up to the current point, without the minus sign. |