# Class: Scale<O>

# Type parameters

Name Type
O extends CoreScaleOptions = CoreScaleOptions

# Hierarchy

# Constructors

# constructor

new Scale<O>(cfg)

# Type parameters

Name Type
O extends CoreScaleOptions = CoreScaleOptions

# Parameters

Name Type
cfg Object
cfg.chart Chart<keyof ChartTypeRegistry, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>
cfg.ctx CanvasRenderingContext2D
cfg.id string
cfg.type string

# Inherited from

Element<unknown, O>.constructor

# Defined in

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

# Properties

# active

Readonly active: boolean

# Inherited from

Element.active

# Defined in

element.d.ts:7 (opens new window)


# axis

axis: string

# Defined in

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


# bottom

bottom: number

Bottom edge of the item. Set by layout system and cannot be used in update

# Inherited from

LayoutItem.bottom

# Defined in

layout.d.ts:41 (opens new window)


# chart

Readonly chart: Chart<keyof ChartTypeRegistry, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>

# Defined in

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


# ctx

Readonly ctx: CanvasRenderingContext2D

# Defined in

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


# fullSize

fullSize: boolean

if true, and the item is horizontal, then push vertical boxes down

# Inherited from

LayoutItem.fullSize

# Defined in

layout.d.ts:17 (opens new window)


# height

height: number

Height of item. Must be valid after update()

# Inherited from

LayoutItem.height

# Defined in

layout.d.ts:25 (opens new window)


# id

Readonly id: string

# Defined in

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


# labelRotation

labelRotation: number

# Defined in

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


# left

left: number

Left edge of the item. Set by layout system and cannot be used in update

# Inherited from

LayoutItem.left

# Defined in

layout.d.ts:29 (opens new window)


# max

max: number

# Defined in

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


# maxHeight

maxHeight: number

# Defined in

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


# maxWidth

maxWidth: number

# Defined in

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


# min

min: number

# Defined in

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


# options

Readonly options: O

# Inherited from

Element.options

# Defined in

element.d.ts:8 (opens new window)


# paddingBottom

paddingBottom: number

# Defined in

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


# paddingLeft

paddingLeft: number

# Defined in

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


# paddingRight

paddingRight: number

# Defined in

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


# paddingTop

paddingTop: number

# Defined in

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


# position

position: LayoutPosition

The position of the item in the chart layout. Possible values are

# Inherited from

LayoutItem.position

# Defined in

layout.d.ts:9 (opens new window)


right: number

Right edge of the item. Set by layout system and cannot be used in update

# Inherited from

LayoutItem.right

# Defined in

layout.d.ts:37 (opens new window)


# ticks

ticks: Tick[]

# Defined in

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


# top

top: number

Top edge of the item. Set by layout system and cannot be used in update

# Inherited from

LayoutItem.top

# Defined in

layout.d.ts:33 (opens new window)


# type

Readonly type: string

# Defined in

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


# weight

weight: number

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

# Inherited from

LayoutItem.weight

# Defined in

layout.d.ts:13 (opens new window)


# width

width: number

Width of item. Must be valid after update()

# Inherited from

LayoutItem.width

# Defined in

layout.d.ts:21 (opens new window)


# x

Readonly x: number

# Inherited from

Element.x

# Defined in

element.d.ts:5 (opens new window)


# y

Readonly y: number

# Inherited from

Element.y

# Defined in

element.d.ts:6 (opens new window)

# Methods

# afterBuildTicks

afterBuildTicks(): void

# Returns

void

# Defined in

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


# afterCalculateLabelRotation

afterCalculateLabelRotation(): void

# Returns

void

# Defined in

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


# afterDataLimits

afterDataLimits(): void

# Returns

void

# Defined in

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


# afterFit

afterFit(): void

# Returns

void

# Defined in

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


# afterSetDimensions

afterSetDimensions(): void

# Returns

void

# Defined in

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


# afterTickToLabelConversion

afterTickToLabelConversion(): void

# Returns

void

# Defined in

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


# afterUpdate

afterUpdate(): void

# Returns

void

# Defined in

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


# beforeBuildTicks

beforeBuildTicks(): void

# Returns

void

# Defined in

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


# beforeCalculateLabelRotation

beforeCalculateLabelRotation(): void

# Returns

void

# Defined in

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


# beforeDataLimits

beforeDataLimits(): void

# Returns

void

# Defined in

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


# beforeFit

beforeFit(): void

# Returns

void

# Defined in

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


# beforeLayout

Optional beforeLayout(): void

Called before the layout process starts

# Returns

void

# Inherited from

LayoutItem.beforeLayout

# Defined in

layout.d.ts:46 (opens new window)


# beforeSetDimensions

beforeSetDimensions(): void

# Returns

void

# Defined in

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


# beforeTickToLabelConversion

beforeTickToLabelConversion(): void

# Returns

void

# Defined in

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


# beforeUpdate

beforeUpdate(): void

# Returns

void

# Defined in

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


# buildTicks

buildTicks(): Tick[]

# Returns

Tick[]

# Defined in

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


# calculateLabelRotation

calculateLabelRotation(): void

# Returns

void

# Defined in

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


# configure

configure(): void

# Returns

void

# Defined in

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


# determineDataLimits

determineDataLimits(): void

# Returns

void

# Defined in

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


# draw

draw(chartArea): void

Draws the element

# Parameters

Name Type
chartArea ChartArea

# Returns

void

# Inherited from

LayoutItem.draw

# Defined in

layout.d.ts:50 (opens new window)


# drawGrid

drawGrid(chartArea): void

# Parameters

Name Type
chartArea ChartArea

# Returns

void

# Defined in

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


# drawLabels

drawLabels(chartArea): void

# Parameters

Name Type
chartArea ChartArea

# Returns

void

# Defined in

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


# drawTitle

drawTitle(chartArea): void

# Parameters

Name Type
chartArea ChartArea

# Returns

void

# Defined in

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


# fit

fit(): void

# Returns

void

# Defined in

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


# generateTickLabels

generateTickLabels(ticks): void

# Parameters

Name Type
ticks Tick[]

# Returns

void

# Defined in

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


# getBasePixel

getBasePixel(): number

Returns the pixel for the minimum chart value The coordinate (0, 0) is at the upper-left corner of the canvas

# Returns

number

# Defined in

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


# getBaseValue

getBaseValue(): number

# Returns

number

# Defined in

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


# getDecimalForPixel

getDecimalForPixel(pixel): number

# Parameters

Name Type
pixel number

# Returns

number

# Defined in

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


# getLabelForValue

getLabelForValue(value): string

Used to get the label to display in the tooltip for the given value

# Parameters

Name Type
value number

# Returns

string

# Defined in

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


# getLabels

getLabels(): string[]

# Returns

string[]

# Defined in

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


# getLineWidthForValue

getLineWidthForValue(value): number

Returns the grid line width at given value

# Parameters

Name Type
value number

# Returns

number

# Defined in

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


# getMatchingVisibleMetas

getMatchingVisibleMetas(type?): ChartMeta<Element<AnyObject, AnyObject>, Element<AnyObject, AnyObject>, keyof ChartTypeRegistry>[]

# Parameters

Name Type
type? string

# Returns

ChartMeta<Element<AnyObject, AnyObject>, Element<AnyObject, AnyObject>, keyof ChartTypeRegistry>[]

# Defined in

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


# getMinMax

getMinMax(canStack): Object

# Parameters

Name Type
canStack boolean

# Returns

Object

Name Type
max number
min number

# Defined in

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


# getPadding

Optional getPadding(): ChartArea

Returns an object with padding on the edges

# Returns

ChartArea

# Inherited from

LayoutItem.getPadding

# Defined in

layout.d.ts:54 (opens new window)


# getPixelForDecimal

getPixelForDecimal(decimal): number

Utility for getting the pixel location of a percentage of scale The coordinate (0, 0) is at the upper-left corner of the canvas

# Parameters

Name Type
decimal number

# Returns

number

# Defined in

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


# getPixelForTick

getPixelForTick(index): number

Returns the location of the tick at the given index The coordinate (0, 0) is at the upper-left corner of the canvas

# Parameters

Name Type
index number

# Returns

number

# Defined in

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


# getPixelForValue

getPixelForValue(value, index?): number

Returns the location of the given data point. Value can either be an index or a numerical value The coordinate (0, 0) is at the upper-left corner of the canvas

# Parameters

Name Type
value number
index? number

# Returns

number

# Defined in

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


# getProps

getProps<P>(props, final?): Pick<unknown, P[number]>

# Type parameters

Name Type
P extends never[]

# Parameters

Name Type
props P
final? boolean

# Returns

Pick<unknown, P[number]>

# Inherited from

Element.getProps

# Defined in

element.d.ts:12 (opens new window)


# getTicks

getTicks(): Tick[]

# Returns

Tick[]

# Defined in

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


# getUserBounds

getUserBounds(): Object

# Returns

Object

Name Type
max number
maxDefined boolean
min number
minDefined boolean

# Defined in

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


# getValueForPixel

getValueForPixel(pixel): number

Used to get the data value from a given pixel. This is the inverse of getPixelForValue The coordinate (0, 0) is at the upper-left corner of the canvas

# Parameters

Name Type
pixel number

# Returns

number

# Defined in

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


# hasValue

hasValue(): boolean

# Returns

boolean

# Inherited from

Element.hasValue

# Defined in

element.d.ts:11 (opens new window)


# init

init(options): void

# Parameters

Name Type
options O

# Returns

void

# Defined in

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


# isFullSize

isFullSize(): boolean

# Returns

boolean

# Defined in

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


# isHorizontal

isHorizontal(): boolean

returns true if the layout item is horizontal (ie. top or bottom)

# Returns

boolean

# Inherited from

LayoutItem.isHorizontal

# Defined in

layout.d.ts:58 (opens new window)


# parse

parse(raw, index): unknown

# Parameters

Name Type
raw unknown
index number

# Returns

unknown

# Defined in

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


# setDimensions

setDimensions(): void

# Returns

void

# Defined in

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


# tooltipPosition

tooltipPosition(useFinalPosition?): Point

# Parameters

Name Type
useFinalPosition? boolean

# Returns

Point

# Inherited from

Element.tooltipPosition

# Defined in

element.d.ts:10 (opens new window)


# update

update(width, height, margins?): void

Takes two parameters: width and height.

# Parameters

Name Type
width number
height number
margins? ChartArea

# Returns

void

# Inherited from

LayoutItem.update

# Defined in

layout.d.ts:64 (opens new window)