Class: Scale<O>

    new Scale<O>(cfg)

    Type parameters

    NameType
    Oextends CoreScaleOptions

    Parameters

    NameType
    cfgObject
    cfg.chart<keyof ChartTypeRegistry, (number | | BubbleDataPoint)[], unknown>
    cfg.ctxCanvasRenderingContext2D
    cfg.idstring
    cfg.typestring

    Inherited from

    Element<unknown, O>.constructor

    Defined in

    active

    Readonly active: boolean

    Inherited from

    Element.active

    Defined in


    axis

    axis: string

    Defined in

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


    bottom

    bottom: number

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

    Inherited from

    .bottom

    Defined in

    layout.d.ts:41Scale - 图4 (opens new window)


    chart

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

    Defined in


    ctx

    Readonly ctx: CanvasRenderingContext2D

    Defined in

    index.esm.d.ts:1188Scale - 图6 (opens new window)


    fullSize

    fullSize: boolean

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

    Inherited from

    .fullSize

    Defined in

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


    height

    height: number

    Height of item. Must be valid after update()

    Inherited from

    .height

    Defined in

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


    id

    Readonly id: string

    Defined in


    labelRotation

    labelRotation: number

    Defined in

    index.esm.d.ts:1200Scale - 图10 (opens new window)


    left

    left: number

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

    Inherited from

    .left

    Defined in

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


    max

    max: number

    Defined in


    maxHeight

    maxHeight: number

    Defined in

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


    maxWidth

    maxWidth: number

    Defined in


    min

    min: number

    Defined in

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


    options

    Readonly options: O

    Inherited from

    Element.options

    Defined in

    element.d.ts:8Scale - 图16 (opens new window)


    paddingBottom

    paddingBottom: number

    Defined in


    paddingLeft

    paddingLeft: number

    Defined in

    index.esm.d.ts:1196Scale - 图18 (opens new window)


    paddingRight

    paddingRight: number

    Defined in


    paddingTop

    paddingTop: number

    Defined in

    index.esm.d.ts:1194Scale - 图20 (opens new window)


    position

    position: LayoutPosition

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

    Inherited from

    LayoutItem.

    Defined in


    right

    right: number

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

    Inherited from

    LayoutItem.

    Defined in


    ticks

    ticks: []

    Defined in


    top

    top: number

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

    Inherited from

    LayoutItem.

    Defined in


    type

    Readonly type: string

    Defined in

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


    weight

    weight: number

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

    Inherited from

    .weight

    Defined in

    layout.d.ts:13Scale - 图26 (opens new window)


    width: number

    Width of item. Must be valid after update()

    Inherited from

    LayoutItem.

    Defined in


    x

    Readonly x: number

    Inherited from

    Element.x

    Defined in


    y

    Readonly y: number

    Inherited from

    Defined in

    afterBuildTicks

    afterBuildTicks(): void

    Returns

    void

    Defined in


    afterCalculateLabelRotation

    afterCalculateLabelRotation(): void

    Returns

    void

    Defined in


    afterDataLimits

    afterDataLimits(): void

    Returns

    void

    Defined in


    afterFit

    afterFit(): void

    Returns

    void

    Defined in


    afterSetDimensions

    afterSetDimensions(): void

    Returns

    void

    Defined in


    afterTickToLabelConversion

    afterTickToLabelConversion(): void

    Returns

    void

    Defined in


    afterUpdate

    afterUpdate(): void

    Returns

    void

    Defined in


    beforeBuildTicks

    beforeBuildTicks(): void

    Returns

    void

    Defined in


    beforeCalculateLabelRotation

    beforeCalculateLabelRotation(): void

    Returns

    void

    Defined in


    beforeDataLimits

    beforeDataLimits(): void

    Returns

    void

    Defined in


    beforeFit

    beforeFit(): void

    Returns

    void

    Defined in


    beforeLayout

    Optional beforeLayout(): void

    Called before the layout process starts

    Returns

    void

    Inherited from

    .beforeLayout

    Defined in

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


    beforeSetDimensions

    beforeSetDimensions(): void

    Returns

    Defined in

    index.esm.d.ts:1275Scale - 图42 (opens new window)


    beforeTickToLabelConversion

    beforeTickToLabelConversion(): void

    Returns

    void

    Defined in

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


    beforeUpdate

    beforeUpdate(): void

    Returns

    void

    Defined in

    index.esm.d.ts:1272Scale - 图44 (opens new window)


    buildTicks

    buildTicks(): Tick[]

    Returns

    Tick[]

    Defined in

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


    calculateLabelRotation

    calculateLabelRotation(): void

    Returns

    void

    Defined in

    index.esm.d.ts:1288Scale - 图46 (opens new window)


    configure

    configure(): void

    Returns

    void

    Defined in

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


    determineDataLimits

    determineDataLimits(): void

    Returns

    void

    Defined in

    index.esm.d.ts:1279Scale - 图48 (opens new window)


    draw

    draw(chartArea): void

    Draws the element

    Parameters

    NameType
    chartArea

    Returns

    void

    Inherited from

    LayoutItem.

    Defined in


    drawGrid

    drawGrid(chartArea): void

    Parameters

    NameType
    chartAreaChartArea

    Returns

    void

    Defined in


    drawLabels

    drawLabels(chartArea): void

    Parameters

    NameType
    chartAreaChartArea

    Returns

    void

    Defined in


    drawTitle

    drawTitle(chartArea): void

    Parameters

    NameType
    chartAreaChartArea

    Returns

    void

    Defined in


    fit(): void

    Returns

    void

    Defined in

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


    generateTickLabels

    generateTickLabels(ticks): void

    Parameters

    NameType
    ticks[]

    Returns

    void

    Defined in

    index.esm.d.ts:1285Scale - 图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


    getBaseValue

    getBaseValue(): number

    Returns

    number

    Defined in


    getDecimalForPixel

    getDecimalForPixel(pixel): number

    Parameters

    Returns

    number

    Defined in

    index.esm.d.ts:1214Scale - 图57 (opens new window)


    getLabelForValue

    getLabelForValue(value): string

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

    Parameters

    NameType
    valuenumber

    Returns

    string

    Defined in


    getLabels

    getLabels(): string[]

    Returns

    string[]

    Defined in


    getLineWidthForValue

    getLineWidthForValue(value): number

    Returns the grid line width at given value

    Parameters

    NameType
    valuenumber

    Returns

    number

    Defined in

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


    getMatchingVisibleMetas

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

    Parameters

    NameType
    type?string

    Returns

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

    Defined in


    getMinMax

    getMinMax(canStack): Object

    Parameters

    NameType
    canStackboolean

    Returns

    Object

    NameType
    maxnumber
    minnumber

    Defined in

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


    getPadding

    Optional getPadding(): ChartArea

    Returns an object with padding on the edges

    Returns

    ChartArea

    Inherited from

    LayoutItem.

    Defined in


    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

    NameType
    decimalnumber

    Returns

    Defined in

    index.esm.d.ts:1221 (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

    NameType
    indexnumber

    Returns

    number

    Defined in


    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

    Returns

    number

    Defined in

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


    getProps

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

    Type parameters

    NameType
    Pextends never[]

    Parameters

    NameType
    propsP
    final?boolean

    Returns

    Pick<unknown, P[number]>

    Inherited from

    Element.getProps

    Defined in


    getTicks

    getTicks(): []

    Returns

    []

    Defined in


    getUserBounds

    getUserBounds(): Object

    Returns

    Object

    NameType
    maxnumber
    maxDefinedboolean
    minnumber
    minDefinedboolean

    Defined in


    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

    NameType
    pixelnumber

    Returns

    number

    Defined in

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


    hasValue

    hasValue(): boolean

    Returns

    boolean

    Inherited from

    Element.hasValue

    Defined in


    init

    init(options): void

    Parameters

    NameType
    optionsO

    Returns

    void

    Defined in

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


    isFullSize

    isFullSize(): boolean

    Returns

    boolean

    Defined in

    index.esm.d.ts:1294Scale - 图73 (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


    parse

    parse(raw, index): unknown

    Parameters

    NameType
    rawunknown
    indexnumber

    Returns

    unknown

    Defined in

    index.esm.d.ts:1267Scale - 图75 (opens new window)


    setDimensions

    setDimensions(): void

    Returns

    void

    Defined in

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


    tooltipPosition

    tooltipPosition(useFinalPosition?): Point

    Parameters

    NameType
    useFinalPosition?boolean

    Returns

    Inherited from

    Element.tooltipPosition

    Defined in

    element.d.ts:10Scale - 图77 (opens new window)


    update

    update(width, height, margins?): void

    Takes two parameters: width and height.

    Parameters

    Returns

    Inherited from

    .update

    Defined in