Skip to content

ChartGraphic

ClassChartGuruChartGuru
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 void SetChart(Chart chart)

Shows a chart built in code. The chart is runtime state: it is not saved with the scene and replaces the definition until ChartGraphic.ClearChart() is called.

Parameters

NameType
chartChartGuru.Chart
public void ClearChart()

Returns from a chart set in code to the definition.

public void SetData(ChartDataFrame frame, bool shapeChanged = true)

Shows frame instead of the bound data, mapped by the definition’s layers. The data is runtime state and is not saved; pass null to return to the bound data. Pass shapeChanged false when the data keeps the columns, row count and categories shown, so the chart’s values update in place.

Parameters

NameType
frameChartGuru.ChartDataFrame
shapeChangedSystem.Boolean
public void ClearData()

Returns from data set in code to the bound data.

public void Rebuild()

Recompiles the chart from the definition, for example after editing it from code.

public void SetDirty()

Marks the chart for a rebuild on the next update.

public void MorphTo(ChartType type, ChartMorphStyle? style = null)

Changes the chart type and morphs the live chart into it, bars into pies included; types without a 2D morph recipe, such as 3D types, rebuild instead. A chart set from code changes its own type.

Parameters

NameType
typeChartGuru.ChartType
styleSystem.Nullable{ChartGuru.ChartMorphStyle}
public void ClearSelection()

Clears the selection on the runtime chart.

public void OnPointerDown(PointerEventData eventData)

Starts a press: a tap when released in place, a drag, orbit or pinch when it moves.

Parameters

NameType
eventDataUnityEngine.EventSystems.PointerEventData
public void OnPointerUp(PointerEventData eventData)

Ends a press, selecting the mark under a tap or finishing a drag.

Parameters

NameType
eventDataUnityEngine.EventSystems.PointerEventData
public void OnPointerMove(PointerEventData eventData)

Tracks hover, which drives highlights and tooltips.

Parameters

NameType
eventDataUnityEngine.EventSystems.PointerEventData
public void OnPointerExit(PointerEventData eventData)

Clears the hover target when the pointer leaves the chart.

Parameters

NameType
eventDataUnityEngine.EventSystems.PointerEventData

OnInitializePotentialDrag(PointerEventData)

Section titled “OnInitializePotentialDrag(PointerEventData)”
public void OnInitializePotentialDrag(PointerEventData eventData)

Lets drags start at the chart’s own threshold, which tells taps from drags for every host alike.

Parameters

NameType
eventDataUnityEngine.EventSystems.PointerEventData
public void OnDrag(PointerEventData eventData)

Moves a pressed pointer, for drag selection, panning, pinching or the chart’s custom drag gesture.

Parameters

NameType
eventDataUnityEngine.EventSystems.PointerEventData
public void OnScroll(PointerEventData eventData)

Zooms scrollable axes or feeds magnification; unhandled wheel input reaches a parent scroll view.

Parameters

NameType
eventDataUnityEngine.EventSystems.PointerEventData
public void ReplayEntryAnimation(Animation? animation = null)

Replays the entry animation, using the chart’s animation when none is given.

Parameters

NameType
animationSystem.Nullable{ChartGuru.Animation}
public void RequestRefresh()

Marks the chart as needing layout and rendering on the next valid update.

public void ForceRenderChart()

Immediately renders the chart, or defers until the next update when a Canvas rebuild is in progress.

public Texture GetOutputTexture(bool includeText)

Returns the current straight-alpha 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

NameType
includeTextSystem.Boolean

Returns

UnityEngine.Texture

public Texture RefreshOutputTexture(bool includeText)

Refreshes and returns the selected chart texture.

Parameters

NameType
includeTextSystem.Boolean

Returns

UnityEngine.Texture

public byte[] EncodeOutputPng(bool includeText = true)

Performs an explicit GPU readback and encodes the current chart as PNG. This is intended for export and screenshots, not per-frame rendering.

Parameters

NameType
includeTextSystem.Boolean

Returns

System.Byte[]

public void SaveOutputPng(string path, bool includeText = true)

Encodes and writes the current chart to an explicit PNG path.

Parameters

NameType
pathSystem.String
includeTextSystem.Boolean
public bool NeedsOutputTextureRefresh(bool includeText)

Returns true when the selected texture path needs a refresh before use.

Parameters

NameType
includeTextSystem.Boolean

Returns

System.Boolean

public void ReleaseComposedOutputTexture()

Releases the cached composed texture and its hidden capture objects.

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 OnPopulateMesh(VertexHelper vh)

Builds a Canvas quad for the chart render texture, or clears the mesh before a render target exists.

Parameters

NameType
vhUnityEngine.UI.VertexHelper
protected override void UpdateMaterial()

Updates the Canvas material and selects the chart texture matching its alpha convention.

public ChartGraphic()

public ChartHostContent Content { get; }

What this graphic shows: an inline definition or a chart asset, plus bound data.

Returns

ChartGuru.ChartHostContent

public ChartDefinition Definition { get; }

The definition to read or edit: the asset’s when one is assigned, otherwise the inline one. In Play Mode a graphic that uses a chart asset returns its own copy, like Renderer.material, so runtime edits never change the asset. Call ChartGraphic.Rebuild() after editing it.

Returns

ChartGuru.ChartDefinition

public ChartAsset DefinitionAsset { get; set; }

Shared chart asset; assigning one replaces the inline definition until it is cleared.

Returns

ChartGuru.ChartAsset

public ChartDefinition InlineDefinition { get; set; }

The definition stored with this component, used when no asset is assigned.

Returns

ChartGuru.ChartDefinition

public ChartDataAsset DataAsset { get; set; }

Shared data table bound to this chart.

Returns

ChartGuru.ChartDataAsset

public FrameTimingSettings Timing { get; set; }

Update rate and edit-mode ticking.

Returns

ImpossibleRobert.Common.Timing.FrameTimingSettings

public Chart Chart { get; }

The runtime chart being drawn.

Returns

ChartGuru.Chart

public ChartProxy Proxy { get; }

Hit testing and coordinate conversion for the runtime chart.

Returns

ChartGuru.ChartProxy

public ChartTooltipState TooltipState { get; }

A snapshot of tooltip visibility, pin state, hit, pointer position, retained content, and version; returns the default state before the runtime controller exists.

Returns

ChartGuru.ChartTooltipState

public bool HasRuntimeChart { get; }

True while a chart set from code replaces the definition.

Returns

System.Boolean

public ChartType ChartType { get; set; }

The definition’s chart family. Setting it morphs the live chart when a 2D morph recipe exists.

Returns

ChartGuru.ChartType

public bool IsShowingPreviewData { get; }

True while generated preview data is shown because nothing is bound and the definition has no rows.

Returns

System.Boolean

public override Texture mainTexture { get; }

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 RadarLabelLayout.

Returns

UnityEngine.Texture

public override Material defaultMaterial { get; }

The default Canvas material consumes the private filtered premultiplied chart target.

Returns

UnityEngine.Material

public event Action<int, DataPoint> OnDataPointClicked

Raised with the mark index and data point after a rendered point is clicked.

Returns

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

public event Action<int, DataPoint> OnDataPointSelected

Raised with the mark index and data point after selection changes.

Returns

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

public event Action<int, DataPoint> OnDataPointHovered

Raised with the mark index and data point when the hover target changes.

Returns

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

public event Action OnSelectionCleared

Raised after the current chart selection is cleared.

Returns

System.Action

public event Action<ChartTooltipState> OnTooltipChanged

Raised whenever retained tooltip visibility, content, pin state, or the semantic hit changes.

Returns

System.Action{ChartGuru.ChartTooltipState}

public event Action<ChartTooltipState> OnTooltipPresentationChanged

Raised for all tooltip presentation updates, including pointer-only and animated placement changes.

Returns

System.Action{ChartGuru.ChartTooltipState}