Skip to content

Chart3DImage

ClassChartGuruChartGuru.3D
public sealed class Chart3DImage : MaskableGraphic, IChartHost

A 3D chart on a Canvas. It hosts its own chart like any chart host (an inline definition or a chart asset, plus bound data), or mirrors a scene Chart 3D host, and draws it through its own private view, which renders only when something it shows changed. Pointer events reach it like any Graphic: drags orbit the pose, scroll and pinch zoom the view, and hover, taps and tooltips use the same pointer path as every chart host.

public void SetChart(Chart chart)

Shows a chart built in code instead of the image’s content or source until Chart3DImage.ClearChart() is called. The chart is runtime state, is not saved and stays its caller’s. Like a mirrored source it is drawn as given, so several outputs can show one chart; whoever animates it runs its transitions.

Parameters

NameType
chartChartGuru.Chart
public void ClearChart()

Returns from a chart set in code to the image’s content or source.

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

Shows data instead of the bound data of the image’s own chart, 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
dataChartGuru.ChartDataFrame
shapeChangedSystem.Boolean
public void ClearData()

Returns from data set in code to the bound data.

public void Rebuild()

Recompiles the image’s own chart from its definition and data now; a disabled image recompiles when enabled.

public void SetDirty()

Recompiles the image’s own chart on the next update.

public void ReplayEntryAnimation(Animation? animation = null)

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

Parameters

NameType
animationSystem.Nullable{ChartGuru.Animation}
public void PlayLift(float lift, Animation? animation = null, Action completed = null)

Plays the lift into 3D (toward 1) or the flattening into 2D (toward 0), as Chart3DComponent.PlayLift(float, Animation?, Action). The output’s own chart animates; a mirrored or code chart, drawn as given, takes the lift at once.

Parameters

NameType
liftSystem.Single
animationSystem.Nullable{ChartGuru.Animation}
completedSystem.Action
public void Invalidate()

Rebuilds and renders the view on its next update, for content that changed without telling the chart, such as a stateful surface function; Chart3DImage.Refresh(float) renders at once.

public void Refresh(float deltaTime = 0)

Immediately renders current inputs, including stateful functions. Use deltaTime to advance a manually clocked view.

Parameters

NameType
deltaTimeSystem.Single
public void OnPointerDown(PointerEventData eventData)

Starts a press: a tap when released in place, an 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 an orbit.

Parameters

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

Tracks hover, which drives 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, which orbits the chart or feeds its custom drag gesture.

Parameters

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

Zooms the view, or feeds the chart’s magnification gesture.

Parameters

NameType
eventDataUnityEngine.EventSystems.PointerEventData
public void ClearSelection()

Clears the selection on the chart being drawn.

public Chart3DImage()

public Chart3DContentMode ContentMode { get; set; }

Where this image gets its chart. Setting Chart3DContentMode.Own clears the source; Source mode without a source draws nothing.

Returns

ChartGuru.Chart3DContentMode

public Chart3DComponent Source { get; set; }

The scene Chart 3D host this image mirrors in Source mode. Assigning a host switches the image to Source mode; null only clears the reference, so an image in Source mode then draws nothing. Either way a chart set from code is cleared.

Returns

ChartGuru.Chart3DComponent

public ChartHostContent Content { get; }

What this image hosts in Own mode: an inline definition or a chart asset, plus bound data.

Returns

ChartGuru.ChartHostContent

public ChartDefinition Definition { get; }

The definition of this image’s own chart, to read or edit. In Play Mode an image that uses a chart asset returns its own copy, like Renderer.material, so runtime edits never change the asset. Call Chart3DImage.Rebuild() after editing it.

Returns

ChartGuru.ChartDefinition

public ChartDefinition InlineDefinition { get; set; }

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

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 ChartDataAsset DataAsset { get; set; }

Shared data table bound to this image’s own chart.

Returns

ChartGuru.ChartDataAsset

public Chart Chart { get; }

The chart being drawn: a chart set from code, else the source’s chart in Source mode or this image’s own chart. Show a chart built in code with Chart3DImage.SetChart(Chart) and return with Chart3DImage.ClearChart().

Returns

ChartGuru.Chart

public bool HasRuntimeChart { get; }

True while a chart set from code replaces what the image shows.

Returns

System.Boolean

public bool IsShowingPreviewData { get; }

True while the image’s own chart shows generated preview data because nothing is bound and the definition has no rows.

Returns

System.Boolean

public Chart3DViewSettings ViewSettings { get; }

Returns

ChartGuru.Chart3DViewSettings

public ChartTheme Theme { get; set; }

Optional theme for this output’s 3D look, axis, grid and text colors and background. Empty uses the chart’s theme; the chart’s own palette always colors the marks.

Returns

ChartGuru.ChartTheme

public Chart3DAppearanceOverride Appearance { get; set; }

Optional changes to the theme’s 3D look for this output only, such as another environment cubemap.

Returns

ChartGuru.Chart3DAppearanceOverride

public Chart3DPose Pose { get; set; }

Returns

ChartGuru.Chart3DPose

public Chart3DCameraProjection Projection { get; set; }

Returns

ChartGuru.Chart3DCameraProjection

public bool AutoRotate { get; set; }

Returns

System.Boolean

public RenderTexture Texture { get; }

Returns

UnityEngine.RenderTexture

public bool HasError { get; }

Returns

System.Boolean

public override Texture mainTexture { get; }

Returns

UnityEngine.Texture

public float Zoom { get; set; }

Lens zoom of this view, changed by scroll and pinch; 1 is the framed size. Runtime only.

Returns

System.Single

public float Lift { get; set; }

How lifted the chart is drawn, as Chart3DComponent.Lift: 1 at full depth and the chart’s pose, 0 flat and facing the viewer, as its 2D chart. Setting it shows the new lift at once.

Returns

System.Single

public ChartTooltipState TooltipState { get; }

A snapshot of the tooltip’s visibility, pin state, hit, pointer position (in the image rect’s units from its bottom-left corner), retained content and change version; hovers and taps update it, and renders from a new camera move its hit with the mark.

Returns

ChartGuru.ChartTooltipState

public event Action<int, DataPoint> OnDataPointClicked

Raised when a data point is clicked or tapped.

Returns

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

public event Action<int, DataPoint> OnDataPointSelected

Raised when a data point becomes selected.

Returns

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

public event Action<int, DataPoint> OnDataPointHovered

Raised when the pointer moves onto a data point.

Returns

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

public event Action OnSelectionCleared

Raised when the selection is cleared.

Returns

System.Action

public event Action<ChartTooltipState> OnTooltipChanged

Raised when the tooltip content or visibility changes.

Returns

System.Action{ChartGuru.ChartTooltipState}