ChartMorpher
public class ChartMorpherDrives value and chart-type transitions. Interpolates previous-to-current mark values via a Burst job using an ChartGuru.Animation curve.
Constructors
Section titled “Constructors”
ChartMorpher(Chart)
Section titled “ChartMorpher(Chart)”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 |
Methods
Section titled “Methods”
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 |
CompleteMorph()
Section titled “CompleteMorph()”public void CompleteMorph()Finishes the active morph immediately and applies the target chart as the current state.
CancelMorph()
Section titled “CancelMorph()”public void CancelMorph()Stops the active morph and keeps the chart at its current interpolated presentation.
TryGetCurrentColor(int, out Color)
Section titled “TryGetCurrentColor(int, out Color)”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
Dispose()
Section titled “Dispose()”public void Dispose()Releases resources owned by this Chart Morpher; callers should not use the instance afterward.
Properties
Section titled “Properties”
public MorphState State { get; }Returns
ChartGuru.MorphState
Progress
Section titled “Progress”public float Progress { get; }Returns
System.Single
EasedProgress
Section titled “EasedProgress”public float EasedProgress { get; }Eased progress in [0, 1] (may briefly overshoot for spring curves). Use for domain/grid animation.
Returns
System.Single
SourceType
Section titled “SourceType”public ChartType SourceType { get; }Returns
ChartGuru.ChartType
TargetType
Section titled “TargetType”public ChartType TargetType { get; }Returns
ChartGuru.ChartType
IsMorphing
Section titled “IsMorphing”public bool IsMorphing { get; }Returns
System.Boolean
IsTypeMorph
Section titled “IsTypeMorph”public bool IsTypeMorph { get; }True while a chart-type transition is in progress (source and target types differ).
Returns
System.Boolean
MorphStyle
Section titled “MorphStyle”public ChartMorphStyle MorphStyle { get; }Visual style the renderer should use for the ongoing type morph.
Returns
ChartGuru.ChartMorphStyle
CurrentPositions
Section titled “CurrentPositions”public NativeArray<float2> CurrentPositions { get; }Returns
Unity.Collections.NativeArray{Unity.Mathematics.float2}
CurrentValues
Section titled “CurrentValues”public NativeArray<float> CurrentValues { get; }Returns
Unity.Collections.NativeArray{System.Single}
HasAnimatedColors
Section titled “HasAnimatedColors”public bool HasAnimatedColors { get; }Returns
System.Boolean
SourceXDomain
Section titled “SourceXDomain”public Vector2 SourceXDomain { get; }Returns
UnityEngine.Vector2
SourceYDomain
Section titled “SourceYDomain”public Vector2 SourceYDomain { get; }Returns
UnityEngine.Vector2
IsEntryAnimation
Section titled “IsEntryAnimation”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
Events
Section titled “Events”
OnMorphStarted
Section titled “OnMorphStarted”public event Action<ChartMorpher> OnMorphStartedRaised after source and target geometry are prepared and morph playback begins.
Returns
System.Action{ChartGuru.ChartMorpher}
OnMorphProgress
Section titled “OnMorphProgress”public event Action<ChartMorpher, float> OnMorphProgressRaised with normalized progress while an active morph advances.
Returns
System.Action{ChartGuru.ChartMorpher,System.Single}
OnMorphComplete
Section titled “OnMorphComplete”public event Action<ChartMorpher> OnMorphCompleteRaised after the target chart state has been fully applied.
Returns
System.Action{ChartGuru.ChartMorpher}