ChartComponent
public abstract class ChartComponent : MonoBehaviour, IChartHostBase of the chart hosts that live in the world outside a Canvas, such as Chart3DComponent. Like every
host it shows a ChartDefinition or a ChartAsset with bound data; the subclass draws
it. A ChartRaycaster on the camera brings it EventSystem pointer events for hover, tooltips,
selection and orbit. Show 2D charts with ChartGraphic, on a world-space Canvas to place them in
the world.
Methods
Section titled “Methods”
SetChart(Chart)
Section titled “SetChart(Chart)”public void SetChart(Chart chart)Shows a chart built in code. The chart is runtime state: it is not saved and replaces the definition until
ChartComponent.ClearChart() is called.
Parameters
| Name | Type |
|---|---|
chart | ChartGuru.Chart |
ClearChart()
Section titled “ClearChart()”public void ClearChart()Returns from a chart set in code to the definition.
SetData(ChartDataFrame, bool)
Section titled “SetData(ChartDataFrame, bool)”public void SetData(ChartDataFrame data, bool shapeChanged = true)Shows data 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
| Name | Type |
|---|---|
data | ChartGuru.ChartDataFrame |
shapeChanged | System.Boolean |
ClearData()
Section titled “ClearData()”public void ClearData()Returns from data set in code to the bound data.
Rebuild()
Section titled “Rebuild()”public void Rebuild()Recompiles the chart from the definition and its data now.
SetDirty()
Section titled “SetDirty()”public void SetDirty()Recompiles the chart from the definition and its data on the next update.
MorphTo(ChartType, ChartMorphStyle?)
Section titled “MorphTo(ChartType, ChartMorphStyle?)”public void MorphTo(ChartType type, ChartMorphStyle? style = null)Changes the chart type and morphs the live chart into it. Families with different layouts, such as bars and pies, switch without a morph. A chart set from code changes its own type.
Parameters
| Name | Type |
|---|---|
type | ChartGuru.ChartType |
style | System.Nullable{ChartGuru.ChartMorphStyle} |
ReplayEntryAnimation(Animation?)
Section titled “ReplayEntryAnimation(Animation?)”public void ReplayEntryAnimation(Animation? animation = null)Replays the entry animation, using the chart’s animation when none is given.
Parameters
| Name | Type |
|---|---|
animation | System.Nullable{ChartGuru.Animation} |
OnPointerDown(PointerEventData)
Section titled “OnPointerDown(PointerEventData)”public void OnPointerDown(PointerEventData eventData)Starts a press: a tap when released in place, an orbit or pinch when it moves.
Parameters
| Name | Type |
|---|---|
eventData | UnityEngine.EventSystems.PointerEventData |
OnPointerUp(PointerEventData)
Section titled “OnPointerUp(PointerEventData)”public void OnPointerUp(PointerEventData eventData)Ends a press, selecting the mark or value under a tap or finishing a drag.
Parameters
| Name | Type |
|---|---|
eventData | UnityEngine.EventSystems.PointerEventData |
OnPointerMove(PointerEventData)
Section titled “OnPointerMove(PointerEventData)”public void OnPointerMove(PointerEventData eventData)Tracks hover, which drives highlights and tooltips.
Parameters
| Name | Type |
|---|---|
eventData | UnityEngine.EventSystems.PointerEventData |
OnPointerExit(PointerEventData)
Section titled “OnPointerExit(PointerEventData)”public void OnPointerExit(PointerEventData eventData)Clears the hover target when the pointer leaves the chart.
Parameters
| Name | Type |
|---|---|
eventData | UnityEngine.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
| Name | Type |
|---|---|
eventData | UnityEngine.EventSystems.PointerEventData |
OnDrag(PointerEventData)
Section titled “OnDrag(PointerEventData)”public void OnDrag(PointerEventData eventData)Moves a pressed pointer, which orbits the chart or feeds its custom drag gesture.
Parameters
| Name | Type |
|---|---|
eventData | UnityEngine.EventSystems.PointerEventData |
OnScroll(PointerEventData)
Section titled “OnScroll(PointerEventData)”public void OnScroll(PointerEventData eventData)Zooms the view, or feeds the chart’s magnification gesture.
Parameters
| Name | Type |
|---|---|
eventData | UnityEngine.EventSystems.PointerEventData |
Constructors
Section titled “Constructors”
ChartComponent()
Section titled “ChartComponent()”protected ChartComponent()Properties
Section titled “Properties”
Content
Section titled “Content”public ChartHostContent Content { get; }What this component shows: an inline definition or a chart asset, plus bound data.
Returns
ChartGuru.ChartHostContent
Definition
Section titled “Definition”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
component that uses a chart asset returns its own copy, like Renderer.material, so runtime edits
never change the asset. Call ChartComponent.Rebuild() after editing it.
Returns
ChartGuru.ChartDefinition
DefinitionAsset
Section titled “DefinitionAsset”public ChartAsset DefinitionAsset { get; set; }Shared chart asset; assigning one replaces the inline definition until it is cleared.
Returns
ChartGuru.ChartAsset
InlineDefinition
Section titled “InlineDefinition”public ChartDefinition InlineDefinition { get; set; }The definition stored with this component, used when no asset is assigned.
Returns
ChartGuru.ChartDefinition
DataAsset
Section titled “DataAsset”public ChartDataAsset DataAsset { get; set; }Shared data table bound to this chart.
Returns
ChartGuru.ChartDataAsset
Timing
Section titled “Timing”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, selection and viewport control for the runtime chart.
Returns
ChartGuru.ChartProxy
HasRuntimeChart
Section titled “HasRuntimeChart”public bool HasRuntimeChart { get; }True while a chart set from code replaces the definition.
Returns
System.Boolean
IsShowingPreviewData
Section titled “IsShowingPreviewData”public bool IsShowingPreviewData { get; }True while generated preview data is shown because nothing is bound and the definition has no rows.
Returns
System.Boolean
ChartType
Section titled “ChartType”public ChartType ChartType { get; set; }The displayed chart type. Setting it morphs the live chart when the families allow it.
Returns
ChartGuru.ChartType
Events
Section titled “Events”
OnDataPointClicked
Section titled “OnDataPointClicked”public event Action<int, DataPoint> OnDataPointClickedRaised with the mark index and data point after a mark is clicked.
Returns
System.Action{System.Int32,ChartGuru.DataPoint}
OnDataPointSelected
Section titled “OnDataPointSelected”public event Action<int, DataPoint> OnDataPointSelectedRaised with the mark index and data point after selection changes.
Returns
System.Action{System.Int32,ChartGuru.DataPoint}
OnDataPointHovered
Section titled “OnDataPointHovered”public event Action<int, DataPoint> OnDataPointHoveredRaised with the mark index and data point when the hover target changes.
Returns
System.Action{System.Int32,ChartGuru.DataPoint}
OnSelectionCleared
Section titled “OnSelectionCleared”public event Action OnSelectionClearedRaised after the current selection is cleared.
Returns
System.Action
OnTooltipChanged
Section titled “OnTooltipChanged”public event Action<ChartTooltipState> OnTooltipChangedRaised whenever tooltip visibility, content, pin state or the semantic hit changes.
Returns
System.Action{ChartGuru.ChartTooltipState}