Skip to main content
cngx-src documentation

injectChartContext

Functioncommon/chartv0.1.0

projects/common/chart/chart/chart-context.ts

Description#

Inject the parent chart's reactive context. Throws a clear dev-mode error when the consumer is not mounted as a content child of <cngx-chart>. The consumerName argument is interpolated into the error message so the consumer-class name surfaces at the call site rather than a generic guard string.

Use it from custom layer directives mounted on <svg:g> hosts to read plot, the scales and renderSvg the same way the built-in layer atoms do.

Signature#

injectChartContext(consumerName: string)

Parameters#

@paramconsumerNamestring

Returns#

CngxChartContext