Skip to content
EliteChart

appendLineBreak

Documentation


Documentation / @elitechart/core / appendLineBreak

code
function appendLineBreak(
   state, 
   raw, 
   opts): {
  newLines: readonly Bar[];
  state: LineBreakInternalState;
};

Defined in: series/line-break.ts:160

Append zero or one line for one new source bar. Returns the updated state plus the (possibly empty) emitted line. Pure / deterministic.

Parameters

state

| LineBreakInternalState | undefined

raw

Bar

opts

LineBreakOptions & { fixedDtFallback?: number; }

Returns

code
{
  newLines: readonly Bar[];
  state: LineBreakInternalState;
}

newLines

code
readonly newLines: readonly Bar[];

state

code
readonly state: LineBreakInternalState;

Example

code
let state: LineBreakInternalState | undefined;
for (const b of liveBars) {
  const r = appendLineBreak(state, b, { lineCount: 3 });
  state = r.state;
  if (r.newLines.length > 0) renderLines(r.newLines);
}