charton API / @chart-on/core / index / DataController
Class: DataController
Defined in: packages/core/src/data/controller.ts:86
Loads a data source into the chart: initial bars, older pages on demand, live bars, and a small per symbol + interval cache. Every switch bumps a generation counter and aborts in-flight requests, so late answers are ignored.
Constructors
Constructor
new DataController(
source,target,emit,options?):DataController
Defined in: packages/core/src/data/controller.ts:146
Parameters
source
target
emit
Emit
options?
Partial<DataControllerOptions> = {}
Returns
DataController
Properties
dropped
dropped:
number=0
Defined in: packages/core/src/data/controller.ts:99
Live bars dropped as invalid or older than the last bar.
interval
interval:
Interval|null=null
Defined in: packages/core/src/data/controller.ts:89
options
readonlyoptions:DataControllerOptions
Defined in: packages/core/src/data/controller.ts:100
source
readonlysource:DataSource
Defined in: packages/core/src/data/controller.ts:147
symbol
symbol:
SymbolInfo|null=null
Defined in: packages/core/src/data/controller.ts:88
Symbol and interval currently shown; null until the first load completes.
Accessors
connection
Get Signature
get connection():
FeedStatus|null
Defined in: packages/core/src/data/controller.ts:178
The source's last reported connection state; null if it never reported one.
Returns
FeedStatus | null
hasMoreHistory
Get Signature
get hasMoreHistory():
boolean
Defined in: packages/core/src/data/controller.ts:188
False once the source reported that no older bars exist.
Returns
boolean
initialLoad
Get Signature
get initialLoad():
Promise<void> |null
Defined in: packages/core/src/data/controller.ts:183
The setSymbol load in flight (the promise it returned), or null.
Returns
Promise<void> | null
loading
Get Signature
get loading():
boolean
Defined in: packages/core/src/data/controller.ts:168
Returns
boolean
quote
Get Signature
get quote():
Quote|null
Defined in: packages/core/src/data/controller.ts:159
The latest bid and ask the source's quotes sent for the current symbol; null before the first one and once another symbol starts loading.
Returns
Quote | null
requested
Get Signature
get requested():
Readonly<{interval:Interval;symbol:string; }> |null
Defined in: packages/core/src/data/controller.ts:95
Symbol and interval of the last setSymbol call, which may still be loading; the interval is the one actually loaded once the symbol turned out not to support the requested one. Null before the first call.
Returns
Readonly<{ interval: Interval; symbol: string; }> | null
showingSnapshot
Get Signature
get showingSnapshot():
boolean
Defined in: packages/core/src/data/controller.ts:164
Whether the bars on screen are a cached snapshot whose load has not landed, or failed.
Returns
boolean
stale
Get Signature
get stale():
boolean
Defined in: packages/core/src/data/controller.ts:173
True after an outage longer than maxGapFillSeconds, until a reload or full reset.
Returns
boolean
supportedIntervals
Get Signature
get supportedIntervals(): readonly
Interval[] |null
Defined in: packages/core/src/data/controller.ts:196
Intervals the current symbol supports: the entries of its intervals the chart can parse, or null when it lists none (any interval).
Returns
readonly Interval[] | null
Methods
clearCache()
clearCache(
symbol?,interval?):void
Defined in: packages/core/src/data/controller.ts:244
Forget cached bars: all of them, or those of one symbol and/or interval. The series on screen stays; switching back to it loads it afresh.
Parameters
symbol?
string
interval?
Returns
void
dispose()
dispose():
void
Defined in: packages/core/src/data/controller.ts:311
Stop live updates and in-flight requests.
Returns
void
loadMore()
loadMore():
Promise<boolean>
Defined in: packages/core/src/data/controller.ts:261
Prepend the next page of older bars; no-op once a page said atStart. Resolves to false when no page was loaded but asking again later may help: the request failed or was aborted, or the initial load was still running.
Returns
Promise<boolean>
reload()
reload():
Promise<void>
Defined in: packages/core/src/data/controller.ts:232
Load the last requested symbol and interval again without the cache, aborting requests in flight like a switch. Rejects when loading fails.
Returns
Promise<void>
setSymbol()
setSymbol(
symbol,interval):Promise<void>
Defined in: packages/core/src/data/controller.ts:207
Show symbol at interval, or at the nearest interval the symbol supports. Rejects when loading fails, and with an 'invalid-interval'ChartError before asking the source anything when the interval cannot be parsed; resolves early if superseded.
Parameters
symbol
string
interval
Returns
Promise<void>