Interface: CartesianScaleOptions | Chart.js
Description: Open source HTML5 Charts for your website

# # Interface: CartesianScaleOptions

## # Hierarchy

- `CoreScaleOptions`

  ↳ `CartesianScaleOptions`

## # Properties

### # alignToPixels

• alignToPixels: `boolean`

Align pixel values to device pixels

#### # Inherited from

CoreScaleOptions.alignToPixels

#### # Defined in

index.esm.d.ts:1156
(opens new window)

### # axis

• axis: `"x"` | `"y"`

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

#### # Defined in

index.esm.d.ts:3089
(opens new window)

### # 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

index.esm.d.ts:3068
(opens new window)

### # 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

index.esm.d.ts:1152
(opens new window)

### # grid

• grid: `GridLineOptions`

#### # Defined in

index.esm.d.ts:3107
(opens new window)

### # max

• max: `number`

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

#### # Defined in

index.esm.d.ts:3099
(opens new window)

### # min

• min: `number`

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

#### # Defined in

index.esm.d.ts:3094
(opens new window)

### # 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

index.esm.d.ts:3105
(opens new window)

### # position

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

Position of the axis.

#### # Defined in

index.esm.d.ts:3073
(opens new window)

### # reverse

• reverse: `boolean`

Reverse the scale.

`default` false

#### # Inherited from

CoreScaleOptions.reverse

#### # Defined in

index.esm.d.ts:1161
(opens new window)

### # stack

• `Optional` stack: `string`

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

#### # Defined in

index.esm.d.ts:3078
(opens new window)

### # 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

index.esm.d.ts:3084
(opens new window)

### # stacked

• `Optional` stacked: `boolean` | `"single"`

If true, data will be comprised between datasets of data

`default` false

#### # Defined in

index.esm.d.ts:3136
(opens new window)

### # ticks

• ticks: `CartesianTickOptions`

#### # Defined in

index.esm.d.ts:3138
(opens new window)

### # 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

index.esm.d.ts:3110
(opens new window)

### # 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

index.esm.d.ts:1166
(opens new window)

## # 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

index.esm.d.ts:1194
(opens new window)

### # 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

index.esm.d.ts:1210
(opens new window)

### # 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

index.esm.d.ts:1186
(opens new window)

### # 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

index.esm.d.ts:1218
(opens new window)

### # 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

index.esm.d.ts:1178
(opens new window)

### # 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

index.esm.d.ts:1202
(opens new window)

### # 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

index.esm.d.ts:1222
(opens new window)

### # 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

index.esm.d.ts:1190
(opens new window)

### # 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

index.esm.d.ts:1206
(opens new window)

### # 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

index.esm.d.ts:1182
(opens new window)

### # 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

index.esm.d.ts:1214
(opens new window)

### # 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

index.esm.d.ts:1174
(opens new window)

### # 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

index.esm.d.ts:1198
(opens new window)

### # 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

index.esm.d.ts:1170
(opens new window)