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.

A single-point series draws no visible path (M x y has no length), so a series shorter than two points paints a point marker instead of nothing. [points] controls this: 'auto' (default) marks only the one-datum case, 'always' marks every datum, 'never' suppresses it.

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#

Providers#

CNGX_CHART_LAYER
useExisting CngxLine

Relationships

Index#

Inputs#

default (d: T) => Number(d)
color#string | null
input()
default null
input()
default 'linear'
data#readonly T[] | undefined
input()
points#"auto" | "always" | "never"
input()

Point-marker mode. 'auto' (default) draws a marker only when the resolved series has exactly one datum - the frame a warming buffer passes through on every reload, which paints nothing otherwise. 'always' marks every datum; 'never' suppresses markers.

default 'auto'
strokeWidth#number | string | null
input()
default null

Instance Properties#

ctx#unknown
ProtectedReadonly
injectChartContext('CngxLine')