Skip to content

ChartGraphic

ClassChartGuruChartGuru
[AddComponentMenu("ChartGuru/Chart Graphic")]
[ExecuteAlways]
[RequireComponent(typeof(RectTransform))]
[RequireComponent(typeof(CanvasRenderer))]
public class ChartGraphic : MaskableGraphic, IChartHost

Renders a Chart Guru chart inside a Unity UI Canvas and exposes runtime data, configuration, animation, and pointer-interaction entry points.

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.

public MarkStackingMethod StackingMethod { get; set; }

No description is available for this member.

Returns

ChartGuru.MarkStackingMethod — No return description is available.

public float CornerRadius { get; set; }

No description is available for this member.

Returns

System.Single — No return description is available.

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.

public bool UseForegroundGradient { get; set; }

No description is available for this member.

Returns

System.Boolean — No return description is available.

public Gradient ForegroundGradient { get; set; }

No description is available for this member.

Returns

UnityEngine.Gradient — No return description is available.

public UnitPoint ForegroundGradientStartPoint { get; set; }

No description is available for this member.

Returns

ChartGuru.UnitPoint — No return description is available.

public UnitPoint ForegroundGradientEndPoint { get; set; }

No description is available for this member.

Returns

ChartGuru.UnitPoint — No return description is available.

public InterpolationMethod Interpolation { get; set; }

No description is available for this member.

Returns

ChartGuru.InterpolationMethod — No return description is available.

public float LineWidth { get; set; }

No description is available for this member.

Returns

System.Single — No return description is available.

public bool ShowSymbols { get; set; }

No description is available for this member.

Returns

System.Boolean — No return description is available.

public float SymbolSize { get; set; }

No description is available for this member.

Returns

System.Single — No return description is available.

public SymbolShape Symbol { get; set; }

No description is available for this member.

Returns

ChartGuru.SymbolShape — No return description is available.

public float Opacity { get; set; }

No description is available for this member.

Returns

System.Single — No return description is available.

public bool ShowAreaLine { get; set; }

No description is available for this member.

Returns

System.Boolean — No return description is available.

public float InnerRadius { get; set; }

No description is available for this member.

Returns

System.Single — No return description is available.

public float AngularInset { get; set; }

Angular inset between pie/donut slices in degrees.

Returns

System.Single — No return description is available.

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.

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.

public bool ShowAxisLabels { get; set; }

No description is available for this member.

Returns

System.Boolean — No return description is available.

public bool ShowAxisTitles { get; set; }

No description is available for this member.

Returns

System.Boolean — No return description is available.

public bool ShowDataLabels { get; set; }

No description is available for this member.

Returns

System.Boolean — No return description is available.

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.

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.

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.

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.

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.

public string DataLabelFormat { get; set; }

No description is available for this member.

Returns

System.String — No return description is available.

public PieLabelMode PieLabelMode { get; set; }

Positioning mode for pie/donut chart data labels.

Returns

ChartGuru.PieLabelMode — No return description is available.

public LabelRotation XAxisLabelRotation { get; set; }

No description is available for this member.

Returns

ChartGuru.LabelRotation — No return description is available.

public SelectionIndicatorStyle SelectionIndicatorStyle { get; set; }

Style for selection/hover indicators. Swift Charts equivalent: selection indicator styling

Returns

ChartGuru.SelectionIndicatorStyle — No return description is available.

public Color PlotAreaBorderColor { get; set; }

Color of the plot area border.

Returns

UnityEngine.Color — No return description is available.

public float PlotAreaBorderWidth { get; set; }

Width of the plot area border.

Returns

System.Single — No return description is available.

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.

public Color ChartBorderColor { get; set; }

Color of the chart border stroke.

Returns

UnityEngine.Color — No return description is available.

public float ChartBorderWidth { get; set; }

Width of the chart border stroke in pixels.

Returns

System.Single — No return description is available.

public float ChartBorderCornerRadius { get; set; }

Corner radius for a rounded chart border.

Returns

System.Single — No return description is available.

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.

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.

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.

public bool UseBackgroundColorOverride { get; set; }

Gets or sets whether to override the theme background color.

Returns

System.Boolean — No return description is available.

public ChartBackgroundMode BackgroundMode { get; set; }

Background rendering mode used when ChartGuru.ChartGraphic.UseBackgroundColorOverride is true.

Returns

ChartGuru.ChartBackgroundMode — No return description is available.

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.

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.

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.

public bool UsePlotAreaColorOverride { get; set; }

Gets or sets whether to override the theme plot area color.

Returns

System.Boolean — No return description is available.

public ChartBackgroundMode PlotAreaMode { get; set; }

Background rendering mode for the plot area override.

Returns

ChartGuru.ChartBackgroundMode — No return description is available.

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.

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.

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.

public int SelectedIndex { get; set; }

Gets or sets the currently selected data point index.

Returns

System.Int32 — No return description is available.

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.

public void SetDirty()

ChartGuru.IChartHost.SetDirty implementation: requests a vertex/render rebuild on the next frame.

public void OnPointerClick(PointerEventData eventData)

Use this callback to detect clicks.

Parameters

Name Type Description
eventData UnityEngine.EventSystems.PointerEventData
public void OnPointerMove(PointerEventData eventData)

Use this callback to detect pointer move events

Parameters

Name Type Description
eventData UnityEngine.EventSystems.PointerEventData
public void OnPointerExit(PointerEventData eventData)

Use this callback to detect pointer exit events

Parameters

Name Type Description
eventData UnityEngine.EventSystems.PointerEventData
public void OnBeginDrag(PointerEventData eventData)

Called by a BaseInputModule before a drag is started.

Parameters

Name Type Description
eventData UnityEngine.EventSystems.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
public void OnEndDrag(PointerEventData eventData)

Called by a BaseInputModule when a drag is ended.

Parameters

Name Type Description
eventData UnityEngine.EventSystems.PointerEventData
public void OnScroll(PointerEventData eventData)

Use this callback to detect scroll events.

Parameters

Name Type Description
eventData UnityEngine.EventSystems.PointerEventData
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.

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.

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.

public void ReleaseComposedOutputTexture()

Releases the cached composed texture and its hidden capture objects.

protected override void Awake()

No description is available for this member.

protected override void OnEnable()

Mark the Graphic and the canvas as having been changed.

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.

protected override void OnDisable()

Clear references.

protected override void OnDestroy()

No description is available for this member.

protected override void OnRectTransformDimensionsChange()

Ensures renderer exists, recreating if needed after OnDisable.

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.

protected override void OnTransformParentChanged()

No description is available for this member.

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
public void RequestRefresh()

No description is available for this member.

public void ForceRenderChart()

No description is available for this member.

public void NotifyExternalDataChanged()

No description is available for this member.

public void SetChartData(Chart chart)

No description is available for this member.

Parameters

Name Type Description
chart ChartGuru.Chart
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.

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.
public void SetData(float[] values)

Set chart data using an array of values.

Parameters

Name Type Description
values System.Single[]
public void SetData(Vector2[] points)

Set chart data with X and Y values.

Parameters

Name Type Description
points UnityEngine.Vector2[]
public void AddDataPoint(float x, float y)

Add a data point to the chart.

Parameters

Name Type Description
x System.Single
y System.Single
public void ClearData()

Clear all data from the chart.

public void ClearSelection()

Clear the current selection.

public event Action<int, DataPoint> OnDataPointClicked

No description is available for this member.

Returns

System.Action{System.Int32,ChartGuru.DataPoint} — No return description is available.

public event Action<int, DataPoint> OnDataPointSelected

No description is available for this member.

Returns

System.Action{System.Int32,ChartGuru.DataPoint} — No return description is available.

public event Action<int, DataPoint> OnDataPointHovered

No description is available for this member.

Returns

System.Action{System.Int32,ChartGuru.DataPoint} — No return description is available.

public event Action OnSelectionCleared

No description is available for this member.

Returns

System.Action — No return description is available.