Documentation / @finchart/core / index / DataManager
Interface: DataManager<T>
Defined in: packages/core/src/data/types.ts:306
Type Parameters
T
T extends BaseDataPoint = BaseDataPoint
Methods
adoptHeadRetainingTail()?
optionaladoptHeadRetainingTail(head,retainedFrom):void
Defined in: packages/core/src/data/types.ts:345
Replaces the head and retains this manager's previously accepted tail starting at retainedFrom. This is the narrow landing door for a declared incremental derivation: the manager, not its caller, owns the unvalidated suffix, so only head and its seam need a new check.
Optional — a manager without it simply keeps declared derivations on the full setData route.
Parameters
head
T[]
retainedFrom
number
Returns
void
append()
append(
points):void
Defined in: packages/core/src/data/types.ts:333
Appends the latest data to the end. Checked only within the chunk plus at the seam — a full check is what setData (a new dataset) is for, and if one tick's cost scaled with history size, a real-time chart couldn't work. Data that breaks the contract still stops with the same DataError.
Parameters
points
T[]
Returns
void
getVisibleData()
getVisibleData(
viewport):DataView<T>
Defined in: packages/core/src/data/types.ts:362
Parameters
viewport
Returns
DataView<T>
getVisiblePlaced()?
optionalgetVisiblePlaced(viewport):VisiblePlaced<T>
Defined in: packages/core/src/data/types.ts:370
What drawing gets: getVisibleData's points plus the one point just outside the window on each side (so lines reach the plot edges and edge-cut candles still draw), with places. This gate is optional — if absent, drawing gets getVisibleData alone and finds places itself, and lines stop at the last point inside the view.
Parameters
viewport
Returns
VisiblePlaced<T>
getXRange()
getXRange():
Range|null
Defined in: packages/core/src/data/types.ts:380
The range by CoordinateAccessor.getX — the material for the x-axis domain. The y-axis domain is up to the Series (a single point for a line, a low-to-high span for a candle).
null if empty — once data is per-series, the x domain is the union of the managers, and if an empty manager returned {0, 0}, that zero would bleed into the union.
Returns
Range | null
merge()?
optionalmerge(points):void
Defined in: packages/core/src/data/types.ts:354
The reconciliation door, optional the way the landing doors are: a manager without it is handed the merged array through setData, which is correct and costs a full validation. With it, points are merged by x — every x they name is theirs, every x they do not name keeps what it had — and only the incoming chunk and its seam are checked. points must be sorted the way append's are.
Parameters
points
T[]
Returns
void
prepend()
prepend(
points):void
Defined in: packages/core/src/data/types.ts:335
Prepends past data to the front. Checking rules mirror append.
Parameters
points
T[]
Returns
void
read()
read():
DataView<T>
Defined in: packages/core/src/data/types.ts:315
The whole history, right now. A live borrowed view — don't mutate it (mutation doesn't produce a new reference, which breaks the Source contract).
This gate is what makes history singly owned — if another place held the same history separately, an update could land on only one of them.
Returns
DataView<T>
replaceLast()
replaceLast(
point):void
Defined in: packages/core/src/data/types.ts:361
Swaps out the last point — the tick of a bar in progress. DataError if the new point's x is less than the x of the point before it (second-to-last) — or equal to it, when the accessor declares uniqueX. If empty, it becomes the first point.
Parameters
point
T
Returns
void
setData()
setData(
data):void
Defined in: packages/core/src/data/types.ts:325
Must be x-ascending. A repeated x is fine unless the accessor declares uniqueX (bars do) — then it is a duplicate-x rejection.
Needed because slicing is a binary search, and data that breaks this gets drawn wrong regardless — the line follows array order and decimation buckets by index.
Parameters
data
T[]
Returns
void