JsonChartDataSource
public sealed class JsonChartDataSource : ChartFileDataSourceBase, IChartGuruElementDataSource, IChartDataSourceReads 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.
Methods
Section titled “Methods”
LoadFromText(string)
Section titled “LoadFromText(string)”public void LoadFromText(string jsonText)Set inline JSON text and immediately refresh. Convenience shortcut for
SourceMode = InlineText; InlineText = …; Refresh();.
Parameters
| Name | Type |
|---|---|
jsonText |
System.String |
LoadAsset(TextAsset)
Section titled “LoadAsset(TextAsset)”public void LoadAsset(TextAsset asset)Set a TextAsset source and immediately refresh. Convenience shortcut for
SourceMode = TextAsset; TextAsset = …; Refresh();.
Parameters
| Name | Type |
|---|---|
asset |
UnityEngine.TextAsset |
LoadText()
Section titled “LoadText()”protected override string LoadText()Subclasses override to obtain the raw text payload synchronously. Return an empty string to signal “no data”.
Returns
System.String
ParseToTabular(string)
Section titled “ParseToTabular(string)”protected override ChartTabularData ParseToTabular(string rawText)Convert raw text to a ChartGuru.ChartTabularData. Implemented per source (CSV vs JSON).
Parameters
| Name | Type |
|---|---|
rawText |
System.String |
Returns
ChartGuru.ChartTabularData
Constructors
Section titled “Constructors”
JsonChartDataSource()
Section titled “JsonChartDataSource()”public JsonChartDataSource()Properties
Section titled “Properties”
SourceMode
Section titled “SourceMode”public ChartFileSourceMode SourceMode { get; set; }Returns
ChartGuru.ChartFileSourceMode
TextAsset
Section titled “TextAsset”public TextAsset TextAsset { get; set; }Returns
UnityEngine.TextAsset
ProjectPath
Section titled “ProjectPath”public string ProjectPath { get; set; }Returns
System.String
AbsolutePath
Section titled “AbsolutePath”public string AbsolutePath { get; set; }Returns
System.String
StreamingAssetsPath
Section titled “StreamingAssetsPath”public string StreamingAssetsPath { get; set; }Returns
System.String
InlineText
Section titled “InlineText”public string InlineText { get; set; }Returns
System.String
RootSelector
Section titled “RootSelector”public string RootSelector { get; set; }Returns
System.String