Skip to content

ChartDataSourceBase

ClassChartGuruChartGuru
[ExecuteAlways]
public abstract class ChartDataSourceBase : MonoBehaviour, IChartDataSource

Abstract base class for chart data sources. Shared functionality for populating ChartGraphic with data.

[Header("Target Chart")]
[Tooltip("Target ChartGraphic (2D) to populate. If null, discovers charts on same GameObject or in child hierarchy.")]
[SerializeField]
protected ChartGraphic _targetChart

No description is available for this member.

Returns

ChartGuru.ChartGraphic — No return description is available.

[Tooltip("Optional target 3D host (e.g. Chart3DComponent). Typed as Component to avoid a hard dependency on the ChartGuru.3D add-on.")]
[SerializeField]
protected Component _targetChart3D

No description is available for this member.

Returns

UnityEngine.Component — No return description is available.

public ChartGraphic TargetChart { get; set; }

The target ChartGraphic to populate. Setting this explicitly overrides hierarchy-based discovery.

Returns

ChartGuru.ChartGraphic — No return description is available.

public Component TargetChart3D { get; set; }

Optional 3D host (e.g. Chart3DComponent). Set this when the data source lives alongside a 3D chart; the 2D and 3D targets can coexist so the same data source populates both views when a scene contains each.

Returns

UnityEngine.Component — No return description is available.

protected virtual void Awake()

No description is available for this member.

protected virtual void Start()

No description is available for this member.

protected virtual void OnEnable()

No description is available for this member.

protected virtual void OnValidate()

No description is available for this member.

protected List<ChartGraphic> ResolveTargetCharts()

Resolve target charts with the following priority:

  1. Explicit _targetChart (inspector-set) — just that one.
  2. ChartGraphic on same GameObject — just that one.
  3. All child ChartGraphic components that don’t have their own local ChartDataSourceBase.

Returns

System.Collections.Generic.List{ChartGuru.ChartGraphic} — No return description is available.

public List<ChartGraphic> GetResolvedTargetCharts()

Public accessor for ChartGuru.ChartDataSourceBase.ResolveTargetCharts so editor tooling (Quick Sample buttons) can apply the sample’s chart type to the connected chart when there is exactly one — without forcing the user to also assign the inspector field.

Returns

System.Collections.Generic.List{ChartGuru.ChartGraphic} — No return description is available.

protected List<IChart3DHost> ResolveTarget3DHosts()

Resolve 3D host targets for this data source. Priority:

  1. Explicit ChartGuru.ChartDataSourceBase._targetChart3D (must implement ChartGuru.IChart3DHost).
  2. Any component on the same GameObject implementing ChartGuru.IChart3DHost.
  3. Any ChartGuru.IChart3DHost in children that doesn’t have its own local data source. Returns an empty list when no host is present — safe to call on pure 2D hierarchies.

Returns

System.Collections.Generic.List{ChartGuru.IChart3DHost} — No return description is available.

protected void RaiseDataChanged()

Fire ChartGuru.ChartDataSourceBase.DataChanged. Subclasses call this at the end of their ChartGuru.ChartDataSourceBase.ApplyData override.

BuildMarksForChartType(ChartType, ChartAuthoringStyleOptions)

Section titled “BuildMarksForChartType(ChartType, ChartAuthoringStyleOptions)”
public virtual List<IChartMark> BuildMarksForChartType(ChartType chartType, ChartAuthoringStyleOptions style)

Build marks shaped for the requested chartType and style. Default implementation returns an empty list; subclasses override to provide their data. The base class sets ChartGuru.ChartDataSourceBase._activeStyleOverride for the duration of the call so existing Get* helpers transparently pick up the UITK style.

Parameters

Name Type Description
chartType ChartGuru.ChartType
style ChartGuru.ChartAuthoringStyleOptions

Returns

System.Collections.Generic.List{ChartGuru.IChartMark} — No return description is available.

public abstract void ApplyData()

Apply the configured data to the target chart. Subclasses must implement this to provide their specific data.

protected void ApplyDataImmediate()

Apply data immediately without EditorApplication.delayCall. Used during streaming to ensure chart and text labels update synchronously.

protected float GetCornerRadius()

Get the corner radius from the target chart (or active style override).

Returns

System.Single — No return description is available.

protected MarkStackingMethod GetStackingMethod()

Get the stacking method from the target chart (or active style override).

Returns

ChartGuru.MarkStackingMethod — No return description is available.

protected InterpolationMethod GetInterpolation()

Get the interpolation method from the target chart (or active style override).

Returns

ChartGuru.InterpolationMethod — No return description is available.

protected float GetLineWidth()

Get the line width from the target chart (or active style override).

Returns

System.Single — No return description is available.

protected float GetInnerRadius()

Get the donut inner radius from the target chart (or active style override).

Returns

System.Single — No return description is available.

protected float GetAngularInset()

Get the sector pad angle from the target chart (or active style override).

Returns

System.Single — No return description is available.

protected BarLayout? GetBarLayout()

No description is available for this member.

Returns

System.Nullable{ChartGuru.BarLayout} — No return description is available.

protected MarkDimension GetBarWidth()

No description is available for this member.

Returns

ChartGuru.MarkDimension — No return description is available.

protected MarkDimension GetBarHeight()

No description is available for this member.

Returns

ChartGuru.MarkDimension — No return description is available.

protected ForegroundStyleMode GetForegroundStyleMode()

No description is available for this member.

Returns

ChartGuru.ForegroundStyleMode — No return description is available.

protected float GetHeatMapCellPadding()

No description is available for this member.

Returns

System.Single — No return description is available.

protected float GetHeatMapCornerRadius()

No description is available for this member.

Returns

System.Single — No return description is available.

CreateSingleSeriesMarks(ChartType, List, string, Color)

Section titled “CreateSingleSeriesMarks(ChartType, List, string, Color)”
protected List<IChartMark> CreateSingleSeriesMarks(ChartType chartType, List<ChartDataEntry> dataPoints, string seriesName, Color primaryColor)

Create marks for single-series data.

Parameters

Name Type Description
chartType ChartGuru.ChartType
dataPoints System.Collections.Generic.List{ChartGuru.ChartDataEntry}
seriesName System.String
primaryColor UnityEngine.Color

Returns

System.Collections.Generic.List{ChartGuru.IChartMark} — No return description is available.

protected List<IChartMark> CreateMultiSeriesMarks(ChartType chartType, List<ChartDataSeries> dataSeries)

Create marks for multi-series data.

Parameters

Name Type Description
chartType ChartGuru.ChartType
dataSeries System.Collections.Generic.List{ChartGuru.ChartDataSeries}

Returns

System.Collections.Generic.List{ChartGuru.IChartMark} — No return description is available.

protected float ResolveXPosition(ChartDataEntry entry, int fallbackIndex)

No description is available for this member.

Parameters

Name Type Description
entry ChartGuru.ChartDataEntry
fallbackIndex System.Int32

Returns

System.Single — No return description is available.

ResolveXPosition(ChartDataEntry, int, bool)

Section titled “ResolveXPosition(ChartDataEntry, int, bool)”
protected float ResolveXPosition(ChartDataEntry entry, int fallbackIndex, bool labelIsAmbiguous)

No description is available for this member.

Parameters

Name Type Description
entry ChartGuru.ChartDataEntry
fallbackIndex System.Int32
labelIsAmbiguous System.Boolean

Returns

System.Single — No return description is available.

CreateMark(ChartType, float, float, string, Color, LinearGradientStyle)

Section titled “CreateMark(ChartType, float, float, string, Color, LinearGradientStyle)”
protected IChartMark CreateMark(ChartType chartType, float xValue, float value, string label, Color colorOverride, LinearGradientStyle gradientOverride)

Create a chart mark of the appropriate type.

Parameters

Name Type Description
chartType ChartGuru.ChartType
xValue System.Single
value System.Single
label System.String
colorOverride UnityEngine.Color
gradientOverride ChartGuru.LinearGradientStyle

Returns

ChartGuru.IChartMark — No return description is available.

CreateMark(ChartType, float, float, string, Color, LinearGradientStyle, ChartDataEntry)

Section titled “CreateMark(ChartType, float, float, string, Color, LinearGradientStyle, ChartDataEntry)”
protected IChartMark CreateMark(ChartType chartType, float xValue, float value, string label, Color colorOverride, LinearGradientStyle gradientOverride, ChartDataEntry entry)

Overload that threads the originating ChartGuru.ChartDataEntry down to ChartGuru.ChartMarkFactory.CreateMark(ChartGuru.ChartType%2cSystem.Single%2cSystem.Single%2cSystem.String%2cUnityEngine.Color%2cChartGuru.LinearGradientStyle%2cChartGuru.ChartAuthoringStyleOptions%2cChartGuru.ChartDataEntry) so OHLC-bearing entries can be turned into real candlestick marks.

Parameters

Name Type Description
chartType ChartGuru.ChartType
xValue System.Single
value System.Single
label System.String
colorOverride UnityEngine.Color
gradientOverride ChartGuru.LinearGradientStyle
entry ChartGuru.ChartDataEntry

Returns

ChartGuru.IChartMark — No return description is available.

public event Action DataChanged

Raised after ChartGuru.ChartDataSourceBase.ApplyData completes. Consumed primarily by the UI Toolkit pipeline (ChartGuruElement) to re-pull marks.

Returns

System.Action — No return description is available.