Skip to main content
cngx-src documentation

CngxAxisDomain

Directivev0.1.0

projects/common/chart/axis/axis-domain.ts

Import#

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

Description#

Declares a scale domain to the parent <cngx-chart> without drawing anything.

A chart builds its xScale from whichever projected axis occupies a horizontal edge and its yScale from a vertical one. Usually that axis also draws ticks and labels, and [cngxAxis] is what you want. Sometimes the domain is all you need: a sparkline has no room for decoration, but its line still has to know that y runs 0 to 100.

<cngx-chart [data]="readings()">
  <svg:g cngxAxisDomain position="bottom" type="band" [domain]="labels()"></svg:g>
  <svg:g cngxAxisDomain position="left" [domain]="[0, 100]"></svg:g>
  <svg:g cngxLine></svg:g>
</cngx-chart>

Reserving nothing is the behavioural difference that matters. The chart shrinks its plot area by the room each axis's decoration needs; this one has none, so an 80x24 sparkline keeps all 80x24 for its mark instead of losing a gutter to ticks nobody draws.

Attribute-selector on <svg:g> for the same reason [cngxAxis] is: a <cngx-axis-domain> element inside <svg> would land in the XHTML namespace. Nothing renders either way, but the host stays a legal SVG child.

https://cngxjs.github.io/cngx/examples/#/ui/chart-panel/basic/titled-panel-with-legend https://cngxjs.github.io/cngx/examples/#/ui/chart-panel/slots/actions-and-footer

Metadata#

Providers#

CNGX_CHART_AXIS
useExisting CngxAxisDomain

Relationships

Index#

Inputs#

domain#readonly unknown[] | undefined
input()

Value range the scale maps from.

input()Required

Which edge the scale this publishes belongs to.

input()

Scale kind the chart builds for this dimension.

default 'linear'

Instance Properties#

crossReservation#unknown
Readonly

Always 0, for the same reason as reservation.

NO_RESERVATION
reservation#unknown
Readonly

Always 0. Not an opt-out from a gutter this directive would otherwise get - it draws nothing, so there is nothing to reserve for, and the number stays derived from what the unit does.

NO_RESERVATION