Skip to main content
cngx-src documentation

createPathBuilder

Functioncommon/chart/path

projects/common/chart/path/path-builder.ts

Description#

Pure-TS path builder with single-slot LRU memo on (data, xScale, yScale) reference identity. Pure TS, no Angular dep. Compute guard only - does not know about signals or equal functions; the d computed in <cngx-line> carries the cascade guard separately.

The cache returns the previous result when all three inputs are reference-equal to the previous call. Any reference mismatch triggers a rebuild and updates the slot.

Each call to createPathBuilder returns a fresh builder with its own lastData / lastX / lastY slots - there is no cross-call / cross-consumer state. The cascade guard for layer atoms is the equal: (a, b) => a === b on the builder computed; combined with Angular signals' default behaviour of skipping re-emissions when the inputs to the computed are unchanged, two consecutive cascade ticks with the same (y, x, curve) produce the same builder instance.

Signature#

createPathBuilder(opts: PathBuilderOptions)

Parameters#

Returns#

PathBuilder