Configuration 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.

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: 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 the Installation topic.

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 the tooltip's arrow in pixels.

Type: Number
Default Value: 10

Show Example:
jQuery

In this example, tooltips have a 5-pixel arrow.

<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: 5
        }
    });
});

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 the color of tooltips.

Type: String
Default Value: '#ffffff'

This option supports the following colors.

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

Show Example:
jQuery

In this example, tooltips are painted in 'powderblue' using the color 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,
            color: 'powderblue'
        }
    });
});

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.

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.

    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.

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 property is 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 property is specified.
  • percent
    Specifies the percent value of the currently hovered point.
  • percentText
    Specifies the percent value of the currently hovered point with 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

Enables tooltips.

Type: Boolean
Default Value: false

Show Example:
jQuery

In this example, use the check box to enable/disable tooltips. Hover over any series point 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 the font of the text displayed by a tooltip.

Type: Object

Show Example:
jQuery

In this example, the font of the tooltip's text is 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',
        tooltip: {
            enabled: true,
            font: {
                color: 'lightcyan',
                family: 'Zapf-Chancery, cursive',
                size: 20,
                weight: 400
            }
        }
    });
});

format

Specifies the format of the value displayed by a tooltip.

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 the Installation topic.

See Also
  • format - provides a comprehensive overview of formatting capabilities.
  • Data Formatting - shows how to apply formatting to various widget elements.
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.45 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.45
        }
    });
});

paddingLeftRight

Generates space on the left and the right of the text displayed by a tooltip.

Type: Number
Default Value: 18

TooltipPadding ChartJS

paddingTopBottom

Generates space above and below the text displayed by a tooltip.

Type: Number
Default Value: 15

TooltipPadding ChartJS

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

Specifies the appearance of the tooltip's shadow.

Type: Object

zIndex

Specifies the z-index of tooltips.

Type: Number
Default Value: undefined

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