ChartGuruElement
[UxmlElement]public class ChartGuruElement : VisualElement, IChartHostShallow 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.
Constructors
Section titled “Constructors”
ChartGuruElement()
Section titled “ChartGuruElement()”public ChartGuruElement()Methods
Section titled “Methods”
SetData(IReadOnlyList)
Section titled “SetData(IReadOnlyList)”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} |
SetChartData(Chart)
Section titled “SetChartData(Chart)”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 |
MorphTo(ChartType, MorphOptions)
Section titled “MorphTo(ChartType, MorphOptions)”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 |
ReplayEntryAnimation(Animation?)
Section titled “ReplayEntryAnimation(Animation?)”public void ReplayEntryAnimation(Animation? animation = null)Replay the configured entry animation without recreating the element.
Parameters
| Name | Type |
|---|---|
animation |
System.Nullable{ChartGuru.Animation} |
RebuildChart()
Section titled “RebuildChart()”public void RebuildChart()Re-applies the ChartGuru.ChartAuthoringState to the chart/renderer and
requests a repaint. Idempotent.
SetDirty()
Section titled “SetDirty()”public void SetDirty()ChartGuru.IChartHost.SetDirty — triggers a full rebuild and repaint.
BuildStyleOptions()
Section titled “BuildStyleOptions()”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
ResetViewport()
Section titled “ResetViewport()”public void ResetViewport()Restores both axes to their configured visible domains and requests a repaint.
Properties
Section titled “Properties”
ChartType
Section titled “ChartType”[UxmlAttribute("chart-type")][CreateProperty]public ChartType ChartType { get; set; }Returns
ChartGuru.ChartType
[CreateProperty]public ChartTheme Theme { get; set; }Returns
ChartGuru.ChartTheme
AnimateOnStart
Section titled “AnimateOnStart”[UxmlAttribute("animate-on-start")][CreateProperty]public bool AnimateOnStart { get; set; }Returns
System.Boolean
ShowAxisLabels
Section titled “ShowAxisLabels”[UxmlAttribute("show-axis-labels")][CreateProperty]public bool ShowAxisLabels { get; set; }Returns
System.Boolean
ShowAxisTitles
Section titled “ShowAxisTitles”[UxmlAttribute("show-axis-titles")][CreateProperty]public bool ShowAxisTitles { get; set; }Returns
System.Boolean
ShowDataLabels
Section titled “ShowDataLabels”[UxmlAttribute("show-data-labels")][CreateProperty]public bool ShowDataLabels { get; set; }Returns
System.Boolean
LegendAlignment
Section titled “LegendAlignment”[UxmlAttribute("legend-alignment")][CreateProperty]public LegendAlignment LegendAlignment { get; set; }Returns
ChartGuru.LegendAlignment
StackingMethod
Section titled “StackingMethod”[UxmlAttribute("stacking-method")][CreateProperty]public MarkStackingMethod StackingMethod { get; set; }Returns
ChartGuru.MarkStackingMethod
Interpolation
Section titled “Interpolation”[UxmlAttribute("interpolation")][CreateProperty]public InterpolationMethod Interpolation { get; set; }Returns
ChartGuru.InterpolationMethod
LineWidth
Section titled “LineWidth”[UxmlAttribute("line-width")][CreateProperty]public float LineWidth { get; set; }Returns
System.Single
CornerRadius
Section titled “CornerRadius”[UxmlAttribute("corner-radius")][CreateProperty]public float CornerRadius { get; set; }Returns
System.Single
InnerRadius
Section titled “InnerRadius”[UxmlAttribute("inner-radius")][CreateProperty]public float InnerRadius { get; set; }Returns
System.Single
XAxisType
Section titled “XAxisType”[UxmlAttribute("x-axis-type")][CreateProperty]public AxisScaleType XAxisType { get; set; }Returns
ChartGuru.AxisScaleType
XAxisTimeUnit
Section titled “XAxisTimeUnit”[UxmlAttribute("x-axis-time-unit")][CreateProperty]public TimeUnit XAxisTimeUnit { get; set; }Returns
ChartGuru.TimeUnit
XAxisTimeFormat
Section titled “XAxisTimeFormat”[UxmlAttribute("x-axis-time-format")][CreateProperty]public string XAxisTimeFormat { get; set; }Returns
System.String
YAxisType
Section titled “YAxisType”[UxmlAttribute("y-axis-type")][CreateProperty]public AxisScaleType YAxisType { get; set; }Returns
ChartGuru.AxisScaleType
YAxisTimeUnit
Section titled “YAxisTimeUnit”[UxmlAttribute("y-axis-time-unit")][CreateProperty]public TimeUnit YAxisTimeUnit { get; set; }Returns
ChartGuru.TimeUnit
YAxisTimeFormat
Section titled “YAxisTimeFormat”[UxmlAttribute("y-axis-time-format")][CreateProperty]public string YAxisTimeFormat { get; set; }Returns
System.String
DataSourceAsset
Section titled “DataSourceAsset”[UxmlAttribute("data-source")][CreateProperty]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
DataSource
Section titled “DataSource”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
[CreateProperty]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
LegendPosition
Section titled “LegendPosition”[UxmlAttribute("legend-position")][CreateProperty]public LegendPosition LegendPosition { get; set; }Returns
ChartGuru.LegendPosition
ChartTitle
Section titled “ChartTitle”[UxmlAttribute("chart-title")][CreateProperty]public string ChartTitle { get; set; }Returns
System.String
ChartSubtitle
Section titled “ChartSubtitle”[UxmlAttribute("chart-subtitle")][CreateProperty]public string ChartSubtitle { get; set; }Returns
System.String
ChartTitlePosition
Section titled “ChartTitlePosition”[UxmlAttribute("chart-title-position")][CreateProperty]public ChartTitlePosition ChartTitlePosition { get; set; }Returns
ChartGuru.ChartTitlePosition
ShowXAxis
Section titled “ShowXAxis”[UxmlAttribute("show-x-axis")][CreateProperty]public bool ShowXAxis { get; set; }Returns
System.Boolean
ShowYAxis
Section titled “ShowYAxis”[UxmlAttribute("show-y-axis")][CreateProperty]public bool ShowYAxis { get; set; }Returns
System.Boolean
XAxisLabel
Section titled “XAxisLabel”[UxmlAttribute("x-axis-label")][CreateProperty]public string XAxisLabel { get; set; }Returns
System.String
YAxisLabel
Section titled “YAxisLabel”[UxmlAttribute("y-axis-label")][CreateProperty]public string YAxisLabel { get; set; }Returns
System.String
ShowXGridLines
Section titled “ShowXGridLines”[UxmlAttribute("show-x-grid-lines")][CreateProperty]public bool ShowXGridLines { get; set; }Returns
System.Boolean
ShowYGridLines
Section titled “ShowYGridLines”[UxmlAttribute("show-y-grid-lines")][CreateProperty]public bool ShowYGridLines { get; set; }Returns
System.Boolean
XAxisTickCount
Section titled “XAxisTickCount”[UxmlAttribute("x-axis-tick-count")][CreateProperty]public int XAxisTickCount { get; set; }Returns
System.Int32
YAxisTickCount
Section titled “YAxisTickCount”[UxmlAttribute("y-axis-tick-count")][CreateProperty]public int YAxisTickCount { get; set; }Returns
System.Int32
XAxisTickFormat
Section titled “XAxisTickFormat”[UxmlAttribute("x-axis-tick-format")][CreateProperty]public string XAxisTickFormat { get; set; }Returns
System.String
YAxisTickFormat
Section titled “YAxisTickFormat”[UxmlAttribute("y-axis-tick-format")][CreateProperty]public string YAxisTickFormat { get; set; }Returns
System.String
XAxisAutoDomain
Section titled “XAxisAutoDomain”[UxmlAttribute("x-axis-auto-domain")][CreateProperty]public bool XAxisAutoDomain { get; set; }Returns
System.Boolean
YAxisAutoDomain
Section titled “YAxisAutoDomain”[UxmlAttribute("y-axis-auto-domain")][CreateProperty]public bool YAxisAutoDomain { get; set; }Returns
System.Boolean
XAxisDomainMin
Section titled “XAxisDomainMin”[UxmlAttribute("x-axis-domain-min")][CreateProperty]public float XAxisDomainMin { get; set; }Returns
System.Single
XAxisDomainMax
Section titled “XAxisDomainMax”[UxmlAttribute("x-axis-domain-max")][CreateProperty]public float XAxisDomainMax { get; set; }Returns
System.Single
YAxisDomainMin
Section titled “YAxisDomainMin”[UxmlAttribute("y-axis-domain-min")][CreateProperty]public float YAxisDomainMin { get; set; }Returns
System.Single
YAxisDomainMax
Section titled “YAxisDomainMax”[UxmlAttribute("y-axis-domain-max")][CreateProperty]public float YAxisDomainMax { get; set; }Returns
System.Single
YAxisOnRight
Section titled “YAxisOnRight”[UxmlAttribute("y-axis-on-right")][CreateProperty]public bool YAxisOnRight { get; set; }Returns
System.Boolean
XAxisLabelPreset
Section titled “XAxisLabelPreset”[UxmlAttribute("x-axis-label-preset")][CreateProperty]public AxisMarkPreset XAxisLabelPreset { get; set; }Returns
ChartGuru.AxisMarkPreset
YAxisLabelPreset
Section titled “YAxisLabelPreset”[UxmlAttribute("y-axis-label-preset")][CreateProperty]public AxisMarkPreset YAxisLabelPreset { get; set; }Returns
ChartGuru.AxisMarkPreset
ShowSymbols
Section titled “ShowSymbols”[UxmlAttribute("show-symbols")][CreateProperty]public bool ShowSymbols { get; set; }Returns
System.Boolean
SymbolSize
Section titled “SymbolSize”[UxmlAttribute("symbol-size")][CreateProperty]public float SymbolSize { get; set; }Returns
System.Single
Symbol
Section titled “Symbol”[UxmlAttribute("symbol")][CreateProperty]public SymbolShape Symbol { get; set; }Returns
ChartGuru.SymbolShape
Opacity
Section titled “Opacity”[UxmlAttribute("opacity")][CreateProperty]public float Opacity { get; set; }Returns
System.Single
ShowAreaLine
Section titled “ShowAreaLine”[UxmlAttribute("show-area-line")][CreateProperty]public bool ShowAreaLine { get; set; }Returns
System.Boolean
AngularInset
Section titled “AngularInset”[UxmlAttribute("angular-inset")][CreateProperty]public float AngularInset { get; set; }Returns
System.Single
AutoContrastText
Section titled “AutoContrastText”[UxmlAttribute("auto-contrast-text")][CreateProperty]public bool AutoContrastText { get; set; }Returns
System.Boolean
EnableSelection
Section titled “EnableSelection”[UxmlAttribute("enable-selection")][CreateProperty]public bool EnableSelection { get; set; }Returns
System.Boolean
EnableHoverHighlight
Section titled “EnableHoverHighlight”[UxmlAttribute("enable-hover-highlight")][CreateProperty]public bool EnableHoverHighlight { get; set; }Returns
System.Boolean
EnableDragSelection
Section titled “EnableDragSelection”[UxmlAttribute("enable-drag-selection")][CreateProperty]public bool EnableDragSelection { get; set; }Returns
System.Boolean
EnableViewportDrag
Section titled “EnableViewportDrag”[UxmlAttribute("enable-viewport-drag")][CreateProperty]public bool EnableViewportDrag { get; set; }Returns
System.Boolean
EnableViewportZoom
Section titled “EnableViewportZoom”[UxmlAttribute("enable-viewport-zoom")][CreateProperty]public bool EnableViewportZoom { get; set; }Returns
System.Boolean
ViewportZoomSensitivity
Section titled “ViewportZoomSensitivity”[UxmlAttribute("viewport-zoom-sensitivity")][CreateProperty]public float ViewportZoomSensitivity { get; set; }Returns
System.Single
SelectionIndicatorStyle
Section titled “SelectionIndicatorStyle”[UxmlAttribute("selection-indicator-style")][CreateProperty]public SelectionIndicatorStyle SelectionIndicatorStyle { get; set; }Returns
ChartGuru.SelectionIndicatorStyle
BarOrientation
Section titled “BarOrientation”[UxmlAttribute("bar-orientation")][CreateProperty]public BarLayout BarOrientation { get; set; }Returns
ChartGuru.BarLayout
MorphStyle
Section titled “MorphStyle”[UxmlAttribute("morph-style")][CreateProperty]public ChartMorphStyle MorphStyle { get; set; }Returns
ChartGuru.ChartMorphStyle
BackgroundColor
Section titled “BackgroundColor”[CreateProperty]public Color BackgroundColor { get; set; }Returns
UnityEngine.Color
PlotAreaBorderWidth
Section titled “PlotAreaBorderWidth”[UxmlAttribute("plot-area-border-width")][CreateProperty]public float PlotAreaBorderWidth { get; set; }Returns
System.Single
PlotAreaCornerRadius
Section titled “PlotAreaCornerRadius”[UxmlAttribute("plot-area-corner-radius")][CreateProperty]public float PlotAreaCornerRadius { get; set; }Returns
System.Single
PlotAreaBorderColor
Section titled “PlotAreaBorderColor”[CreateProperty]public Color PlotAreaBorderColor { get; set; }Returns
UnityEngine.Color
PlotAreaPaddingLeft
Section titled “PlotAreaPaddingLeft”[UxmlAttribute("plot-area-padding-left")][CreateProperty]public float PlotAreaPaddingLeft { get; set; }Returns
System.Single
PlotAreaPaddingRight
Section titled “PlotAreaPaddingRight”[UxmlAttribute("plot-area-padding-right")][CreateProperty]public float PlotAreaPaddingRight { get; set; }Returns
System.Single
PlotAreaPaddingTop
Section titled “PlotAreaPaddingTop”[UxmlAttribute("plot-area-padding-top")][CreateProperty]public float PlotAreaPaddingTop { get; set; }Returns
System.Single
PlotAreaPaddingBottom
Section titled “PlotAreaPaddingBottom”[UxmlAttribute("plot-area-padding-bottom")][CreateProperty]public float PlotAreaPaddingBottom { get; set; }Returns
System.Single
ChartBorderWidth
Section titled “ChartBorderWidth”[UxmlAttribute("chart-border-width")][CreateProperty]public float ChartBorderWidth { get; set; }Returns
System.Single
ChartBorderCornerRadius
Section titled “ChartBorderCornerRadius”[UxmlAttribute("chart-border-corner-radius")][CreateProperty]public float ChartBorderCornerRadius { get; set; }Returns
System.Single
ChartBorderColor
Section titled “ChartBorderColor”[CreateProperty]public Color ChartBorderColor { get; set; }Returns
UnityEngine.Color
UseForegroundGradient
Section titled “UseForegroundGradient”[CreateProperty]public bool UseForegroundGradient { get; set; }Returns
System.Boolean
ForegroundGradient
Section titled “ForegroundGradient”[CreateProperty]public Gradient ForegroundGradient { get; set; }Returns
UnityEngine.Gradient
ForegroundGradientStartPoint
Section titled “ForegroundGradientStartPoint”[CreateProperty]public UnitPoint ForegroundGradientStartPoint { get; set; }Returns
ChartGuru.UnitPoint
ForegroundGradientEndPoint
Section titled “ForegroundGradientEndPoint”[CreateProperty]public UnitPoint ForegroundGradientEndPoint { get; set; }Returns
ChartGuru.UnitPoint
DataLabelFormat
Section titled “DataLabelFormat”[UxmlAttribute("data-label-format")][CreateProperty]public string DataLabelFormat { get; set; }Returns
System.String
PieLabelMode
Section titled “PieLabelMode”[UxmlAttribute("pie-label-mode")][CreateProperty]public PieLabelMode PieLabelMode { get; set; }Returns
ChartGuru.PieLabelMode
OverrideDataLabelColor
Section titled “OverrideDataLabelColor”[CreateProperty]public bool OverrideDataLabelColor { get; set; }Returns
System.Boolean
DataLabelColor
Section titled “DataLabelColor”[CreateProperty]public Color DataLabelColor { get; set; }Returns
UnityEngine.Color
OverrideAxisLabelColor
Section titled “OverrideAxisLabelColor”[CreateProperty]public bool OverrideAxisLabelColor { get; set; }Returns
System.Boolean
AxisLabelColor
Section titled “AxisLabelColor”[CreateProperty]public Color AxisLabelColor { get; set; }Returns
UnityEngine.Color
XAxisIncludeZeroInDomain
Section titled “XAxisIncludeZeroInDomain”[UxmlAttribute("x-axis-include-zero")][CreateProperty]public bool XAxisIncludeZeroInDomain { get; set; }Returns
System.Boolean
YAxisIncludeZeroInDomain
Section titled “YAxisIncludeZeroInDomain”[UxmlAttribute("y-axis-include-zero")][CreateProperty]public bool YAxisIncludeZeroInDomain { get; set; }Returns
System.Boolean
HeatMapColorScalePreset
Section titled “HeatMapColorScalePreset”[UxmlAttribute("heatmap-color-scale-preset")][CreateProperty]public int HeatMapColorScalePreset { get; set; }Returns
System.Int32
RadarRingStyle
Section titled “RadarRingStyle”[UxmlAttribute("radar-ring-style")][CreateProperty]public RadarRingStyle RadarRingStyle { get; set; }Returns
ChartGuru.RadarRingStyle
AnimationDuration
Section titled “AnimationDuration”[UxmlAttribute("animation-duration")][CreateProperty]public float AnimationDuration { get; set; }Returns
System.Single
AnimationEasing
Section titled “AnimationEasing”[UxmlAttribute("animation-easing")][CreateProperty]public Easing AnimationEasing { get; set; }Returns
ChartGuru.Easing
ScrollableAxes
Section titled “ScrollableAxes”[UxmlAttribute("scrollable-axes")][CreateProperty]public ScrollableAxes ScrollableAxes { get; set; }Returns
ChartGuru.ScrollableAxes
XVisibleDomainLength
Section titled “XVisibleDomainLength”[UxmlAttribute("x-visible-domain-length")][CreateProperty]public float XVisibleDomainLength { get; set; }Returns
System.Single
YVisibleDomainLength
Section titled “YVisibleDomainLength”[UxmlAttribute("y-visible-domain-length")][CreateProperty]public float YVisibleDomainLength { get; set; }Returns
System.Single
SelectedIndex
Section titled “SelectedIndex”public int SelectedIndex { get; }Returns
System.Int32
HoveredIndex
Section titled “HoveredIndex”public int HoveredIndex { get; }Returns
System.Int32
Events
Section titled “Events”
DataPointClicked
Section titled “DataPointClicked”public event Action<int, DataPoint> DataPointClickedRaised when the user selects a mark.
Returns
System.Action{System.Int32,ChartGuru.DataPoint}
DataPointHovered
Section titled “DataPointHovered”public event Action<int, DataPoint> DataPointHoveredRaised when the user hovers a mark.
Returns
System.Action{System.Int32,ChartGuru.DataPoint}
OnSelectionChanged
Section titled “OnSelectionChanged”public event Action<int> OnSelectionChangedRaised with the selected mark index after pointer or programmatic selection changes.
Returns
System.Action{System.Int32}
OnHoverChanged
Section titled “OnHoverChanged”public event Action<int> OnHoverChangedRaised with the hovered mark index, or -1 after the pointer leaves all marks.
Returns
System.Action{System.Int32}
OnMorphComplete
Section titled “OnMorphComplete”public event Action<ChartType> OnMorphCompleteRaised with the new chart type after an animated morph reaches its target.
Returns
System.Action{ChartGuru.ChartType}