Skip to main content
cngx-src documentation

CngxLine

ComponentPrimaryOnPushNo encapsulationv0.1.0

projects/common/chart/layers/line.component.ts

Import#

import { CngxLine } from '@cngx/common/chart'

Description#

Line layer atom. Renders a single SVG <path> connecting the data points projected through the parent chart's scales. Reads scales from CNGX_CHART_CONTEXT, NOT from a parent class.

Attribute-selector on <svg:g> — the host element IS the SVG group. Element selectors create XHTML-namespaced custom elements inside SVG, which break layout for the namespaced children. Apply this directive on an <svg:g> host instead.

The d string is cascade-guarded with string equality on its computed so downstream effects only re-run when the path geometry actually changes. The createPathBuilder cache provides the compute guard — same (data, xScale, yScale) triple by reference skips the per-datapoint projection work.

https://cngxjs.github.io/cngx/examples/#/common/chart/primitives/async-state-machine-on-the-primitive https://cngxjs.github.io/cngx/examples/#/common/chart/primitives/combo-bars-moving-average-line https://cngxjs.github.io/cngx/examples/#/common/chart/primitives/line-area-threshold-band https://cngxjs.github.io/cngx/examples/#/common/chart/primitives/multi-series-line-axis-labels-legend https://cngxjs.github.io/cngx/examples/#/common/chart/primitives/responsive-fills-parent-width https://cngxjs.github.io/cngx/examples/#/common/chart/primitives/scatter-with-performance-zones https://cngxjs.github.io/cngx/examples/#/common/chart/primitives/time-series-with-threshold-zones

Metadata#

Relationships

Index#

Inputs#

default (d: T) => Number(d)
color#string | null
input()
default null
input()
default 'linear'
data#readonly T[] | undefined
input()
strokeWidth#number | string | null
input()
default null