DashboardItemTimeVaryingText
Inherits DashboardItem
This DashboardItem displays text based on the content of a provided data file. The value that is displayed depends on the current in-game simulation time.
The JSON must contain a ‘data’ array with timestamp-value pairs. Example format: { "data": [["2024-05-10T00:00:00Z", 2.33], ["2024-05-10T03:00:00Z", 3.0]] }.
Members
Name |
Documentation |
Type |
Description |
Optional |
|---|---|---|---|---|
|
The file path to the JSON data. |
|
Value of type ‘File’ |
No |
|
The unique identifier for this DashboardItem. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
No |
|
Determines the type of the DashbordItem that should be created. |
|
Must name a valid DashboardItem type |
No |
|
If this value is set to ‘true’ this dashboard item is shown in the dashboard. Otherwise it will be hidden. |
|
Value of type ‘Boolean’ |
Yes |
|
This value is the name of the font that is used. It can either refer to an internal name registered previously, or it can refer to a path that is used. |
|
Value of type ‘String’ |
Yes |
|
This value determines the size of the font that is used to render the distance. |
|
Value of type ‘Double’ |
Yes |
|
The format text describing how this dashboard item renders its text. This text must contain exactly one {} which is a placeholder that will be replaced with the values read from the file provided in |
|
Value of type ‘String’ |
Yes |
|
The name for the DashboardItem that is used when showing it in the user interface. |
|
Value of type ‘String’ |
Yes |
Inherited members from DashboardItem
Name |
Documentation |
Type |
Description |
Optional |
|---|---|---|---|---|
|
The unique identifier for this DashboardItem. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
No |
|
Determines the type of the DashbordItem that should be created. |
|
Must name a valid DashboardItem type |
No |
|
If this value is set to ‘true’ this dashboard item is shown in the dashboard. Otherwise it will be hidden. |
|
Value of type ‘Boolean’ |
Yes |
|
The name for the DashboardItem that is used when showing it in the user interface. |
|
Value of type ‘String’ |
Yes |
Asset Examples
Styled
This example shows how to create a time-varying text dashboard item. It has a custom font size and text before the time varying text.
1local Item = {
2 Type = "DashboardItemTimeVaryingText",
3 Identifier = "DashboardItemTimeVaryingText_Example_Styled",
4 DataFile = asset.resource("data/dummydata.json"),
5 FormatString = "Observed KP index: {}",
6 FontSize = 40
7}
8
9
10asset.onInitialize(function()
11 openspace.dashboard.addDashboardItem(Item)
12end)
13
14asset.onDeinitialize(function()
15 openspace.dashboard.removeDashboardItem(Item)
16end)
Basic
This example shows how to create a time-varying text dashboard item.
1local Item = {
2 Type = "DashboardItemTimeVaryingText",
3 Identifier = "DashboardItemTimeVaryingText_Example",
4 DataFile = asset.resource("data/dummydata.json"),
5}
6
7
8asset.onInitialize(function()
9 openspace.dashboard.addDashboardItem(Item)
10end)
11
12asset.onDeinitialize(function()
13 openspace.dashboard.removeDashboardItem(Item)
14end)
Mixed
This example shows how to create a time-varying text dashboard item that is using a
mixed type of data entries in the DataFile.
1local Item = {
2 Type = "DashboardItemTimeVaryingText",
3 Identifier = "DashboardItemTimeVaryingText_Example_Mixed",
4 DataFile = asset.resource("data/dummydata_mixed.json"),
5}
6
7
8asset.onInitialize(function()
9 openspace.dashboard.addDashboardItem(Item)
10end)
11
12asset.onDeinitialize(function()
13 openspace.dashboard.removeDashboardItem(Item)
14end)