StateConfiguration

āš ļø This type is unstable and may change significantly in a way that the data won't be backwards compatible. Define the style and mapping for state values in a state timeline view.

This archetype provides configuration for how state values are displayed. It maps raw state values to display labels, colors, and visibility.

values, labels, colors, and visible are parallel arrays: the entry at index i of each describes the same state value, and only the per-index pairing is meaningful. The four arrays should have matching length; any secondary array (labels, colors, visible) that is shorter than values falls back to defaults for the missing entries.

It's generally recommended to log this type as static.

The underlying data needs to be logged to the same entity path using archetypes.StateChange.

Fields fields

Optional optional

Can be shown in can-be-shown-in

Example example

State changes with a custom style state-changes-with-a-custom-style

# Log a `StateChange` together with a `StateConfiguration` that customizes its display.

import rerun as rr

rr.init("rerun_example_state_configuration", spawn=True)

# Configure how each raw state value is displayed (label, color, visibility).
rr.log(
    "door",
    rr.StateConfiguration(
        values=["open", "closed"],
        labels=["Open", "Closed"],
        colors=[0x4CAF50FF, 0xEF5350FF],
    ),
    static=True,
)

rr.set_time("step", sequence=0)
rr.log("door", rr.StateChange(state="open"))

rr.set_time("step", sequence=1)
rr.log("door", rr.StateChange(state="closed"))

rr.set_time("step", sequence=2)
rr.log("door", rr.StateChange(state="open"))