Skip to content

UIToolkitChartBinder

ClassChartGuruChartGuru
[AddComponentMenu("ChartGuru/UI Toolkit Chart Binder")]
[DisallowMultipleComponent]
[ExecuteAlways]
public class UIToolkitChartBinder : MonoBehaviour

Bridges a scene-authored data source to a named ChartGuru.ChartGuruElement inside a UnityEngine.UIElements.UIDocument. Drop this component on a GameObject alongside a ChartGuru.ChartDataSourceBase (or any other ChartGuru.IChartGuruElementDataSource), assign the document, the element name to look up, and the source. The binder resolves the element on enable and pushes the source into element.DataSource.

This is purely a wiring helper. Once bound, the element pulls data from the source via `ChartGuru.IChartGuruElementDataSource.PopulateChart(ChartGuru.Chart%2cChartGuru.ChartType%2cChartGuru.ChartAuthoringStyleOptions)` and re-pulls automatically when the source raises `ChartGuru.IChartGuruElementDataSource.DataChanged`.

public void Bind()

Resolve the target element and push the data source into it. Safe to call multiple times; clears any previous binding first.

public UIToolkitChartBinder()

public ChartGuruElement BoundElement { get; }

The bound element (null when unresolved).

Returns

ChartGuru.ChartGuruElement

public Object DataSourceObject { get; set; }

The configured source. Setting at runtime re-binds.

Returns

UnityEngine.Object