# Interface: CartesianScaleOptions

# Hierarchy

# Properties

# alignToPixels

alignToPixels: boolean

Align pixel values to device pixels

# Inherited from

CoreScaleOptions.alignToPixels

# Defined in

types/index.d.ts:1168


# axis

axis: "x" | "y" | "r"

Which type of axis this is. Possible values are: 'x', 'y', 'r'. If not set, this is inferred from the first character of the ID which should be 'x', 'y' or 'r'.

# Defined in

types/index.d.ts:3198


# backgroundColor

backgroundColor: Color

Background color of the scale area.

# Inherited from

CoreScaleOptions.backgroundColor

# Defined in

types/index.d.ts:1172


# border

border: BorderOptions

# Defined in

types/index.d.ts:3218


# bounds

bounds: "data" | "ticks"

Scale boundary strategy (bypassed by min/max time options)

  • data: make sure data are fully visible, ticks outside are removed
  • ticks: make sure ticks are fully visible, data outside are truncated

Since

2.7.0

Default

'ticks'

# Defined in

types/index.d.ts:3177


# clip

clip: boolean

Clip the dataset drawing against the size of the scale instead of chart area.

Default

true

# Inherited from

CoreScaleOptions.clip

# Defined in

types/index.d.ts:1182


# display

display: boolean | "auto"

Controls the axis global visibility (visible when true, hidden when false). When display: 'auto', the axis is visible only if at least one associated dataset is visible.

Default

true

# Inherited from

CoreScaleOptions.display

# Defined in

types/index.d.ts:1164


# grid

grid: Partial<GridLineOptions>

# Defined in

types/index.d.ts:3216


# max

max: number

User defined maximum value for the scale, overrides maximum value from data.

# Overrides

CoreScaleOptions.max

# Defined in

types/index.d.ts:3208


# min

min: number

User defined minimum value for the scale, overrides minimum value from data.

# Overrides

CoreScaleOptions.min

# Defined in

types/index.d.ts:3203


# offset

offset: boolean

If true, extra space is added to the both edges and the axis is scaled to fit into the chart area. This is set to true for a bar chart by default.

Default

false

# Defined in

types/index.d.ts:3214


# position

position: "center" | "left" | "top" | "bottom" | "right" | { [scale: string]: number; }

Position of the axis.

# Defined in

types/index.d.ts:3182


# reverse

reverse: boolean

Reverse the scale.

Default

false

# Inherited from

CoreScaleOptions.reverse

# Defined in

types/index.d.ts:1177


# stack

Optional stack: string

Stack group. Axes at the same position with same stack are stacked.

# Defined in

types/index.d.ts:3187


# stackWeight

Optional stackWeight: number

Weight of the scale in stack group. Used to determine the amount of allocated space for the scale within the group.

Default

1

# Defined in

types/index.d.ts:3193


# stacked

Optional stacked: boolean | "single"

If true, data will be comprised between datasets of data

Default

false

# Defined in

types/index.d.ts:3247


# suggestedMax

suggestedMax: unknown

Adjustment used when calculating the minimum data value.

# Inherited from

CoreScaleOptions.suggestedMax

# Defined in

types/index.d.ts:1203


# suggestedMin

suggestedMin: unknown

Adjustment used when calculating the maximum data value.

# Inherited from

CoreScaleOptions.suggestedMin

# Defined in

types/index.d.ts:1199


# ticks

ticks: CartesianTickOptions

# Defined in

types/index.d.ts:3249


# title

title: Object

Options for the scale title.

# Type declaration

Name Type Description
align Align Alignment of the axis title.
color Color Color of the axis label.
display boolean If true, displays the axis title.
font ScriptableAndScriptableOptions<Partial<FontSpec>, ScriptableCartesianScaleContext> Information about the axis title font.
padding number | { bottom: number ; top: number ; y: number } Padding to apply around scale labels.
text string | string[] The text for the title, e.g. "# of People" or "Response Choices".

# Defined in

types/index.d.ts:3221


# weight

weight: number

The weight used to sort the axis. Higher weights are further away from the chart area.

Default

true

# Inherited from

CoreScaleOptions.weight

# Defined in

types/index.d.ts:1187

# Methods

# afterBuildTicks

afterBuildTicks(axis): void

Callback that runs after ticks are created. Useful for filtering ticks.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.afterBuildTicks

# Defined in

types/index.d.ts:1231


# afterCalculateLabelRotation

afterCalculateLabelRotation(axis): void

Callback that runs after tick rotation is determined.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.afterCalculateLabelRotation

# Defined in

types/index.d.ts:1247


# afterDataLimits

afterDataLimits(axis): void

Callback that runs after data limits are determined.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.afterDataLimits

# Defined in

types/index.d.ts:1223


# afterFit

afterFit(axis): void

Callback that runs after the scale fits to the canvas.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.afterFit

# Defined in

types/index.d.ts:1255


# afterSetDimensions

afterSetDimensions(axis): void

Callback that runs after dimensions are set.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.afterSetDimensions

# Defined in

types/index.d.ts:1215


# afterTickToLabelConversion

afterTickToLabelConversion(axis): void

Callback that runs after ticks are converted into strings.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.afterTickToLabelConversion

# Defined in

types/index.d.ts:1239


# afterUpdate

afterUpdate(axis): void

Callback that runs at the end of the update process.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.afterUpdate

# Defined in

types/index.d.ts:1259


# beforeBuildTicks

beforeBuildTicks(axis): void

Callback that runs before ticks are created.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.beforeBuildTicks

# Defined in

types/index.d.ts:1227


# beforeCalculateLabelRotation

beforeCalculateLabelRotation(axis): void

Callback that runs before tick rotation is determined.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.beforeCalculateLabelRotation

# Defined in

types/index.d.ts:1243


# beforeDataLimits

beforeDataLimits(axis): void

Callback that runs before data limits are determined.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.beforeDataLimits

# Defined in

types/index.d.ts:1219


# beforeFit

beforeFit(axis): void

Callback that runs before the scale fits to the canvas.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.beforeFit

# Defined in

types/index.d.ts:1251


# beforeSetDimensions

beforeSetDimensions(axis): void

Callback that runs before dimensions are set.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.beforeSetDimensions

# Defined in

types/index.d.ts:1211


# beforeTickToLabelConversion

beforeTickToLabelConversion(axis): void

Callback that runs before ticks are converted into strings.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.beforeTickToLabelConversion

# Defined in

types/index.d.ts:1235


# beforeUpdate

beforeUpdate(axis): void

Callback called before the update process starts.

# Parameters

Name Type
axis Scale<CoreScaleOptions>

# Returns

void

# Inherited from

CoreScaleOptions.beforeUpdate

# Defined in

types/index.d.ts:1207