Skip to content

ChartMorpher

ClassChartGuruChartGuru
public class ChartMorpher

Drives value and chart-type transitions. Interpolates previous-to-current mark values via a Burst job using an ChartGuru.Animation curve.

public ChartMorpher(Chart chart)

Creates a morph controller that reads mark state from and writes transition state for the supplied chart.

Parameters

Name Type
chart ChartGuru.Chart

StartMorph(ChartType, ChartType, Animation, Action)

Section titled “StartMorph(ChartType, ChartType, Animation, Action)”
public void StartMorph(ChartType sourceType, ChartType targetType, Animation animation, Action onComplete = null)

Starts a chart-type morph. The chart has already switched to targetType by the time this is called. The morpher keeps values stable (source == target) so the data doesn’t “grow in” on every morph; instead the renderer cross-fades between the source and target chart type using ChartGuru.ChartMorpher.EasedProgress.

Parameters

Name Type
sourceType ChartGuru.ChartType
targetType ChartGuru.ChartType
animation ChartGuru.Animation
onComplete System.Action

StartMorph(ChartType, ChartType, Animation, ChartMorphStyle, Action)

Section titled “StartMorph(ChartType, ChartType, Animation, ChartMorphStyle, Action)”
public void StartMorph(ChartType sourceType, ChartType targetType, Animation animation, ChartMorphStyle style, Action onComplete = null)

Starts a chart-type morph. The chart has already switched to targetType by the time this is called. The morpher keeps values stable (source == target) so the data doesn’t “grow in” on every morph; instead the renderer cross-fades between the source and target chart type using ChartGuru.ChartMorpher.EasedProgress.

Parameters

Name Type
sourceType ChartGuru.ChartType
targetType ChartGuru.ChartType
animation ChartGuru.Animation
style ChartGuru.ChartMorphStyle
onComplete System.Action

StartValueAnimation(float[], Color[], Color[], Animation)

Section titled “StartValueAnimation(float[], Color[], Color[], Animation)”
public void StartValueAnimation(float[] previousValues, Color[] previousColors, Color[] currentColors, Animation animation)

Starts a value animation from previous values to current values. Used when data changes and the chart has a non-null ChartGuru.Chart.Animation.

Parameters

Name Type
previousValues System.Single[]
previousColors UnityEngine.Color[]
currentColors UnityEngine.Color[]
animation ChartGuru.Animation
public void CompleteMorph()

Finishes the active morph immediately and applies the target chart as the current state.

public void CancelMorph()

Stops the active morph and keeps the chart at its current interpolated presentation.

public bool TryGetCurrentColor(int index, out Color color)

Attempts to retrieve current color without throwing when it is unavailable.

Parameters

Name Type
index System.Int32
color UnityEngine.Color

Returns

System.Boolean

public void Dispose()

Releases resources owned by this Chart Morpher; callers should not use the instance afterward.

public MorphState State { get; }

Returns

ChartGuru.MorphState

public float Progress { get; }

Returns

System.Single

public float EasedProgress { get; }

Eased progress in [0, 1] (may briefly overshoot for spring curves). Use for domain/grid animation.

Returns

System.Single

public ChartType SourceType { get; }

Returns

ChartGuru.ChartType

public ChartType TargetType { get; }

Returns

ChartGuru.ChartType

public bool IsMorphing { get; }

Returns

System.Boolean

public bool IsTypeMorph { get; }

True while a chart-type transition is in progress (source and target types differ).

Returns

System.Boolean

public ChartMorphStyle MorphStyle { get; }

Visual style the renderer should use for the ongoing type morph.

Returns

ChartGuru.ChartMorphStyle

public NativeArray<float2> CurrentPositions { get; }

Returns

Unity.Collections.NativeArray{Unity.Mathematics.float2}

public NativeArray<float> CurrentValues { get; }

Returns

Unity.Collections.NativeArray{System.Single}

public bool HasAnimatedColors { get; }

Returns

System.Boolean

public Vector2 SourceXDomain { get; }

Returns

UnityEngine.Vector2

public Vector2 SourceYDomain { get; }

Returns

UnityEngine.Vector2

public bool IsEntryAnimation { get; }

True while the in-progress value animation began with no previous values (i.e. it was triggered by ChartGuru.Chart.ReplayEntryAnimation(System.Nullable%7bChartGuru.Animation%7d)). Renderers can use this to opt into kind-specific entry-only motion modifiers (alpha fade, scale-in, slide-in, color lerp from theme background, …) that would look strange during ordinary data-change animations.

Returns

System.Boolean

public event Action<ChartMorpher> OnMorphStarted

Raised after source and target geometry are prepared and morph playback begins.

Returns

System.Action{ChartGuru.ChartMorpher}

public event Action<ChartMorpher, float> OnMorphProgress

Raised with normalized progress while an active morph advances.

Returns

System.Action{ChartGuru.ChartMorpher,System.Single}

public event Action<ChartMorpher> OnMorphComplete

Raised after the target chart state has been fully applied.

Returns

System.Action{ChartGuru.ChartMorpher}