Class: Scale<O>

Type parameters

NameTypeDefault
OCoreScaleOptionsCoreScaleOptions

Hierarchy

Constructors

constructor

+ new Scale<O>(cfg: { chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown> ; ctx: CanvasRenderingContext2D ; id: string ; type: string }): Scale<O>

Type parameters:

NameTypeDefault
OCoreScaleOptionsCoreScaleOptions

Parameters:

NameType
cfgobject
cfg.chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>
cfg.ctxCanvasRenderingContext2D
cfg.idstring
cfg.typestring

Returns: Scale<O>

Inherited from: void

Defined in: index.esm.d.ts:1251Scale - 图1 (opens new window)

Properties

active

Readonly active: boolean

Inherited from: void

Defined in: element.d.ts:6Scale - 图2 (opens new window)


axis

axis: string

Defined in: index.esm.d.ts:1154Scale - 图3 (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:41Scale - 图4 (opens new window)


chart

Readonly chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>

Defined in: index.esm.d.ts:1144Scale - 图5 (opens new window)


ctx

Readonly ctx: CanvasRenderingContext2D

Defined in: index.esm.d.ts:1143Scale - 图6 (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:17Scale - 图7 (opens new window)


height

height: number

Height of item. Must be valid after update()

Inherited from: LayoutItem.height

Defined in: layout.d.ts:25Scale - 图8 (opens new window)


id

Readonly id: string

Defined in: index.esm.d.ts:1141Scale - 图9 (opens new window)


labelRotation

labelRotation: number

Defined in: index.esm.d.ts:1155Scale - 图10 (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:29Scale - 图11 (opens new window)


max

max: number

Defined in: index.esm.d.ts:1157Scale - 图12 (opens new window)


maxHeight

maxHeight: number

Defined in: index.esm.d.ts:1147Scale - 图13 (opens new window)


maxWidth

maxWidth: number

Defined in: index.esm.d.ts:1146Scale - 图14 (opens new window)


min

min: number

Defined in: index.esm.d.ts:1156Scale - 图15 (opens new window)


options

Readonly options: O

Inherited from: void

Defined in: element.d.ts:7Scale - 图16 (opens new window)


paddingBottom

paddingBottom: number

Defined in: index.esm.d.ts:1150Scale - 图17 (opens new window)


paddingLeft

paddingLeft: number

Defined in: index.esm.d.ts:1151Scale - 图18 (opens new window)


paddingRight

paddingRight: number

Defined in: index.esm.d.ts:1152Scale - 图19 (opens new window)


paddingTop

paddingTop: number

Defined in: index.esm.d.ts:1149Scale - 图20 (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:9Scale - 图21 (opens new window)


right

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:37Scale - 图22 (opens new window)


ticks

ticks: Tick[]

Defined in: index.esm.d.ts:1158Scale - 图23 (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:33Scale - 图24 (opens new window)


type

Readonly type: string

Defined in: index.esm.d.ts:1142Scale - 图25 (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:13Scale - 图26 (opens new window)


width

width: number

Width of item. Must be valid after update()

Inherited from: LayoutItem.width

Defined in: layout.d.ts:21Scale - 图27 (opens new window)


x

Readonly x: number

Inherited from: void

Defined in: element.d.ts:4Scale - 图28 (opens new window)


y

Readonly y: number

Inherited from: void

Defined in: element.d.ts:5Scale - 图29 (opens new window)

Methods

afterBuildTicks

afterBuildTicks(): void

Returns: void

Defined in: index.esm.d.ts:1238Scale - 图30 (opens new window)


afterCalculateLabelRotation

afterCalculateLabelRotation(): void

Returns: void

Defined in: index.esm.d.ts:1244Scale - 图31 (opens new window)


afterDataLimits

afterDataLimits(): void

Returns: void

Defined in: index.esm.d.ts:1235Scale - 图32 (opens new window)


afterFit

afterFit(): void

Returns: void

Defined in: index.esm.d.ts:1247Scale - 图33 (opens new window)


afterSetDimensions

afterSetDimensions(): void

Returns: void

Defined in: index.esm.d.ts:1232Scale - 图34 (opens new window)


afterTickToLabelConversion

afterTickToLabelConversion(): void

Returns: void

Defined in: index.esm.d.ts:1241Scale - 图35 (opens new window)


afterUpdate

afterUpdate(): void

Returns: void

Defined in: index.esm.d.ts:1229Scale - 图36 (opens new window)


beforeBuildTicks

beforeBuildTicks(): void

Returns: void

Defined in: index.esm.d.ts:1236Scale - 图37 (opens new window)


beforeCalculateLabelRotation

beforeCalculateLabelRotation(): void

Returns: void

Defined in: index.esm.d.ts:1242Scale - 图38 (opens new window)


beforeDataLimits

beforeDataLimits(): void

Returns: void

Defined in: index.esm.d.ts:1233Scale - 图39 (opens new window)


beforeFit

beforeFit(): void

Returns: void

Defined in: index.esm.d.ts:1245Scale - 图40 (opens new window)


beforeLayout

OptionalbeforeLayout(): void

Called before the layout process starts

Returns: void

Inherited from: LayoutItem

Defined in: layout.d.ts:46Scale - 图41 (opens new window)


beforeSetDimensions

beforeSetDimensions(): void

Returns: void

Defined in: index.esm.d.ts:1230Scale - 图42 (opens new window)


beforeTickToLabelConversion

beforeTickToLabelConversion(): void

Returns: void

Defined in: index.esm.d.ts:1239Scale - 图43 (opens new window)


beforeUpdate

beforeUpdate(): void

Returns: void

Defined in: index.esm.d.ts:1227Scale - 图44 (opens new window)


buildTicks

buildTicks(): Tick[]

Returns: Tick[]

Defined in: index.esm.d.ts:1237Scale - 图45 (opens new window)


calculateLabelRotation

calculateLabelRotation(): void

Returns: void

Defined in: index.esm.d.ts:1243Scale - 图46 (opens new window)


configure

configure(): void

Returns: void

Defined in: index.esm.d.ts:1228Scale - 图47 (opens new window)


determineDataLimits

determineDataLimits(): void

Returns: void

Defined in: index.esm.d.ts:1234Scale - 图48 (opens new window)


draw

draw(chartArea: ChartArea): void

Draws the element

Parameters:

NameType
chartAreaChartArea

Returns: void

Inherited from: LayoutItem

Defined in: layout.d.ts:50Scale - 图49 (opens new window)


drawGrid

drawGrid(chartArea: ChartArea): void

Parameters:

NameType
chartAreaChartArea

Returns: void

Defined in: index.esm.d.ts:1163Scale - 图50 (opens new window)


drawLabels

drawLabels(chartArea: ChartArea): void

Parameters:

NameType
chartAreaChartArea

Returns: void

Defined in: index.esm.d.ts:1162Scale - 图51 (opens new window)


drawTitle

drawTitle(chartArea: ChartArea): void

Parameters:

NameType
chartAreaChartArea

Returns: void

Defined in: index.esm.d.ts:1161Scale - 图52 (opens new window)


fit

fit(): void

Returns: void

Defined in: index.esm.d.ts:1246Scale - 图53 (opens new window)


generateTickLabels

generateTickLabels(ticks: Tick[]): void

Parameters:

NameType
ticksTick[]

Returns: void

Defined in: index.esm.d.ts:1240Scale - 图54 (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:1219Scale - 图55 (opens new window)


getBaseValue

getBaseValue(): number

Returns: number

Defined in: index.esm.d.ts:1213Scale - 图56 (opens new window)


getDecimalForPixel

getDecimalForPixel(pixel: number): number

Parameters:

NameType
pixelnumber

Returns: number

Defined in: index.esm.d.ts:1169Scale - 图57 (opens new window)


getLabelForValue

getLabelForValue(value: number): string

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

Parameters:

NameType
valuenumber

Returns: string

Defined in: index.esm.d.ts:1189Scale - 图58 (opens new window)


getLabels

getLabels(): string[]

Returns: string[]

Defined in: index.esm.d.ts:1226Scale - 图59 (opens new window)


getLineWidthForValue

getLineWidthForValue(value: number): number

Returns the grid line width at given value

Parameters:

NameType
valuenumber

Returns: number

Defined in: index.esm.d.ts:1194Scale - 图60 (opens new window)


getMatchingVisibleMetas

getMatchingVisibleMetas(type?: string): ChartMeta<Element<{}, {}>, Element<{}, {}>>[]

Parameters:

NameType
type?string

Returns: ChartMeta<Element<{}, {}>, Element<{}, {}>>[]

Defined in: index.esm.d.ts:1159Scale - 图61 (opens new window)


getMinMax

getMinMax(canStack: boolean): object

Parameters:

NameType
canStackboolean

Returns: object

NameType
maxnumber
minnumber

Defined in: index.esm.d.ts:1224Scale - 图62 (opens new window)


getPadding

OptionalgetPadding(): ChartArea

Returns an object with padding on the edges

Returns: ChartArea

Inherited from: LayoutItem

Defined in: layout.d.ts:54Scale - 图63 (opens new window)


getPixelForDecimal

getPixelForDecimal(decimal: number): 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:

NameType
decimalnumber

Returns: number

Defined in: index.esm.d.ts:1176Scale - 图64 (opens new window)


getPixelForTick

getPixelForTick(index: number): 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:

NameType
indexnumber

Returns: number

Defined in: index.esm.d.ts:1183Scale - 图65 (opens new window)


getPixelForValue

getPixelForValue(value: number, index: number): 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:

NameType
valuenumber
indexnumber

Returns: number

Defined in: index.esm.d.ts:1203Scale - 图66 (opens new window)


getProps

getProps<P>(props: [P], final?: boolean): Pick<{}, P>

Type parameters:

NameType
Pnever

Parameters:

NameType
props[P]
final?boolean

Returns: Pick<{}, P>

Inherited from: void

Defined in: element.d.ts:11Scale - 图67 (opens new window)

getProps<P, P2>(props: [P, P2], final?: boolean): Pick<{}, P | P2>

Type parameters:

NameType
Pnever
P2never

Parameters:

NameType
props[P, P2]
final?boolean

Returns: Pick<{}, P | P2>

Inherited from: void

Defined in: element.d.ts:12Scale - 图68 (opens new window)

getProps<P, P2, P3>(props: [P, P2, P3], final?: boolean): Pick<{}, P | P2 | P3>

Type parameters:

NameType
Pnever
P2never
P3never

Parameters:

NameType
props[P, P2, P3]
final?boolean

Returns: Pick<{}, P | P2 | P3>

Inherited from: void

Defined in: element.d.ts:13Scale - 图69 (opens new window)

getProps<P, P2, P3, P4>(props: [P, P2, P3, P4], final?: boolean): Pick<{}, P | P2 | P3 | P4>

Type parameters:

NameType
Pnever
P2never
P3never
P4never

Parameters:

NameType
props[P, P2, P3, P4]
final?boolean

Returns: Pick<{}, P | P2 | P3 | P4>

Inherited from: void

Defined in: element.d.ts:17Scale - 图70 (opens new window)

getProps<P, P2, P3, P4, P5>(props: [P, P2, P3, P4, P5], final?: boolean): Pick<{}, P | P2 | P3 | P4 | P5>

Type parameters:

NameType
Pnever
P2never
P3never
P4never
P5never

Parameters:

NameType
props[P, P2, P3, P4, P5]
final?boolean

Returns: Pick<{}, P | P2 | P3 | P4 | P5>

Inherited from: void

Defined in: element.d.ts:21Scale - 图71 (opens new window)

getProps(props: never[], final?: boolean): object

Parameters:

NameType
propsnever[]
final?boolean

Returns: object

Inherited from: void

Defined in: element.d.ts:25Scale - 图72 (opens new window)


getTicks

getTicks(): Tick[]

Returns: Tick[]

Defined in: index.esm.d.ts:1225Scale - 图73 (opens new window)


getUserBounds

getUserBounds(): object

Returns: object

NameType
maxnumber
maxDefinedboolean
minnumber
minDefinedboolean

Defined in: index.esm.d.ts:1223Scale - 图74 (opens new window)


getValueForPixel

getValueForPixel(pixel: number): 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:

NameType
pixelnumber

Returns: number

Defined in: index.esm.d.ts:1211Scale - 图75 (opens new window)


hasValue

hasValue(): boolean

Returns: boolean

Inherited from: void

Defined in: element.d.ts:10Scale - 图76 (opens new window)


init

init(options: O): void

Parameters:

NameType
optionsO

Returns: void

Defined in: index.esm.d.ts:1221Scale - 图77 (opens new window)


isFullSize

isFullSize(): boolean

Returns: boolean

Defined in: index.esm.d.ts:1249Scale - 图78 (opens new window)


isHorizontal

isHorizontal(): boolean

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

Returns: boolean

Inherited from: LayoutItem

Defined in: layout.d.ts:58Scale - 图79 (opens new window)


parse

parse(raw: unknown, index: number): unknown

Parameters:

NameType
rawunknown
indexnumber

Returns: unknown

Defined in: index.esm.d.ts:1222Scale - 图80 (opens new window)


setDimensions

setDimensions(): void

Returns: void

Defined in: index.esm.d.ts:1231Scale - 图81 (opens new window)


tooltipPosition

tooltipPosition(useFinalPosition?: boolean): Point

Parameters:

NameType
useFinalPosition?boolean

Returns: Point

Inherited from: void

Defined in: element.d.ts:9Scale - 图82 (opens new window)


update

update(width: number, height: number, margins?: ChartArea): void

Takes two parameters: width and height.

Parameters:

NameType
widthnumber
heightnumber
margins?ChartArea

Returns: void

Inherited from: LayoutItem

Defined in: layout.d.ts:64Scale - 图83 (opens new window)