Skip to main content
cngx-src documentation

CngxChartAxis

Interface

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

Referenced by#

Import#

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

Description#

What <cngx-chart> needs from an axis, and nothing more.

Two things travel over this contract. The scale half (position / type / domain) tells the chart which scale to build and over what range of values. The geometry half (reservation / crossReservation) tells it how much of the box that axis's decoration needs, so the chart can shrink the plot area to fit.

Both implementations in the library are axes in the loose sense but differ in what they do: CngxAxis draws ticks, labels and a title and reserves room for them; CngxAxisDomain draws nothing and reserves nothing, existing purely to publish a scale domain. The chart cannot tell them apart, which is the point - it places and sizes against the contract, never against a concrete class.

Implement it on your own directive when you need an axis the chart participates with but the library does not ship: a logarithmic scale publisher, an axis whose domain comes from a service, a decoration you draw yourself. Provide it with useExisting and the chart picks the directive up through its content query.

Index#

Instance Properties#

crossReservation#Signal
Readonly

How far this axis's decoration extends along its own line, past the plot corner at either end. The chart reserves it on the two sides perpendicular to position. Return 0 to claim no room.

domain#Signal
Readonly

Value range the scale maps from. undefined yields a NOOP scale.

position#Signal
Readonly

Which edge of the plot area this axis occupies.

reservation#Signal
Readonly

How far this axis's decoration extends perpendicular to its own line, in viewBox user units. The chart reserves it on the side position names. Return 0 to claim no room.

Readonly

Scale kind the chart builds for this axis's dimension.