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 customizeText 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 customizeText 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
        }
    });
});

color

Specifies a color for the chart's tooltips.

Type: String
Default Value: undefined

Tooltips are displayed in the color of the currently hovered series by default. You can set a custom color for all tooltips in a chart. To do this, use the color property of the tooltip object. 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)
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'
        }
    });
});

customizeText

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

Type: function(pointInfo)
Function parameters:
pointInfo: Object
Defines the point value to be displayed in a tooltip.
Return Value: String
The text to be displayed in a tooltip.

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. These values can be accessed using the following properties 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.

Show Example:
jQuery

In the example below, the tooltip's customizeText option is used to display a percentage value with its precision set to 3.

<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,
            customizeText: function (point) {
                return point.percentText;
            },
            percentPrecision: 3
        }
    });
});

enabled

Specifies whether tooltips are enabled in the chart.

Type: Boolean
Default Value: false
Accepted Values: true|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'
        }
    });
});

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 customizeText callback function. Return the percent or percentText property value of the this object that is available in the function.

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,
            customizeText: function (point) {
                return 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 presicion 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
        }
    });
});