JavaScript/jQuery Chart - tooltip

Configures tooltips.

Type:

Object

A tooltip is a miniature rectangle displaying values of a series point. A tooltip appears when the end-user hovers the cursor over a series point. You can enable/disable tooltips, change their appearance and format their text using fields of the tooltip configuration object.

argumentFormat

Formats the point argument before it is displayed in the tooltip. To format the point value, use the format option.

Type:

Format

Default Value: undefined

NOTE
DevExtreme widgets provide a wide choice of predefined formats. If you are, however, going to use custom formats, link the Globalize library to your project. Learn how to do this from topics in the Installation section.
See Also
  • format - provides a comprehensive overview of formatting capabilities.
  • Data Formatting - shows how to apply formatting to various widget elements.

argumentPrecision Deprecated

Use the tooltip.argumentFormat.precision option instead.

Specifies a precision for formatted arguments displayed in tooltips.

Type:

Number

Default Value: undefined

arrowLength

Specifies the length of a tooltip's arrow in pixels.

Type:

Number

Default Value: 10

border

Configures a tooltip's border.

Type:

Object

color

Colors all tooltips.

Type:

String

Default Value: '#ffffff'

This option supports the following colors:

This option sets one color for all tooltips. You can specify a particular tooltip's color in the tooltip.customizeTooltip function.

container

Specifies the container in which to draw tooltips. The default container is the HTML DOM <body> element.

Type:

String

|

DOM Node

|

jQuery

Default Value: undefined

customizeTooltip

Allows you to change tooltip appearance.

Type:

Function

Function parameters:
pointInfo:

Object

Information on the series point being pressed or hovered over with the mouse pointer.

Return Value:

Object

The tooltip's text or markup and appearance settings.

Default Value: undefined
Cannot be used in themes.

This option should be assigned a function returning a specific object. The following fields can be specified in this object.

  • color
    Specifies the color of a tooltip.

  • text
    Specifies the text displayed by a tooltip.

  • html
    Specifies the HTML markup displayed by a tooltip.

    NOTE
    If you are going to use external resources (for example, images) in the markup, specify the size of the area they will occupy beforehand.
  • fontColor
    Specifies the color of the text displayed by a tooltip.

  • borderColor
    Specifies the color of the tooltip border.

The function's parameter has the following fields:

  • originalValue
    Specifies the value of the currently represented point as it is set in the data source.
  • value
    Specifies the value of the currently represented point. Differs from the originalValue when the axis value type is specified explicitly. In this instance, the value field contains a value in the specified type.
  • valueText
    Specifies the value of the currently hovered point with applied formatting if the format property is specified.
  • valueText (for candle stick and stock series)
    Specifies a string of the values of the currently represented point. This string contains the highValueText, openValueText, closeValueText and lowValueText values.
    The format of the string is the following: "h: %highValueText% o: %openValueText% c: %closeValueText% l: %lowValueText%".
  • valueText (for range area and range bar series)
    Specifies a string of the values of the currently represented point. This string contains the rangeValue1Text and rangeValue2Text values.
    The format of the string is the following: "%rangeValue1Text% - %rangeValue2Text%".
  • originalArgument
    Specifies the argument value of the currently represented point as it is set in the data source.
  • argument
    Specifies the argument value of the currently represented point. Differs from the originalArgument when the axis' argument type differs from the argument type in the data source. In this instance, argument has the type of the argument axis.
  • argumentText
    Specifies the argument value of the currently hovered point with applied formatting if the argumentFormat option is specified.
  • size (for bubble series only)
    Specifies the size of the bubble that is hovered over as it is set in the data source.
  • seriesName
    Specifies the series of the currently hovered point.
  • point
    Provides access to the hovered point. To learn more about the field and methods of the point object, refer to the Point topic in the "Chart Elements" reference section.
  • points (for shared tooltip only)
    Provides access to the array of points with the same argument as the currently hovered point. This field is accessible when the shared option of the tooltip object is set to true. To learn more about the fields and methods of the point object, refer to the Point topic in the "Chart Elements" reference section.

The following fields come with the stacked-like series such as full-stacked bar or full-stacked area.

  • percent
    Specifies the percent value of the currently hovered point.
  • percentText
    Specifies the percent value of the currently hovered point with percentPrecision (optional) applied.
  • total
    Specifies the total value of all the points with the same argument as the currently hovered point.
  • totalText
    Specifies the total value of all the points with the same argument as the currently hovered point. This value is displayed with applied formatting if the format option is specified.

The following fields come with the range-like series, such as range area or range bar.

  • originalMinValue
    Specifies the first range value of the currently hovered point as it is set in the data source.
  • rangeValue1
    Specifies the first range value of the currently hovered point. Differs from the originalMinValue when the axis value type is specified explicitly. In this instance, the rangeValue1 field contains the first range value in the specified type.
  • rangeValue1Text
    Specifies the first range value of the currently hovered point with applied formatting if the format property is specified.
  • originalValue
    Specifies the second range value of the currently hovered point as it is set in the data source.
  • rangeValue2
    Specifies the second range value of the currently hovered point. Differs from the originalValue when the axis value type is specified explicitly. In this instance, the rangeValue2 field contains the second range value in the specified type.
  • rangeValue2Text
    Specifies the second range value of the currently hovered point with applied formatting if the format property is specified.

The following fields come with financial chart series, such as candle stick or stock.

  • originalOpenValue
    Specifies the open value of the currently hovered point as it is set in the data source.
  • openValue
    Specifies the open value of the currently hovered point. Differs from the originalOpenValue when the value in the data source is not in a numeric format.
  • openValueText
    Specifies the open value of the currently hovered point with applied formatting if the format option is specified.
  • originalCloseValue
    Specifies the close value of the currently hovered point as it is set in the data source.
  • closeValue
    Specifies the close value of the currently hovered point. Differs from the originalCloseValue when the value in the data source is not in a numeric format.
  • closeValueText
    Specifies the close value of the currently hovered point with applied formatting if the format option is specified.
  • originalHighValue
    Specifies the high value of the currently hovered point as it is set in the data source.
  • highValue
    Specifies the high value of the currently hovered point. Differs from the originalHighValue when the value in the data source is not in a numeric format.
  • highValueText
    Specifies the high value of the currently hovered point with applied formatting if the format option is specified.
  • originalLowValue
    Specifies the low value of the currently hovered point as it is set in the data source.
  • lowValue
    Specifies the low value of the currently hovered point. Differs from the originalLowValue when the value in the data source is not in a numeric format.
  • lowValueText
    Specifies the low value of the currently hovered point with applied formatting if the format option is specified.
  • reductionValue
    Specifies the reduction value of the currently hovered point.
  • reductionValueText
    Specifies the reduction value of the currently hovered point with applied formatting if the format option is specified.
NOTE
As an alternative to the function’s parameter you can use the this keyword.

Display a Tooltip Demo Tooltip HTML Support Demo

See Also

enabled

Enables tooltips.

Type:

Boolean

Default Value: false

font

Specifies tooltips' font options.

Type:

Object

format

Formats a value before it is displayed it in a tooltip.

Type:

Format

Default Value: undefined

See the format section for details on accepted values.

See Also

location

Specifies whether the tooltip must be located in the center of a series point or on its edge. Applies to bar-like and bubble series only.

Type:

String

Default Value: 'center'
Accepted Values: 'center' | 'edge'
This member is exposed by the following entities:

Use the ChartTooltipLocation enum to specify this option when the widget is used as an ASP.NET MVC Control. This enum accepts the following values: Center and Edge.

opacity

Specifies tooltips' transparency.

Type:

Number

Default Value: undefined

This option accepts a value from 0 to 1, where 0 makes tooltips completely transparent, and 1 makes them opaque.

paddingLeftRight

Generates an empty space, measured in pixels, between a tooltip's left/right border and its text.

Type:

Number

Default Value: 18

DevExtreme HTML5 JavaScript Funnel Tooltips Left-Right Padding

paddingTopBottom

Generates an empty space, measured in pixels, between a tooltip's top/bottom border and its text.

Type:

Number

Default Value: 15

DevExtreme HTML5 JavaScript Funnel Tooltips Top-Bottom Padding

percentPrecision Deprecated

Use the tooltip.format.percentPrecision option instead.

Specifies a precision for a percent value displayed in tooltips for stacked series and PieChart series.

Type:

Number

Default Value: undefined

precision Deprecated

Use the tooltip.format.precision option instead.

Specifies the precision of formatted values in a tooltip.

Type:

Number

Default Value: undefined

shadow

Configures a tooltip's shadow.

Type:

Object

shared

Specifies the kind of information to display in a tooltip.

Type:

Boolean

Default Value: false

By default, a tooltip displays information about the currently hovered series point. If you set the shared option to true, the tooltip will display information about all the points that have the same argument as the hovered point at once.

If the text displayed in the tooltip by default doesn't suit your needs, you can customize it using the customizeTooltip option.

zIndex

Specifies a tooltip's z-index.

Type:

Number

Default Value: undefined

If the widget's container has the CSS z-index property specified, and tooltips are displayed incorrectly, configure their z-index using this option.