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

    element.d.ts:7Scale - 图2 (opens new window)


    axis

    axis: string

    Defined in


    bottom

    bottom: number

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

    Inherited from

    LayoutItem.

    Defined in


    chart

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

    Defined in

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


    ctx

    Readonly ctx: CanvasRenderingContext2D

    Defined in


    fullSize

    fullSize: boolean

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

    Inherited from

    LayoutItem.

    Defined in


    height

    height: number

    Height of item. Must be valid after update()

    Inherited from

    LayoutItem.

    Defined in


    id

    Readonly id: string

    Defined in

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


    labelRotation

    labelRotation: number

    Defined in


    left

    left: number

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

    Inherited from

    LayoutItem.

    Defined in


    max

    max: number

    Defined in

    index.esm.d.ts:1242Scale - 图12 (opens new window)


    maxHeight

    maxHeight: number

    Defined in


    maxWidth

    maxWidth: number

    Defined in

    index.esm.d.ts:1231Scale - 图14 (opens new window)


    min

    min: number

    Defined in


    options

    Readonly options: O

    Inherited from

    Element.options

    Defined in


    paddingBottom

    paddingBottom: number

    Defined in

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


    paddingLeft

    paddingLeft: number

    Defined in


    paddingRight

    paddingRight: number

    Defined in

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


    paddingTop

    paddingTop: number

    Defined in


    position

    position:

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

    Inherited from

    .position

    Defined in

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


    right

    right: number

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

    Inherited from

    .right

    Defined in

    layout.d.ts:37Scale - 图22 (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

    .top

    Defined in

    layout.d.ts:33Scale - 图24 (opens new window)


    type

    Readonly type: string

    Defined in


    weight

    weight: number

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

    Inherited from

    LayoutItem.

    Defined in


    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

    index.esm.d.ts:1323Scale - 图30 (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:1320Scale - 图32 (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:1317Scale - 图34 (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:1314Scale - 图36 (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:1327Scale - 图38 (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:1330Scale - 图40 (opens new window)


    beforeLayout

    Optional beforeLayout(): void

    Called before the layout process starts

    Returns

    void

    Inherited from

    LayoutItem.

    Defined in


    beforeSetDimensions

    beforeSetDimensions(): void

    Returns

    Defined in


    beforeTickToLabelConversion

    beforeTickToLabelConversion(): void

    Returns

    void

    Defined in


    beforeUpdate

    beforeUpdate(): void

    Returns

    void

    Defined in


    buildTicks

    buildTicks(): []

    Returns

    []

    Defined in


    calculateLabelRotation

    calculateLabelRotation(): void

    Returns

    void

    Defined in


    configure

    configure(): void

    Returns

    void

    Defined in


    determineDataLimits

    determineDataLimits(): void

    Returns

    void

    Defined in


    draw

    draw(chartArea): void

    Draws the element

    Parameters

    NameType
    chartAreaChartArea

    Returns

    void

    Inherited from

    .draw

    Defined in

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


    drawGrid

    drawGrid(chartArea): void

    Parameters

    NameType
    chartArea

    Returns

    void

    Defined in

    index.esm.d.ts:1248Scale - 图50 (opens new window)


    drawLabels

    drawLabels(chartArea): void

    Parameters

    NameType
    chartArea

    Returns

    void

    Defined in

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


    drawTitle

    drawTitle(chartArea): void

    Parameters

    NameType
    chartArea

    Returns

    void

    Defined in

    index.esm.d.ts:1246Scale - 图52 (opens new window)


    fit(): void

    Returns

    void

    Defined in

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


    generateTickLabels

    generateTickLabels(ticks): void

    Parameters

    NameType
    ticks[]

    Returns

    void

    Defined in

    index.esm.d.ts:1325Scale - 图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:1254Scale - 图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:1279 (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:1309 (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: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

    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:1288 (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:1296 (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:1306 (opens new window)


    isFullSize

    isFullSize(): boolean

    Returns

    boolean

    Defined in

    index.esm.d.ts:1334Scale - 图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:1307Scale - 图75 (opens new window)


    setDimensions

    setDimensions(): void

    Returns

    void

    Defined in

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