Configuration tooltip

Specifies tooltip options.

Type: Object

A tooltip is a small pop-up rectangle that displays information about a hovered series point. You can enable or disable tooltips, format or customize the displayed text, and change the default appearance. Use the properties of the tooltip configuration object to do this. To learn more about tooltips and their options, refer to the Tooltips topic.

Show Example:
jQuery

In this example, tooltips are enabled. Hover over any point to see a tooltip.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        tooltip: {
            enabled: true
        }
    });
});

argumentFormat

Specifies a format for arguments of the chart's series points.

Type: String
Default Value: ''
Accepted Values: 'currency' | 'fixedPoint' | 'percent' | 'decimal' | 'exponential' | 'largeNumber' | 'thousands' | 'millions' | 'billions' | 'trillions' | 'longDate' | 'longTime' | 'monthAndDay' | 'monthAndYear' | 'quarterAndYear' | 'shortDate' | 'shortTime' | 'millisecond' | 'day' | 'month' | 'quarter' | 'year'

Use this property to set a format for arguments when they are displayed in tooltips. For a list of acceptable formats, refer to the format property. To learn how to set custom text for tooltips so that they include an argument value for the point that is currently hovered, refer to the customizeTooltip property. For general information on data formatting, refer to the Data Formatting topic.

argumentPrecision

Specifies a precision for formatted arguments displayed in tooltips.

Type: Number
Default Value: 0

This property's value must be an integer indicating how many digits to show in the argument displayed in tooltips. This property value is considered when tooltips display arguments in one of the following numeric formats: 'fixedPoint', 'exponential', 'currency', 'percent'. To learn how to set a format for arguments, refer to the argumentFormat property description. To learn how to set a custom text for tooltips so that they include an argument value of the currently hovered point, refer to the customizeTooltip property description. For general information on data formatting, refer to the Data Formatting topic.

arrowLength

Specifies the length of the tooltips' arrow, in pixels.

Type: Number
Default Value: 10

Show Example:
jQuery

In this example, the tooltip's arrowLength option is set to 30.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        tooltip: {
            enabled: true,
            arrowLength: 30
        }
    });
});

border

Specifies the appearance of the tooltip's border.

Type: Object

Show Example:
jQuery

In this example, several options of the tooltip's border are changed.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        palette: 'Vintage',
        tooltip: {
            enabled: true,
            format: 'largeNumber',
            border: {
                opacity: 0.8,
                width: 2,
                color: 'orchid'
            }
        }
    });
});

color

Specifies a color for the chart's tooltips.

Type: String
Default Value: '#ffffff'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)

This option sets one color for all tooltips on the widget. To specify a color for a particular tooltip, use the customizeTooltip option.

Show Example:
jQuery

In this example, the tooltip's color option is set to limegreen.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        tooltip: {
            enabled: true,
            color: 'limegreen'
        }
    });
});

container

Specifies the container to draw tooltips inside of it.

Default Value: undefined

By default, tooltips are shown within the body DOM element. Use this option if you need to specify another container for tooltips.

customizeText

Deprecated

Use the customizeTooltip option instead.

Specifies a callback function that returns the text to be displayed by tooltips.

Type: function

When implementing a callback function for this property, use the point value to be displayed in a tooltip. In addition, you can use the argument of the currently displayed value. To learn the full list of values that can be accessed within the callback function, refer to the customizeTooltip option description.

customizeTooltip

Allows you to change the appearance of specific tooltips.

Type: function(pointInfo)
Function parameters:
pointInfo: Object
Defines the point that is currently hovered over.
Return Value: Object
The text or markup to be displayed in a tooltip, along with that tooltip's settings.

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.

  • fontColor
    Specifies the color of the text displayed by a tooltip.

  • borderColor
    Specifies the color of the tooltip border.

When implementing the function for this option, you can use information about the tooltip's point. For example, you can access the argument or value of this point. To do this, use the following fields of the this object.

  • value
    Specifies the value of the currently hovered point.
  • valueText
    Specifies the value of the currently hovered point with applied formatting if the format and precision (optional) properties are specified.
  • argument
    Specifies the argument value of the currently hovered point.
  • argumentText
    Specifies the argument value of the currently hovered point with applied formatting if the argumentFormat and argumentPrecision (optional) properties are specified.
  • percent
    Specifies the percent value of the currently hovered point.
  • percentText
    Specifies the percent value of the currently hovered point with the 'percent' format and percentPrecision (optional) applied.
  • 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.

The function's parameter represents the same object as the this object. If appropriate, you can use the function's parameter to obtain the value that is currently represented by a tooltip.

To get general information on data formatting, refer to the Data Formatting topic.

View Demo

Show Example:
jQuery

In this example, those points, whose value is greater than 1 billion, have a tooltip painted in 'powderblue'.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population',
            type: 'doughnut'
        },
        title: 'Population by Continent',
        palette: 'Ocean',
        tooltip: {
            enabled: true,
            format: 'largeNumber',
            customizeTooltip: function (point) {
                if (point.value > 1000000000) {
                    return {
                        color: 'powderblue'
                    }
                };
            }
        }
    });
});

enabled

Specifies whether or not tooltips are enabled in the chart.

Type: Boolean
Default Value: false

Show Example:
jQuery

In the example below, use the check box to enable/disable tooltips. Hover over any point of the chart to see the effect.

<div id="pieChartContainer" style="height:400px; max-width:600px; margin: 0 auto"></div>
<div id="checkboxContainer" style="height:40px;width:200px;margin:5px auto;font-family:'Trebuchet MS',Arial,sans-serif;font-size:14px;text-align:center">
    <input type="checkbox" id="tooltipEnabledCheckbox" checked> Tooltips are enabled
</div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        tooltip: {
            enabled: true
        }
    });

    $('#tooltipEnabledCheckbox').change(function () {
        var pieChart = $('#pieChartContainer').dxPieChart('instance');
        pieChart.option({
            tooltip: { enabled: this.checked }
        });
    });
});

font

Specifies font options for the text displayed by tooltips.

Type: Object

Show Example:
jQuery

In this example, the font options of the tooltip text are altered.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        tooltip: {
            enabled: true,
            font: {
                color: 'lightcyan',
                family: 'Zapf-Chancery, cursive',
                size: 20,
                weight: 400
            }
        }
    });
});

format

Specifies a format for the text displayed by tooltips.

Type: String
Default Value: ''
Accepted Values: 'currency' | 'fixedPoint' | 'percent' | 'decimal' | 'exponential' | 'largeNumber' | 'thousands' | 'millions' | 'billions' | 'trillions' | 'longDate' | 'longTime' | 'monthAndDay' | 'monthAndYear' | 'quarterAndYear' | 'shortDate' | 'shortTime' | 'millisecond' | 'day' | 'month' | 'quarter' | 'year'

Tooltips display the value(s) of the point that is currently being hovered over by default. You can apply formatting to this value using one of the available formats.

NOTE: You can set a precision for a tooltip value when the 'fixedPoint', 'exponential', 'currency' or 'percent' format is applied. Use the precision and argumentPrecision properties to do this.

For details on formatting, refer to the Data Formatting topic.

Show Example:
jQuery

The example below represents a chart with formatted tooltip text. The tooltip displays the value of the hovered point in the 'largeNumber' format.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        tooltip: {
            enabled: true,
            format: 'largeNumber'
        }
    });
});

opacity

Specifies the opacity of tooltips.

Type: Number
Default Value: undefined

Show Example:
jQuery

In this example, tooltips are displayed with a 0.6 opacity.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        palette: 'Violet',
        tooltip: {
            enabled: true,
            format: 'largeNumber',
            opacity: 0.6
        }
    });
});

paddingLeftRight

Specifies the blank space between a tooltip's left/right boundaries and the inner text in pixels.

Type: Number
Default Value: 24

TooltipPadding ChartJS

paddingTopBottom

Specifies the blank space between a tooltip's top/bottom boundaries and the inner text in pixels.

Type: Number
Default Value: 6

TooltipPadding ChartJS

percentPrecision

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

Type: Number
Default Value: 0

To display a percent value in tooltips, use the customizeTooltip callback function. Return an object from this function. Within this object, assign the percent or percentText field of the this object to the text field.

Show Example:
jQuery

In this example, the tooltip text is displayed as a percentage value. The precision of this value is set to 5 using the percentPrecision option.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        tooltip: {
            enabled: true,
            customizeTooltip: function (point) {
                return {
                    text: point.percentText
                };
            },
            percentPrecision: 5
        }
    });
});

precision

Specifies a precision for formatted values displayed in tooltips.

Type: Number
Default Value: 0

This property's value must be an integer indicating how many digits to show in the value displayed in tooltips. This property value is considered when tooltips display values in one of the following numeric formats: 'fixedPoint', 'exponential', 'currency', 'percent'. To learn how to set a format for point values, refer to the format property description. For general information on data formatting, refer to the Data Formatting topic.

Show Example:
jQuery

The example below shows a chart with formatted tooltip text. The tooltip displays the value of the corresponding point in the 'fixedPoint' format with a precision of 2.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        tooltip: {
            enabled: true,
            format: 'largeNumber',
            precision: 2
        }
    });
});

shadow

Specifies options of the tooltip's shadow.

Type: Object

zIndex

Specifies the z-index for tooltips.

Type: Number
Default Value: undefined

If the widget's container has a CSS z-index property and tooltips are displayed incorrectly, you can configure the tooltips' z-index by using this option.