Interface: TooltipOptions<TType>

Type parameters

NameType
TTypeChartType

Hierarchy

Properties

animation

• animation: AnimationSpec<TType>

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


animations

• animations: AnimationsSpec<TType>

Defined in: index.esm.d.ts:2498TooltipOptions - 图2 (opens new window)


axis

• axis: x | y | xy

Can be set to ‘x’, ‘y’, or ‘xy’ to define which directions are used in calculating distances. Defaults to ‘x’ for ‘index’ mode and ‘xy’ in dataset and ‘nearest’ modes.

Inherited from: CoreInteractionOptions.axis

Defined in: index.esm.d.ts:1343TooltipOptions - 图3 (opens new window)


backgroundColor

• backgroundColor: Scriptable<Color, ScriptableTooltipContext<TType>>

Background color of the tooltip.

default ‘rgba(0, 0, 0, 0.8)’

Defined in: index.esm.d.ts:2360TooltipOptions - 图4 (opens new window)


bodyAlign

• bodyAlign: Scriptable<TextAlign, ScriptableTooltipContext<TType>>

Horizontal alignment of the body text lines.

default ‘left’

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


bodyColor

• bodyColor: Scriptable<Color, ScriptableTooltipContext<TType>>

Color of body

default ‘#fff’

Defined in: index.esm.d.ts:2395TooltipOptions - 图6 (opens new window)


bodyFont

• bodyFont: Scriptable<FontSpec, ScriptableTooltipContext<TType>>

See Fonts.

default {}

Defined in: index.esm.d.ts:2400TooltipOptions - 图7 (opens new window)


bodySpacing

• bodySpacing: Scriptable<number, ScriptableTooltipContext<TType>>

Spacing to add to top and bottom of each tooltip item.

default 2

Defined in: index.esm.d.ts:2390TooltipOptions - 图8 (opens new window)


borderColor

• borderColor: Scriptable<Color, ScriptableTooltipContext<TType>>

Color of the border.

default ‘rgba(0, 0, 0, 0)’

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


borderWidth

• borderWidth: Scriptable<number, ScriptableTooltipContext<TType>>

Size of the border.

default 0

Defined in: index.esm.d.ts:2485TooltipOptions - 图10 (opens new window)


boxHeight

• boxHeight: Scriptable<number, ScriptableTooltipContext<TType>>

Height of the color box if displayColors is true.

default bodyFont.size

Defined in: index.esm.d.ts:2470TooltipOptions - 图11 (opens new window)


boxWidth

• boxWidth: Scriptable<number, ScriptableTooltipContext<TType>>

Width of the color box if displayColors is true.

default bodyFont.size

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


callbacks

• callbacks: TooltipCallbacks<TType, TooltipModel<TType>, TooltipItem<TType>>

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


caretPadding

• caretPadding: Scriptable<number, ScriptableTooltipContext<TType>>

Extra distance to move the end of the tooltip arrow away from the tooltip point.

default 2

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


caretSize

• caretSize: Scriptable<number, ScriptableTooltipContext<TType>>

Size, in px, of the tooltip arrow.

default 5

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


cornerRadius

• cornerRadius: Scriptable<number, ScriptableTooltipContext<TType>>

Radius of tooltip corner curves.

default 6

Defined in: index.esm.d.ts:2450TooltipOptions - 图16 (opens new window)


displayColors

• displayColors: Scriptable<boolean, ScriptableTooltipContext<TType>>

If true, color boxes are shown in the tooltip.

default true

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


enabled

• enabled: Scriptable<boolean, ScriptableTooltipContext<TType>>

Are on-canvas tooltips enabled?

default true

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


filter

• filter: (e: TooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>, index: number, array: TooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>[], data: ChartData<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>) => boolean

Type declaration:

▸ (e: TooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>, index: number, array: TooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>[], data: ChartData<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>): boolean

Parameters:

NameType
eTooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>
indexnumber
arrayTooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>[]
dataChartData<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>

Returns: boolean

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

Defined in: index.esm.d.ts:2354TooltipOptions - 图20 (opens new window)


footerAlign

• footerAlign: Scriptable<TextAlign, ScriptableTooltipContext<TType>>

Horizontal alignment of the footer text lines.

default ‘left’

Defined in: index.esm.d.ts:2430TooltipOptions - 图21 (opens new window)


footerColor

• footerColor: Scriptable<Color, ScriptableTooltipContext<TType>>

Color of footer

default ‘#fff’

Defined in: index.esm.d.ts:2420TooltipOptions - 图22 (opens new window)


footerFont

• footerFont: Scriptable<FontSpec, ScriptableTooltipContext<TType>>

See Fonts

default {style: ‘bold’}

Defined in: index.esm.d.ts:2425TooltipOptions - 图23 (opens new window)


footerMarginTop

• footerMarginTop: Scriptable<number, ScriptableTooltipContext<TType>>

Margin to add before drawing the footer.

default 6

Defined in: index.esm.d.ts:2415TooltipOptions - 图24 (opens new window)


footerSpacing

• footerSpacing: Scriptable<number, ScriptableTooltipContext<TType>>

Spacing to add to top and bottom of each footer line.

default 2

Defined in: index.esm.d.ts:2410TooltipOptions - 图25 (opens new window)


intersect

• intersect: boolean

if true, the hover mode only applies when the mouse position intersects an item on the chart.

default true

Inherited from: CoreInteractionOptions.intersect

Defined in: index.esm.d.ts:1338TooltipOptions - 图26 (opens new window)


itemSort

• itemSort: (a: TooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>, b: TooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>, data: ChartData<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>) => number

Sort tooltip items.

Type declaration:

▸ (a: TooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>, b: TooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>, data: ChartData<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>): number

Parameters:

NameType
aTooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>
bTooltipItem<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>
dataChartData<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>

Returns: number

Defined in: index.esm.d.ts:2352TooltipOptions - 图27 (opens new window)

Defined in: index.esm.d.ts:2352TooltipOptions - 图28 (opens new window)


mode

• mode: x | y | dataset | index | point | nearest

Sets which elements appear in the tooltip. See Interaction Modes for details.

default ‘nearest’

Inherited from: CoreInteractionOptions.mode

Defined in: index.esm.d.ts:1333TooltipOptions - 图29 (opens new window)


multiKeyBackground

• multiKeyBackground: Scriptable<Color, ScriptableTooltipContext<TType>>

Color to draw behind the colored boxes when multiple items are in the tooltip.

default ‘#fff’

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


padding

• padding: Scriptable<number | ChartArea, ScriptableTooltipContext<TType>>

Padding to add to the tooltip

default 6

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


position

• position: Scriptable<nearest | average, ScriptableTooltipContext<TType>>

The mode for positioning the tooltip

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


rtl

• rtl: Scriptable<boolean, ScriptableTooltipContext<TType>>

true for rendering the legends from right to left.

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


textDirection

• textDirection: Scriptable<string, ScriptableTooltipContext<TType>>

This will force the text direction ‘rtl’ or ‘ltr on the canvas for rendering the tooltips, regardless of the css specified on the canvas

default canvas’s default

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


titleAlign

• titleAlign: Scriptable<TextAlign, ScriptableTooltipContext<TType>>

Horizontal alignment of the title text lines.

default ‘left’

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


titleColor

• titleColor: Scriptable<Color, ScriptableTooltipContext<TType>>

Color of title

default ‘#fff’

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


titleFont

• titleFont: Scriptable<FontSpec, ScriptableTooltipContext<TType>>

See Fonts

default {style: ‘bold’}

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


titleMarginBottom

• titleMarginBottom: Scriptable<number, ScriptableTooltipContext<TType>>

Margin to add on bottom of title section.

default 6

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


titleSpacing

• titleSpacing: Scriptable<number, ScriptableTooltipContext<TType>>

Spacing to add to top and bottom of each title line.

default 2

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


usePointStyle

• usePointStyle: Scriptable<boolean, ScriptableTooltipContext<TType>>

Use the corresponding point style (from dataset options) instead of color boxes, ex: star, triangle etc. (size is based on the minimum value between boxWidth and boxHeight)

default false

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


xAlign

• xAlign: Scriptable<TextAlign, ScriptableTooltipContext<TType>>

Override the tooltip alignment calculations

Defined in: index.esm.d.ts:2346TooltipOptions - 图41 (opens new window)


yAlign

• yAlign: Scriptable<TooltipYAlignment, ScriptableTooltipContext<TType>>

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

Methods

external

▸ external(args: { chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown> ; tooltip: TooltipModel<TType> }): void

See external tooltip section.

Parameters:

NameType
argsobject
args.chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>
args.tooltipTooltipModel<TType>

Returns: void

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