Skip to content

JsonChartDataSource

ClassChartGuruChartGuru
[AddComponentMenu("ChartGuru/Data Sources/JSON Chart Data Source")]
[DisallowMultipleComponent]
public sealed class JsonChartDataSource : ChartFileDataSourceBase, IChartDataSource

Reads JSON from a TextAsset, project file, absolute path, StreamingAssets file, or an inline string and converts it to chart marks. Supports a JSONPath ChartGuru.JsonChartDataSource.RootSelector so deeply nested API responses (eg. $.data.timeseries[*]) can target the array of records directly.

Backed by Newtonsoft.Json (already shipped with Unity via com.unity.nuget.newtonsoft-json). Nested objects flatten one level with dot notation (ohlc.open), so financial-style payloads do not need pre-processing.

public ChartFileSourceMode SourceMode { get; set; }

No description is available for this member.

Returns

ChartGuru.ChartFileSourceMode — No return description is available.

public TextAsset TextAsset { get; set; }

No description is available for this member.

Returns

UnityEngine.TextAsset — No return description is available.

public string ProjectPath { get; set; }

No description is available for this member.

Returns

System.String — No return description is available.

public string AbsolutePath { get; set; }

No description is available for this member.

Returns

System.String — No return description is available.

public string StreamingAssetsPath { get; set; }

No description is available for this member.

Returns

System.String — No return description is available.

public string InlineText { get; set; }

No description is available for this member.

Returns

System.String — No return description is available.

public string RootSelector { get; set; }

No description is available for this member.

Returns

System.String — No return description is available.

public void LoadFromText(string jsonText)

Set inline JSON text and immediately refresh. Convenience shortcut for SourceMode = InlineText; InlineText = …; Refresh();.

Parameters

Name Type Description
jsonText System.String
public void LoadAsset(TextAsset asset)

Set a TextAsset source and immediately refresh. Convenience shortcut for SourceMode = TextAsset; TextAsset = …; Refresh();.

Parameters

Name Type Description
asset UnityEngine.TextAsset
protected override string LoadText()

Subclasses override to obtain the raw text payload synchronously. Return an empty string to signal “no data”.

Returns

System.String — No return description is available.

protected override ChartTabularData ParseToTabular(string rawText)

Convert raw text to a ChartGuru.ChartTabularData. Implemented per source (CSV vs JSON).

Parameters

Name Type Description
rawText System.String

Returns

ChartGuru.ChartTabularData — No return description is available.