Skip to content

ChartGuruElement

ClassChartGuruChartGuru
public class ChartGuruElement : VisualElement, IChartHost

Shallow UI Toolkit adapter on top of the existing ChartGuru.ChartGuruElement.Chart + ChartGuru.ChartRenderer + ChartGuru.ChartProxy engine. Owns the UI Toolkit lifecycle (geometry invalidation, visual content emission, pointer events, animation ticking) and delegates everything else to the shared helpers: ChartGuru.ChartInteractionController, ChartGuru.ChartAuthoringBinder, pooled UI Toolkit labels, and ChartGuru.UITKMeshDrawSink.

V1 rendering strategy: the existing GL pipeline renders into a `UnityEngine.RenderTexture` sized to contentRect.size * scaledPixelsPerPoint, and a single textured quad is emitted through `UnityEngine.UIElements.MeshGenerationContext.Allocate(System.Int32%2cSystem.Int32%2cUnityEngine.Texture)`. Once the `ChartGuru.ChartRenderer` primitive sites have been migrated to emit through [ChartGuru.IChartDrawSink](/tools/chartguru/api/chartguru-ichartdrawsink/), the same element swaps the RT step for native geometry emission via [ChartGuru.UITKMeshDrawSink](/tools/chartguru/api/chartguru-uitkmeshdrawsink/) - no API changes required.

public ChartGuruElement()

public void SetData(IReadOnlyList<float> values)

Replace the chart marks with a single series of values.

Parameters

Name Type
values System.Collections.Generic.IReadOnlyList{System.Single}
public void SetChartData(Chart src)

Swap in a pre-built chart model. Use this for richer multi-series scenarios.

Parameters

Name Type
src ChartGuru.Chart
public void MorphTo(ChartType type, MorphOptions options = null)

Morph to a new chart type with animation, matching ChartGraphic.MorphTo.

Parameters

Name Type
type ChartGuru.ChartType
options ChartGuru.MorphOptions
public void ReplayEntryAnimation(Animation? animation = null)

Replay the configured entry animation without recreating the element.

Parameters

Name Type
animation System.Nullable{ChartGuru.Animation}
public void RebuildChart()

Re-applies the ChartGuru.ChartAuthoringState to the chart/renderer and requests a repaint. Idempotent.

public void SetDirty()

ChartGuru.IChartHost.SetDirty — triggers a full rebuild and repaint.

public ChartAuthoringStyleOptions BuildStyleOptions()

Builds a ChartGuru.ChartAuthoringStyleOptions snapshot from the current ChartGuru.ChartAuthoringState. Used by ChartGuru.IChartGuruElementDataSource implementations so marks are shaped consistently with the element’s authoring.

Returns

ChartGuru.ChartAuthoringStyleOptions

public void ResetViewport()

Restores both axes to their configured visible domains and requests a repaint.

public ChartType ChartType { get; set; }

Returns

ChartGuru.ChartType

public ChartTheme Theme { get; set; }

Returns

ChartGuru.ChartTheme

public bool AnimateOnStart { get; set; }

Returns

System.Boolean

public bool ShowAxisLabels { get; set; }

Returns

System.Boolean

public bool ShowAxisTitles { get; set; }

Returns

System.Boolean

public bool ShowDataLabels { get; set; }

Returns

System.Boolean

public LegendAlignment LegendAlignment { get; set; }

Returns

ChartGuru.LegendAlignment

public MarkStackingMethod StackingMethod { get; set; }

Returns

ChartGuru.MarkStackingMethod

public InterpolationMethod Interpolation { get; set; }

Returns

ChartGuru.InterpolationMethod

public float LineWidth { get; set; }

Returns

System.Single

public float CornerRadius { get; set; }

Returns

System.Single

public float InnerRadius { get; set; }

Returns

System.Single

public AxisScaleType XAxisType { get; set; }

Returns

ChartGuru.AxisScaleType

public TimeUnit XAxisTimeUnit { get; set; }

Returns

ChartGuru.TimeUnit

public string XAxisTimeFormat { get; set; }

Returns

System.String

public AxisScaleType YAxisType { get; set; }

Returns

ChartGuru.AxisScaleType

public TimeUnit YAxisTimeUnit { get; set; }

Returns

ChartGuru.TimeUnit

public string YAxisTimeFormat { get; set; }

Returns

System.String

public ChartDataSourceAsset DataSourceAsset { get; set; }

Asset-typed UXML attribute for project-authored data (Unity 2023.2+). Setting this assigns ChartGuru.ChartGuruElement.DataSource to the asset; reading it returns the previously-assigned asset (or null when an MB or custom source is in use).

Returns

ChartGuru.ChartDataSourceAsset

public IChartGuruElementDataSource DataSource { get; set; }

Active data source. May be a ChartGuru.ChartDataSourceAsset, a ChartGuru.ChartDataSourceBase MonoBehaviour, a ViewModel, or any custom ChartGuru.IChartGuruElementDataSource implementation.

Assigning a new source automatically subscribes to its `ChartGuru.IChartGuruElementDataSource.DataChanged` event and pulls the initial data set into the chart. Set to null to detach.

Returns

ChartGuru.IChartGuruElementDataSource

public IReadOnlyList<float> Data { get; set; }

Live single-series data buffer for runtime / ViewModel binding (Unity 6+ CreateProperty). Setting the property replaces the chart’s current marks with one mark per value, shaped for the current ChartGuru.ChartGuruElement.ChartType. Bypasses ChartGuru.ChartGuruElement.DataSource — assignment makes the element act as its own data feed.

Returns

System.Collections.Generic.IReadOnlyList{System.Single}

public Chart Chart { get; }

Underlying chart instance. Exposed for programmatic data manipulation.

Returns

ChartGuru.Chart

public ChartProxy Proxy { get; }

Underlying proxy for position/domain queries.

Returns

ChartGuru.ChartProxy

public LegendPosition LegendPosition { get; set; }

Returns

ChartGuru.LegendPosition

public string ChartTitle { get; set; }

Returns

System.String

public string ChartSubtitle { get; set; }

Returns

System.String

public ChartTitlePosition ChartTitlePosition { get; set; }

Returns

ChartGuru.ChartTitlePosition

public bool ShowXAxis { get; set; }

Returns

System.Boolean

public bool ShowYAxis { get; set; }

Returns

System.Boolean

public string XAxisLabel { get; set; }

Returns

System.String

public string YAxisLabel { get; set; }

Returns

System.String

public bool ShowXGridLines { get; set; }

Returns

System.Boolean

public bool ShowYGridLines { get; set; }

Returns

System.Boolean

public int XAxisTickCount { get; set; }

Returns

System.Int32

public int YAxisTickCount { get; set; }

Returns

System.Int32

public string XAxisTickFormat { get; set; }

Returns

System.String

public string YAxisTickFormat { get; set; }

Returns

System.String

public bool XAxisAutoDomain { get; set; }

Returns

System.Boolean

public bool YAxisAutoDomain { get; set; }

Returns

System.Boolean

public float XAxisDomainMin { get; set; }

Returns

System.Single

public float XAxisDomainMax { get; set; }

Returns

System.Single

public float YAxisDomainMin { get; set; }

Returns

System.Single

public float YAxisDomainMax { get; set; }

Returns

System.Single

public bool YAxisOnRight { get; set; }

Returns

System.Boolean

public AxisMarkPreset XAxisLabelPreset { get; set; }

Returns

ChartGuru.AxisMarkPreset

public AxisMarkPreset YAxisLabelPreset { get; set; }

Returns

ChartGuru.AxisMarkPreset

public bool ShowSymbols { get; set; }

Returns

System.Boolean

public float SymbolSize { get; set; }

Returns

System.Single

public SymbolShape Symbol { get; set; }

Returns

ChartGuru.SymbolShape

public float Opacity { get; set; }

Returns

System.Single

public bool ShowAreaLine { get; set; }

Returns

System.Boolean

public float AngularInset { get; set; }

Returns

System.Single

public bool AutoContrastText { get; set; }

Returns

System.Boolean

public bool EnableSelection { get; set; }

Returns

System.Boolean

public bool EnableHoverHighlight { get; set; }

Returns

System.Boolean

public bool EnableDragSelection { get; set; }

Returns

System.Boolean

public bool EnableViewportDrag { get; set; }

Returns

System.Boolean

public bool EnableViewportZoom { get; set; }

Returns

System.Boolean

public float ViewportZoomSensitivity { get; set; }

Returns

System.Single

public SelectionIndicatorStyle SelectionIndicatorStyle { get; set; }

Returns

ChartGuru.SelectionIndicatorStyle

public BarLayout BarOrientation { get; set; }

Returns

ChartGuru.BarLayout

public ChartMorphStyle MorphStyle { get; set; }

Returns

ChartGuru.ChartMorphStyle

public Color BackgroundColor { get; set; }

Returns

UnityEngine.Color

public float PlotAreaBorderWidth { get; set; }

Returns

System.Single

public float PlotAreaCornerRadius { get; set; }

Returns

System.Single

public Color PlotAreaBorderColor { get; set; }

Returns

UnityEngine.Color

public float PlotAreaPaddingLeft { get; set; }

Returns

System.Single

public float PlotAreaPaddingRight { get; set; }

Returns

System.Single

public float PlotAreaPaddingTop { get; set; }

Returns

System.Single

public float PlotAreaPaddingBottom { get; set; }

Returns

System.Single

public float ChartBorderWidth { get; set; }

Returns

System.Single

public float ChartBorderCornerRadius { get; set; }

Returns

System.Single

public Color ChartBorderColor { get; set; }

Returns

UnityEngine.Color

public bool UseForegroundGradient { get; set; }

Returns

System.Boolean

public Gradient ForegroundGradient { get; set; }

Returns

UnityEngine.Gradient

public UnitPoint ForegroundGradientStartPoint { get; set; }

Returns

ChartGuru.UnitPoint

public UnitPoint ForegroundGradientEndPoint { get; set; }

Returns

ChartGuru.UnitPoint

public string DataLabelFormat { get; set; }

Returns

System.String

public PieLabelMode PieLabelMode { get; set; }

Returns

ChartGuru.PieLabelMode

public bool OverrideDataLabelColor { get; set; }

Returns

System.Boolean

public Color DataLabelColor { get; set; }

Returns

UnityEngine.Color

public bool OverrideAxisLabelColor { get; set; }

Returns

System.Boolean

public Color AxisLabelColor { get; set; }

Returns

UnityEngine.Color

public bool XAxisIncludeZeroInDomain { get; set; }

Returns

System.Boolean

public bool YAxisIncludeZeroInDomain { get; set; }

Returns

System.Boolean

public int HeatMapColorScalePreset { get; set; }

Returns

System.Int32

public RadarRingStyle RadarRingStyle { get; set; }

Returns

ChartGuru.RadarRingStyle

public float AnimationDuration { get; set; }

Returns

System.Single

public Easing AnimationEasing { get; set; }

Returns

ChartGuru.Easing

public ScrollableAxes ScrollableAxes { get; set; }

Returns

ChartGuru.ScrollableAxes

public float XVisibleDomainLength { get; set; }

Returns

System.Single

public float YVisibleDomainLength { get; set; }

Returns

System.Single

public int SelectedIndex { get; }

Returns

System.Int32

public int HoveredIndex { get; }

Returns

System.Int32

public event Action<int, DataPoint> DataPointClicked

Raised when the user selects a mark.

Returns

System.Action{System.Int32,ChartGuru.DataPoint}

public event Action<int, DataPoint> DataPointHovered

Raised when the user hovers a mark.

Returns

System.Action{System.Int32,ChartGuru.DataPoint}

public event Action<int> OnSelectionChanged

Raised with the selected mark index after pointer or programmatic selection changes.

Returns

System.Action{System.Int32}

public event Action<int> OnHoverChanged

Raised with the hovered mark index, or -1 after the pointer leaves all marks.

Returns

System.Action{System.Int32}

public event Action<ChartType> OnMorphComplete

Raised with the new chart type after an animated morph reaches its target.

Returns

System.Action{ChartGuru.ChartType}