JsonChartDataSource
[AddComponentMenu("ChartGuru/Data Sources/JSON Chart Data Source")][DisallowMultipleComponent]public sealed class JsonChartDataSource : ChartFileDataSourceBase, 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.
Properties
Section titled “Properties”
SourceMode
Section titled “SourceMode”public ChartFileSourceMode SourceMode { get; set; }No description is available for this member.
Returns
ChartGuru.ChartFileSourceMode — No return description is available.
TextAsset
Section titled “TextAsset”public TextAsset TextAsset { get; set; }No description is available for this member.
Returns
UnityEngine.TextAsset — No return description is available.
ProjectPath
Section titled “ProjectPath”public string ProjectPath { get; set; }No description is available for this member.
Returns
System.String — No return description is available.
AbsolutePath
Section titled “AbsolutePath”public string AbsolutePath { get; set; }No description is available for this member.
Returns
System.String — No return description is available.
StreamingAssetsPath
Section titled “StreamingAssetsPath”public string StreamingAssetsPath { get; set; }No description is available for this member.
Returns
System.String — No return description is available.
InlineText
Section titled “InlineText”public string InlineText { get; set; }No description is available for this member.
Returns
System.String — No return description is available.
RootSelector
Section titled “RootSelector”public string RootSelector { get; set; }No description is available for this member.
Returns
System.String — No return description is available.
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 | Description |
|---|---|---|
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 | Description |
|---|---|---|
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 — No return description is available.
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 | Description |
|---|---|---|
rawText |
System.String |
Returns
ChartGuru.ChartTabularData — No return description is available.