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

DataFile

The file path to the JSON data.

File

Value of type ‘File’

No

FontName

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.

String

Value of type ‘String’

Yes

FontSize

This value determines the size of the font that is used to render the distance.

Double

Value of type ‘Double’

Yes

FormatString

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 DataFile

String

Value of type ‘String’

Yes

Inherited members from DashboardItem

Name

Documentation

Type

Description

Optional

Identifier

The unique identifier for this DashboardItem.

Identifier

An identifier string. May not contain ‘.’, spaces, newlines, or tabs

No

Type

Determines the type of the DashbordItem that should be created.

String

Value of type ‘String’

No

Enabled

If this value is set to ‘true’ this dashboard item is shown in the dashboard. Otherwise it will be hidden.

Boolean

Value of type ‘Boolean’

Yes

GuiName

The name for the DashboardItem that is used when showing it in the user interface.

String

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
 9asset.onInitialize(function()
10  openspace.dashboard.addDashboardItem(Item)
11end)
12
13asset.onDeinitialize(function()
14  openspace.dashboard.removeDashboardItem(Item)
15end)
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
 7asset.onInitialize(function()
 8  openspace.dashboard.addDashboardItem(Item)
 9end)
10
11asset.onDeinitialize(function()
12  openspace.dashboard.removeDashboardItem(Item)
13end)
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
 7asset.onInitialize(function()
 8  openspace.dashboard.addDashboardItem(Item)
 9end)
10
11asset.onDeinitialize(function()
12  openspace.dashboard.removeDashboardItem(Item)
13end)