# State graph

> Visualize state-based timelines using a linked dataclip.

The State graph control visualizes state-based timelines, using a linked dataclip as its data source. It renders horizontally stacked state segments across a time-based X axis; the Y axis represents distinct items, each holding a sequence of non-overlapping state segments. It's suited to lifecycle transitions, operational states, and other time-bound progressions: for example machine states (Running, Idle, Error), order lifecycle progression, or SLA tracking.

Each row in the linked dataclip represents a single state interval, with columns for the Y-axis item, the state's start and end time, its label, and its color. Multiple rows per item are expected, forming one horizontal line of sequential segments: segments for the same item must not overlap, since each timespan represents exactly one state.

## Required mappings

| Mapping | Description |
| --- | --- |
| YItems | The items shown on the Y axis: each distinct value becomes a separate horizontal line. |
| StateStart | The start datetime of the state segment. |
| StateEnd | The end datetime of the state segment; together with StateStart, determines its duration. |
| StateLabel | The text shown within the segment. |
| StateColor | The segment's color. |

All five mappings are required: missing one prevents the graph from rendering. `StateStart` must be earlier than `StateEnd`, and segments for the same item must not overlap; if they do, rendering is undefined.

## Interaction

Hovering a segment shows a tooltip with its item, label, start, and end. Users can zoom into a specific time range on the X axis to inspect shorter intervals: zooming only affects the visible window, not the underlying dataset.

## Events

| Event | Description |
| --- | --- |
| On update | Triggered on the initial load, when a linked value changes and the dataclip refreshes, or when the underlying dataset is re-evaluated. |

## Tips

- Pre-sort data by item and start time for consistent rendering.
- Validate there are no overlapping intervals per item before binding the data.
- Use consistent colors for the same state across different items.
- Keep the number of items limited, to keep the graph readable.

## Troubleshooting

| Issue | Cause | Solution |
| --- | --- | --- |
| Segments overlap visually | Overlapping start/end values for the same item | Fix the dataset so intervals don't overlap per item. |
| Graph not rendering | A required mapping is missing | Verify all five required mappings are configured. |
| Incorrect durations | Invalid datetime format | Check the dataclip's field types. |
| Graph not refreshing | A linked value isn't triggering an update | Check the data binding and event configuration. |