createChartRendererController
projects/common/chart/renderer/chart-renderer-controller.ts
Description#
Owns the renderer mount / destroy / paint reactive lifecycle so the chart shell holds no rendering brain. Installs two effects:
- mount - tracks
mode(); on change, destroys the previous backend, builds the new one viafactory, mounts it, and seeds the first paint. - paint - tracks
geometries()and the (structurally-deduped) dimensions; repaints on every geometry emission and invalidates the backend's color cache when the dimensions actually change.
Both effects wrap their imperative renderer calls in untracked() so
the renderer's own signal reads never feed back into the effect graph.
The dimensions are tracked through a linkedSignal guarded by
dimensionsEqual, so a resize observer re-emitting the same
width/height literal does not trigger a redundant cache invalidation.
Must run in an injection context (the chart shell calls it from a field
initialiser / constructor). Ships as a plain create* factory the shell
calls directly - no DI token, since the only second consumer today is a
test double, which injects a fake factory through the deps.
Signature#
createChartRendererController(deps: ChartRendererControllerDeps)Parameters#
Returns#
CngxChartRendererController