WebChartDataSource
public class WebChartDataSource : ChartFileDataSourceBase, IChartGuruElementDataSource, IChartDataSourcePolls an HTTP/HTTPS endpoint on a configurable interval, decodes the response as CSV or JSON, and pushes the result through the standard mapping pipeline. Includes:
Methods
Section titled “Methods”
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
LoadPayloadAsync(CancellationToken)
Section titled “LoadPayloadAsync(CancellationToken)”protected override Task<ChartFileDataSourceBase.ChartTextPayload> LoadPayloadAsync(CancellationToken ct)Loads one immutable response payload. Network sources can attach response metadata here.
Parameters
| Name | Type |
|---|---|
ct |
System.Threading.CancellationToken |
Returns
System.Threading.Tasks.Task{ChartGuru.ChartFileDataSourceBase.ChartTextPayload}
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
ParsePayloadToTabular(ChartTextPayload)
Section titled “ParsePayloadToTabular(ChartTextPayload)”protected override ChartTabularData ParsePayloadToTabular(ChartFileDataSourceBase.ChartTextPayload payload)Parses one response payload without relying on mutable shared response state.
Parameters
| Name | Type |
|---|---|
payload |
ChartGuru.ChartFileDataSourceBase.ChartTextPayload |
Returns
ChartGuru.ChartTabularData
ParseResponse(string, string)
Section titled “ParseResponse(string, string)”protected virtual ChartTabularData ParseResponse(string rawText, string contentType)Parses one immutable HTTP response and its matching content type.
Parameters
| Name | Type |
|---|---|
rawText |
System.String |
contentType |
System.String |
Returns
ChartGuru.ChartTabularData
ApplyData()
Section titled “ApplyData()”public override void ApplyData()Sync entry points (inspector “Fetch Now” button, ApplyData, Refresh) all
route through the async pipeline because ChartGuru.WebChartDataSource.LoadText on a
network source can’t return a synchronous string. Without this override
the inherited ChartGuru.ChartFileDataSourceBase.ApplyData would call
ChartGuru.WebChartDataSource.LoadText (returns “”) and silently do nothing.
Load(string)
Section titled “Load(string)”public void Load(string url)Set a URL and immediately fetch. Convenience shortcut for
Url = …; Refresh();.
Parameters
| Name | Type |
|---|---|
url |
System.String |
ForceFetch()
Section titled “ForceFetch()”public void ForceFetch()Unconditional fetch — bypasses the ChartGuru.WebChartDataSource.RunInEditMode guard.
Used by the inspector “Fetch Now” button so the user can always pull
fresh data on demand.
SetRuntimeHeader(string, string)
Section titled “SetRuntimeHeader(string, string)”public void SetRuntimeHeader(string headerName, string value)Adds or updates a header whose value exists only in memory for this component instance.
Parameters
| Name | Type |
|---|---|
headerName |
System.String |
value |
System.String |
ClearRuntimeHeaderValues()
Section titled “ClearRuntimeHeaderValues()”public void ClearRuntimeHeaderValues()Clears all nonserialized runtime header values.
Refresh()
Section titled “Refresh()”public override void Refresh()Drive a synchronous load → parse → push cycle. Equivalent to
ChartGuru.ChartFileDataSourceBase.ApplyData; provided as a more discoverable alias.
OnRefreshSucceeded()
Section titled “OnRefreshSucceeded()”protected override void OnRefreshSucceeded()Called on the Unity thread after a successful refresh.
OnRefreshFailed(Exception)
Section titled “OnRefreshFailed(Exception)”protected override void OnRefreshFailed(Exception exception)Called on the Unity thread after a failed refresh.
Parameters
| Name | Type |
|---|---|
exception |
System.Exception |
Constructors
Section titled “Constructors”
WebChartDataSource()
Section titled “WebChartDataSource()”public WebChartDataSource()Properties
Section titled “Properties”
public string Url { get; set; }Returns
System.String
Headers
Section titled “Headers”public List<WebChartDataSource.HttpHeader> Headers { get; }Returns
System.Collections.Generic.List{ChartGuru.WebChartDataSource.HttpHeader}
Format
Section titled “Format”public WebDataFormat Format { get; set; }Returns
ChartGuru.WebDataFormat
JsonRootSelector
Section titled “JsonRootSelector”public string JsonRootSelector { get; set; }Returns
System.String
PollIntervalSeconds
Section titled “PollIntervalSeconds”public float PollIntervalSeconds { get; set; }Returns
System.Single
RunInEditMode
Section titled “RunInEditMode”public bool RunInEditMode { get; set; }Returns
System.Boolean
AutoApplyInEditMode
Section titled “AutoApplyInEditMode”protected override bool AutoApplyInEditMode { get; }Whether this source should populate an edit-mode preview when enabled.
Returns
System.Boolean