options to configure a scale. not all options are used by all scales

interface AxisOptions {
    binned?: boolean;
    bins?: number | any[];
    domain?: AxisDomain[];
    extendLinearDomainBy?: string;
    includeZero?: boolean;
    limitDomainToBins?: boolean;
    mapsTo?: string;
    percentage?: boolean;
    scaleType?: ScaleTypes;
    stacked?: boolean;
    thresholds?: ThresholdOptions[];
    ticks?: {
        formatter?: ((tick, i) => string);
        max?: number;
        min?: number;
        number?: number;
        rotateIfSmallerThan?: number;
        rotation?: TickRotations;
        values?: any[];
    };
    title?: string;
    titleOrientation?: AxisTitleOrientations;
    truncation?: TruncationOptions;
    visible?: boolean;
}

Hierarchy (view full)

Properties

binned?: boolean

should be set to true on the domain axis that's being broken into bins

bins?: number | any[]

Bins to display (Histogram) bins: 20 bins: [0, 20, 40, 60] bins: [new Date(...), new Date(...), ...]

domain?: AxisDomain[]

Whether the Axis should use the specified domain instead of it being dynamically generated based on data extents. The type of values should depend on the scale type. Example for continuous axis scale: [-100, 100] Example for discrete axis scale: ['Qty', 'More', 'Sold'] No need to define domain for percentage axis scale

extendLinearDomainBy?: string

an additional key from the charting data that is used to extend the domain of an axis by (e.g. in the bullet graph we need both the marker & the data values to define the domain of the linear scale)

includeZero?: boolean

Whether the Axis should be forced to include 0 as a starting point (or ending point, in case of all negative axis). Default: true

limitDomainToBins?: boolean

limit the visible axis domain to only the binned area

mapsTo?: string

identifies what key within the data the axis values would map to

percentage?: boolean

option for percentage axis scale

scaleType?: ScaleTypes

type of the scale used on axis

stacked?: boolean

option for stacked axis

thresholds?: ThresholdOptions[]

thresholds

Example

[
{ value: 10000 },
{ value: 40020, valueFormatter: (x) => x },
{ value: 55000, label: "Custom label", fillColor: "#03a9f4" },
]
ticks?: {
    formatter?: ((tick, i) => string);
    max?: number;
    min?: number;
    number?: number;
    rotateIfSmallerThan?: number;
    rotation?: TickRotations;
    values?: any[];
}

tick configuration

Type declaration

  • Optional formatter?: ((tick, i) => string)

    function to format the ticks

      • (tick, i): string
      • Parameters

        • tick: number | Date
        • i: number

        Returns string

  • Optional max?: number

    maximum tick value

  • Optional min?: number

    minimum tick value

  • Optional number?: number

    number of ticks to show

  • Optional rotateIfSmallerThan?: number

    minimum width of a tick before getting rotated (in pixels)

  • Optional rotation?: TickRotations

    when to rotate ticks

  • Optional values?: any[]

    optional custom array of tick values that is within the domain of data

title?: string

optional title for the scales

titleOrientation?: AxisTitleOrientations

Override for the orientation of the title (for vertical axes). The title string can be overrided to be rotated left or right.

truncation?: TruncationOptions
visible?: boolean

is axis visible or not