ChartGraphic
[AddComponentMenu("ChartGuru/Chart Graphic")][ExecuteAlways][RequireComponent(typeof(RectTransform))][RequireComponent(typeof(CanvasRenderer))]public class ChartGraphic : MaskableGraphic, IChartHostRenders a Chart Guru chart inside a Unity UI Canvas and exposes runtime data, configuration, animation, and pointer-interaction entry points.
Properties
Section titled “Properties”
public Chart Chart { get; }The bound ChartGuru.IChartHost.Chart model, if any.
Returns
ChartGuru.Chart — No return description is available.
public ChartProxy Proxy { get; }No description is available for this member.
Returns
ChartGuru.ChartProxy — No return description is available.
StackingMethod
Section titled “StackingMethod”public MarkStackingMethod StackingMethod { get; set; }No description is available for this member.
Returns
ChartGuru.MarkStackingMethod — No return description is available.
CornerRadius
Section titled “CornerRadius”public float CornerRadius { get; set; }No description is available for this member.
Returns
System.Single — No return description is available.
ForegroundStyleMode
Section titled “ForegroundStyleMode”public ForegroundStyleMode ForegroundStyleMode { get; set; }Controls how is assigned to marks in single-series charts. Mirrors Swift Charts’ .ForegroundStyle(by:) modifier.
Returns
ChartGuru.ForegroundStyleMode — No return description is available.
UseForegroundGradient
Section titled “UseForegroundGradient”public bool UseForegroundGradient { get; set; }No description is available for this member.
Returns
System.Boolean — No return description is available.
ForegroundGradient
Section titled “ForegroundGradient”public Gradient ForegroundGradient { get; set; }No description is available for this member.
Returns
UnityEngine.Gradient — No return description is available.
ForegroundGradientStartPoint
Section titled “ForegroundGradientStartPoint”public UnitPoint ForegroundGradientStartPoint { get; set; }No description is available for this member.
Returns
ChartGuru.UnitPoint — No return description is available.
ForegroundGradientEndPoint
Section titled “ForegroundGradientEndPoint”public UnitPoint ForegroundGradientEndPoint { get; set; }No description is available for this member.
Returns
ChartGuru.UnitPoint — No return description is available.
Interpolation
Section titled “Interpolation”public InterpolationMethod Interpolation { get; set; }No description is available for this member.
Returns
ChartGuru.InterpolationMethod — No return description is available.
LineWidth
Section titled “LineWidth”public float LineWidth { get; set; }No description is available for this member.
Returns
System.Single — No return description is available.
ShowSymbols
Section titled “ShowSymbols”public bool ShowSymbols { get; set; }No description is available for this member.
Returns
System.Boolean — No return description is available.
SymbolSize
Section titled “SymbolSize”public float SymbolSize { get; set; }No description is available for this member.
Returns
System.Single — No return description is available.
Symbol
Section titled “Symbol”public SymbolShape Symbol { get; set; }No description is available for this member.
Returns
ChartGuru.SymbolShape — No return description is available.
Opacity
Section titled “Opacity”public float Opacity { get; set; }No description is available for this member.
Returns
System.Single — No return description is available.
ShowAreaLine
Section titled “ShowAreaLine”public bool ShowAreaLine { get; set; }No description is available for this member.
Returns
System.Boolean — No return description is available.
InnerRadius
Section titled “InnerRadius”public float InnerRadius { get; set; }No description is available for this member.
Returns
System.Single — No return description is available.
AngularInset
Section titled “AngularInset”public float AngularInset { get; set; }Angular inset between pie/donut slices in degrees.
Returns
System.Single — No return description is available.
YAxisOnRight
Section titled “YAxisOnRight”public bool YAxisOnRight { get; set; }Gets or sets whether the Y-axis is on the right side (default is left).
Returns
System.Boolean — No return description is available.
YAxisTickFormat
Section titled “YAxisTickFormat”public string YAxisTickFormat { get; set; }Gets or sets the Y-axis tick format string (e.g., “F0” for integers, “F1” for one decimal).
Returns
System.String — No return description is available.
ShowAxisLabels
Section titled “ShowAxisLabels”public bool ShowAxisLabels { get; set; }No description is available for this member.
Returns
System.Boolean — No return description is available.
ShowAxisTitles
Section titled “ShowAxisTitles”public bool ShowAxisTitles { get; set; }No description is available for this member.
Returns
System.Boolean — No return description is available.
ShowDataLabels
Section titled “ShowDataLabels”public bool ShowDataLabels { get; set; }No description is available for this member.
Returns
System.Boolean — No return description is available.
AutoContrastText
Section titled “AutoContrastText”public bool AutoContrastText { get; set; }When enabled, axis labels, axis titles, data labels, and legend text automatically adjust to white or black for maximum contrast against their background.
Returns
System.Boolean — No return description is available.
OverrideDataLabelColor
Section titled “OverrideDataLabelColor”public bool OverrideDataLabelColor { get; set; }When true, ChartGuru.ChartGraphic.DataLabelColor overrides the theme text colour
for data labels (mirrors the Chart Designer’s “Label Color Override”).
Returns
System.Boolean — No return description is available.
DataLabelColor
Section titled “DataLabelColor”public Color DataLabelColor { get; set; }Explicit data-label colour applied when ChartGuru.ChartGraphic.OverrideDataLabelColor
is true. Equivalent to chart.DataLabelColor for code-driven flows.
Returns
UnityEngine.Color — No return description is available.
OverrideAxisLabelColor
Section titled “OverrideAxisLabelColor”public bool OverrideAxisLabelColor { get; set; }When true, ChartGuru.ChartGraphic.AxisLabelColor overrides the theme text colour
for axis tick labels (and radar ring/spoke labels).
Returns
System.Boolean — No return description is available.
AxisLabelColor
Section titled “AxisLabelColor”public Color AxisLabelColor { get; set; }Explicit axis-label colour applied when ChartGuru.ChartGraphic.OverrideAxisLabelColor
is true. Equivalent to chart.AxisLabelColor for code-driven flows.
Returns
UnityEngine.Color — No return description is available.
DataLabelFormat
Section titled “DataLabelFormat”public string DataLabelFormat { get; set; }No description is available for this member.
Returns
System.String — No return description is available.
PieLabelMode
Section titled “PieLabelMode”public PieLabelMode PieLabelMode { get; set; }Positioning mode for pie/donut chart data labels.
Returns
ChartGuru.PieLabelMode — No return description is available.
XAxisLabelRotation
Section titled “XAxisLabelRotation”public LabelRotation XAxisLabelRotation { get; set; }No description is available for this member.
Returns
ChartGuru.LabelRotation — No return description is available.
SelectionIndicatorStyle
Section titled “SelectionIndicatorStyle”public SelectionIndicatorStyle SelectionIndicatorStyle { get; set; }Style for selection/hover indicators. Swift Charts equivalent: selection indicator styling
Returns
ChartGuru.SelectionIndicatorStyle — No return description is available.
PlotAreaBorderColor
Section titled “PlotAreaBorderColor”public Color PlotAreaBorderColor { get; set; }Color of the plot area border.
Returns
UnityEngine.Color — No return description is available.
PlotAreaBorderWidth
Section titled “PlotAreaBorderWidth”public float PlotAreaBorderWidth { get; set; }Width of the plot area border.
Returns
System.Single — No return description is available.
PlotAreaCornerRadius
Section titled “PlotAreaCornerRadius”public float PlotAreaCornerRadius { get; set; }Corner radius for the plot area. Swift Charts equivalent: .chartPlotStyle { $0.CornerRadius(…) }
Returns
System.Single — No return description is available.
ChartBorderColor
Section titled “ChartBorderColor”public Color ChartBorderColor { get; set; }Color of the chart border stroke.
Returns
UnityEngine.Color — No return description is available.
ChartBorderWidth
Section titled “ChartBorderWidth”public float ChartBorderWidth { get; set; }Width of the chart border stroke in pixels.
Returns
System.Single — No return description is available.
ChartBorderCornerRadius
Section titled “ChartBorderCornerRadius”public float ChartBorderCornerRadius { get; set; }Corner radius for a rounded chart border.
Returns
System.Single — No return description is available.
LegendAlignment
Section titled “LegendAlignment”public LegendAlignment LegendAlignment { get; set; }Alignment of the legend within its position area. Swift Charts equivalent: .ChartLegend(position:alignment:)
Returns
ChartGuru.LegendAlignment — No return description is available.
ChartType
Section titled “ChartType”public ChartType ChartType { get; set; }Available chart types. Aligned with Swift Charts mark-based approach. Includes compact/tiny chart variants for inline display.
Returns
ChartGuru.ChartType — No return description is available.
Animation
Section titled “Animation”public Animation? Animation { get; set; }Animation used for data changes. Set to an animation to interpolate values, or null to apply instantly (matching Swift Charts’ default).
Returns
System.Nullable{ChartGuru.Animation} — No return description is available.
public ChartTheme Theme { get; set; }No description is available for this member.
Returns
ChartGuru.ChartTheme — No return description is available.
UseBackgroundColorOverride
Section titled “UseBackgroundColorOverride”public bool UseBackgroundColorOverride { get; set; }Gets or sets whether to override the theme background color.
Returns
System.Boolean — No return description is available.
BackgroundMode
Section titled “BackgroundMode”public ChartBackgroundMode BackgroundMode { get; set; }Background rendering mode used when ChartGuru.ChartGraphic.UseBackgroundColorOverride is true.
Returns
ChartGuru.ChartBackgroundMode — No return description is available.
BackgroundColorOverride
Section titled “BackgroundColorOverride”public Color BackgroundColorOverride { get; set; }Gets or sets the background color override. Applied when UseBackgroundColorOverride is true and BackgroundMode is SolidColor. Setting to transparent achieves the same as TransparentBackground.
Returns
UnityEngine.Color — No return description is available.
BackgroundGradientStyle
Section titled “BackgroundGradientStyle”public LinearGradientStyle BackgroundGradientStyle { get; set; }Linear gradient override for chart background. Applied when UseBackgroundColorOverride is true and BackgroundMode is LinearGradient.
Returns
ChartGuru.LinearGradientStyle — No return description is available.
BackgroundFourCorner
Section titled “BackgroundFourCorner”public FourCornerGradient BackgroundFourCorner { get; set; }Four-corner gradient override for chart background. Applied when UseBackgroundColorOverride is true and BackgroundMode is FourCornerGradient.
Returns
ChartGuru.FourCornerGradient — No return description is available.
UsePlotAreaColorOverride
Section titled “UsePlotAreaColorOverride”public bool UsePlotAreaColorOverride { get; set; }Gets or sets whether to override the theme plot area color.
Returns
System.Boolean — No return description is available.
PlotAreaMode
Section titled “PlotAreaMode”public ChartBackgroundMode PlotAreaMode { get; set; }Background rendering mode for the plot area override.
Returns
ChartGuru.ChartBackgroundMode — No return description is available.
PlotAreaColorOverride
Section titled “PlotAreaColorOverride”public Color PlotAreaColorOverride { get; set; }Gets or sets the plot area fill color override. Applied when UsePlotAreaColorOverride is true and PlotAreaMode is SolidColor.
Returns
UnityEngine.Color — No return description is available.
PlotAreaGradientStyle
Section titled “PlotAreaGradientStyle”public LinearGradientStyle PlotAreaGradientStyle { get; set; }Linear gradient for the plot area background. Applied when UsePlotAreaColorOverride is true and PlotAreaMode is LinearGradient.
Returns
ChartGuru.LinearGradientStyle — No return description is available.
PlotAreaFourCorner
Section titled “PlotAreaFourCorner”public FourCornerGradient PlotAreaFourCorner { get; set; }Four-corner gradient for the plot area background. Applied when UsePlotAreaColorOverride is true and PlotAreaMode is FourCornerGradient.
Returns
ChartGuru.FourCornerGradient — No return description is available.
SelectedIndex
Section titled “SelectedIndex”public int SelectedIndex { get; set; }Gets or sets the currently selected data point index.
Returns
System.Int32 — No return description is available.
mainTexture
Section titled “mainTexture”public override Texture mainTexture { get; }The graphic’s texture. (Read Only).
Returns
UnityEngine.Texture — No return description is available.
Remarks
This is the Texture that gets passed to the CanvasRenderer, Material and then Shader _MainTex.
When implementing your own Graphic you can override this to control which texture goes through the UI Rendering pipeline.
Bear in mind that Unity tries to batch UI elements together to improve performance, so its ideal to work with atlas to reduce the number of draw calls.
Methods
Section titled “Methods”
SetDirty()
Section titled “SetDirty()”public void SetDirty()ChartGuru.IChartHost.SetDirty implementation: requests a vertex/render
rebuild on the next frame.
OnPointerClick(PointerEventData)
Section titled “OnPointerClick(PointerEventData)”public void OnPointerClick(PointerEventData eventData)Use this callback to detect clicks.
Parameters
| Name | Type | Description |
|---|---|---|
eventData |
UnityEngine.EventSystems.PointerEventData | |
OnPointerMove(PointerEventData)
Section titled “OnPointerMove(PointerEventData)”public void OnPointerMove(PointerEventData eventData)Use this callback to detect pointer move events
Parameters
| Name | Type | Description |
|---|---|---|
eventData |
UnityEngine.EventSystems.PointerEventData | |
OnPointerExit(PointerEventData)
Section titled “OnPointerExit(PointerEventData)”public void OnPointerExit(PointerEventData eventData)Use this callback to detect pointer exit events
Parameters
| Name | Type | Description |
|---|---|---|
eventData |
UnityEngine.EventSystems.PointerEventData | |
OnBeginDrag(PointerEventData)
Section titled “OnBeginDrag(PointerEventData)”public void OnBeginDrag(PointerEventData eventData)Called by a BaseInputModule before a drag is started.
Parameters
| Name | Type | Description |
|---|---|---|
eventData |
UnityEngine.EventSystems.PointerEventData | |
OnDrag(PointerEventData)
Section titled “OnDrag(PointerEventData)”public void OnDrag(PointerEventData eventData)When dragging is occurring this will be called every time the cursor is moved.
Parameters
| Name | Type | Description |
|---|---|---|
eventData |
UnityEngine.EventSystems.PointerEventData | |
OnEndDrag(PointerEventData)
Section titled “OnEndDrag(PointerEventData)”public void OnEndDrag(PointerEventData eventData)Called by a BaseInputModule when a drag is ended.
Parameters
| Name | Type | Description |
|---|---|---|
eventData |
UnityEngine.EventSystems.PointerEventData | |
OnScroll(PointerEventData)
Section titled “OnScroll(PointerEventData)”public void OnScroll(PointerEventData eventData)Use this callback to detect scroll events.
Parameters
| Name | Type | Description |
|---|---|---|
eventData |
UnityEngine.EventSystems.PointerEventData | |
GetOutputTexture(bool)
Section titled “GetOutputTexture(bool)”public Texture GetOutputTexture(bool includeText)Returns the current chart texture. When includeText is false,
this is the fast chart-geometry texture. When true, this returns the last
refreshed composed texture that includes Chart Guru’s TMP labels, titles, and legend.
Parameters
| Name | Type | Description |
|---|---|---|
includeText |
System.Boolean |
Returns
UnityEngine.Texture — No return description is available.
RefreshOutputTexture(bool)
Section titled “RefreshOutputTexture(bool)”public Texture RefreshOutputTexture(bool includeText)Refreshes and returns the selected chart texture.
Parameters
| Name | Type | Description |
|---|---|---|
includeText |
System.Boolean |
Returns
UnityEngine.Texture — No return description is available.
NeedsOutputTextureRefresh(bool)
Section titled “NeedsOutputTextureRefresh(bool)”public bool NeedsOutputTextureRefresh(bool includeText)Returns true when the selected texture path needs a refresh before use.
Parameters
| Name | Type | Description |
|---|---|---|
includeText |
System.Boolean |
Returns
System.Boolean — No return description is available.
ReleaseComposedOutputTexture()
Section titled “ReleaseComposedOutputTexture()”public void ReleaseComposedOutputTexture()Releases the cached composed texture and its hidden capture objects.
Awake()
Section titled “Awake()”protected override void Awake()No description is available for this member.
OnEnable()
Section titled “OnEnable()”protected override void OnEnable()Mark the Graphic and the canvas as having been changed.
ReplayEntryAnimation()
Section titled “ReplayEntryAnimation()”public void ReplayEntryAnimation()Replays the entry Animation (zero → current values) using the component’s configured animation. No-op if animation is disabled or the chart isn’t ready.
OnDisable()
Section titled “OnDisable()”protected override void OnDisable()Clear references.
OnDestroy()
Section titled “OnDestroy()”protected override void OnDestroy()No description is available for this member.
OnRectTransformDimensionsChange()
Section titled “OnRectTransformDimensionsChange()”protected override void OnRectTransformDimensionsChange()Ensures renderer exists, recreating if needed after OnDisable.
OnCanvasHierarchyChanged()
Section titled “OnCanvasHierarchyChanged()”protected override void OnCanvasHierarchyChanged()Forces an immediate render of the chart to the render texture. Called when the texture is recreated to avoid blank frames. In editor mode, this completes any animation immediately. In play mode with animation enabled, this allows animation to continue.
OnTransformParentChanged()
Section titled “OnTransformParentChanged()”protected override void OnTransformParentChanged()No description is available for this member.
OnPopulateMesh(VertexHelper)
Section titled “OnPopulateMesh(VertexHelper)”protected override void OnPopulateMesh(VertexHelper vh)Builds the list of radar-ring tick-value labels and spoke-tip category labels based on the chart’s axis configuration, then pushes them to the text manager. Layout is shared with the editor previews via ChartGuru.RadarLabelLayout.
Parameters
| Name | Type | Description |
|---|---|---|
vh |
UnityEngine.UI.VertexHelper | |
RequestRefresh()
Section titled “RequestRefresh()”public void RequestRefresh()No description is available for this member.
ForceRenderChart()
Section titled “ForceRenderChart()”public void ForceRenderChart()No description is available for this member.
NotifyExternalDataChanged()
Section titled “NotifyExternalDataChanged()”public void NotifyExternalDataChanged()No description is available for this member.
SetChartData(Chart)
Section titled “SetChartData(Chart)”public void SetChartData(Chart chart)No description is available for this member.
Parameters
| Name | Type | Description |
|---|---|---|
chart |
ChartGuru.Chart | |
RefreshFromSerializedState()
Section titled “RefreshFromSerializedState()”public void RefreshFromSerializedState()Rebuilds the chart from the serialized Inspector state and exits programmatic-chart mode. Intended for editor tooling that imports chart configuration into serialized fields.
ApplyAuthoredConfiguration(Chart)
Section titled “ApplyAuthoredConfiguration(Chart)”public void ApplyAuthoredConfiguration(Chart chart)Copies every authored configuration value from the supplied ChartGuru.ChartGraphic.Chart into this
component’s serialized fields, so the Inspector reflects the chart state.
Unlike ChartGuru.ChartGraphic.SetChartData(ChartGuru.Chart), this does NOT switch the component into programmatic
mode: the next ChartGuru.ChartGraphic.RebuildChart will recompose a chart from the synced fields,
which keeps the new object fully editable (e.g. when instantiated from the Chart Designer).
Parameters
| Name | Type | Description |
|---|---|---|
chart |
ChartGuru.Chart | Source chart to copy configuration from. No-op when null. |
SetData(float[])
Section titled “SetData(float[])”public void SetData(float[] values)Set chart data using an array of values.
Parameters
| Name | Type | Description |
|---|---|---|
values |
System.Single[] | |
SetData(Vector2[])
Section titled “SetData(Vector2[])”public void SetData(Vector2[] points)Set chart data with X and Y values.
Parameters
| Name | Type | Description |
|---|---|---|
points |
UnityEngine.Vector2[] | |
AddDataPoint(float, float)
Section titled “AddDataPoint(float, float)”public void AddDataPoint(float x, float y)Add a data point to the chart.
Parameters
| Name | Type | Description |
|---|---|---|
x |
System.Single | |
y |
System.Single | |
ClearData()
Section titled “ClearData()”public void ClearData()Clear all data from the chart.
ClearSelection()
Section titled “ClearSelection()”public void ClearSelection()Clear the current selection.
Events
Section titled “Events”
OnDataPointClicked
Section titled “OnDataPointClicked”public event Action<int, DataPoint> OnDataPointClickedNo description is available for this member.
Returns
System.Action{System.Int32,ChartGuru.DataPoint} — No return description is available.
OnDataPointSelected
Section titled “OnDataPointSelected”public event Action<int, DataPoint> OnDataPointSelectedNo description is available for this member.
Returns
System.Action{System.Int32,ChartGuru.DataPoint} — No return description is available.
OnDataPointHovered
Section titled “OnDataPointHovered”public event Action<int, DataPoint> OnDataPointHoveredNo description is available for this member.
Returns
System.Action{System.Int32,ChartGuru.DataPoint} — No return description is available.
OnSelectionCleared
Section titled “OnSelectionCleared”public event Action OnSelectionClearedNo description is available for this member.
Returns
System.Action — No return description is available.