ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Chart functions
  • Tooltip options to configure
  • Enabling/Disabling the tooltip
  • Formatting the elements displayed in the tooltip
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Displays and formats:
  • the tooltip associated with each section of a chart (section of a Pie chart, column of a Column chart, etc.). This function also gets the characteristics of the tooltip associated with each section of the chart.
  • a custom tooltip, associated with a point.
By default, a tooltip is automatically displayed (grShowTooltip set to True) when a chart is hovered by the mouse cursor.
WEBDEV - Server codeWEBDEV - Browser code In a page of a WEBDEV website, the chart must be interactive in order for the tooltip to be displayed. To make the chart interactive, check "Interactive chart" in the "Details" tab of the control description.
Example
WindowsLinux
// Chart created programmatically
i is int
// Create the chart
grCreate("MyChart", grPie)
// Destination of the chart
grDestinationControl("MyChart", IMG_Image1)
// Display the percentages
grLabel("MyChart", grShowPercent, True)
// Add data
nValue is int
FOR i = 1 TO 200
nValue = Random(30)
grAddData("MyChart", 1, nValue)
grCategoryLabel("MyChart", i, "Test" + i)
grSeriesLabel("MyChart", 1, "Test series")
END
grTooltip("MyChart", grTooltipFormatPie, -%"[%SERIES%]" + CR + ...
-%"[%CATEGORY%]" + CR + -%"[%%%]")
grTooltip("MyChart", grShowTooltip, True)
// Draw the chart
grDraw("MyChart")
// Chart control
// Display the percentages on a column chart
grLabel(CHART_MyChart, grShowPercent, True)
grTooltip(CHART_MyChart, grTooltipFormat, -%"[%SERIES%]" + CR + -%"[%CATEGORY%]" + ...
CR + -%"[%VALUE%]")
grTooltip(CHART_MyChart, grShowTooltip, True)
// Draw the chart
grDraw(CHART_MyChart)
// Chart control
// Display a specific tooltip for a point
grTooltip(CHART_MyChart, 1, 2, "The tooltip content")
// Draw the chart
grDraw(CHART_MyChart)
Syntax

Displaying and formatting the tooltip associated with a chart Hide the details

grTooltip(<Chart name> , <Tooltip option to configure> , <Tooltip option value>)
<Chart name>: Control name or character string
Name of the chart to be used. This name corresponds to:
  • the name of the chart defined programmatically with grCreate.
  • the name of the Chart control in the window editor.
WEBDEV - Browser codePHP Only interactive Chart controls are available.
<Tooltip option to configure>: Integer constant
Enables or disables the tooltip and configures its characteristics.
grShowTooltipEnables or disables the tooltip.
grTooltipFormatDefines the tooltip format.
grTooltipFormatBubbleChartDefines the tooltip format in a Bubble chart.
grTooltipFormatCrosshairHeaderDefines the format of the chart crosshair header.
grTooltipFormatHeatMapDefines the tooltip format in a Heatmap chart.
grTooltipFormatPieDefines the tooltip format in a Pie chart.
grTooltipFormatRangeAreaDefines the tooltip format in a Range Area chart.
grTooltipFormatScatterDefines the tooltip format in a Scatter chart.
grTooltipFormatStockDefines the tooltip format in a Stock chart.
New in version 2024
grTooltipFormatWaffle
Defines the tooltip format in a Waffle chart.
<Tooltip option value>: Character string or boolean
Value of the selected tooltip option. This value depends on the selected option (see the above table).

Getting the characteristics of the tooltip associated with a chart Hide the details

<Result> = grTooltip(<Chart name> , <Tooltip option>)
<Result>: Type corresponding to the option (boolean or character string)
Value of the search option.
<Chart name>: Control name or character string
Name of the chart to be used. This name corresponds to:
  • the name of the chart defined programmatically with grCreate.
  • the name of the Chart control in the window editor.
WEBDEV - Browser codePHP Only interactive Chart controls are available.
<Tooltip option>: Integer constant
Tooltip option whose value you want to get.
grShowTooltipEnables or disables the tooltip.
grTooltipFormatDefines the tooltip format.
grTooltipFormatBubbleChartDefines the tooltip format in a Bubble chart.
grTooltipFormatCrosshairHeaderDefines the format of the chart crosshair header.
grTooltipFormatHeatMapDefines the tooltip format in a Heatmap chart.
grTooltipFormatPieDefines the tooltip format in a Pie chart.
grTooltipFormatRangeAreaDefines the tooltip format in a Range Area chart.
grTooltipFormatScatterDefines the tooltip format in a Scatter chart.
grTooltipFormatStockDefines the tooltip format in a Stock chart.
New in version 2024
grTooltipFormatWaffle
Defines the tooltip format in a Waffle chart.

Displaying and customizing the tooltip associated with a point Hide the details

grTooltip(<Chart name> , <Series number> , <Category number> , <Tooltip value>)
<Chart name>: Control name or character string
Name of the chart to be used. This name corresponds to:
  • the name of the chart defined programmatically with grCreate.
  • the name of the Chart control in the window or page editor.
WEBDEV - Browser codePHP Only interactive Chart controls are available.
<Series number>: Integer
Number of the series to use.
<Category number>: Integer
Number of the category to use.
<Tooltip value>: Character string
Custom text of the tooltip associated with the point.
Remarks

Tooltip options to configure

ConstantEffectOption value
grShowTooltipEnables or disables the tooltip.Boolean
  • True (by default) to enable the tooltip,
  • False to disable the tooltip.
Caution: tooltip parameters are not reset on display.
grTooltipFormatDefines the tooltip format.Character string
  • Empty string to use the default format.
  • Combination of the following strings:
    [%SERIES%]: Displays the series label (defined by grSeriesLabel).
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
    [%VALUE%]: Displays the value
    Example: "[%VALUE%]"+CR+"[%CATEGORY%]"
By default, the format is as follows: "[%CATEGORY%]"+CR+"[%SERIES%]"+"="+"[%VALUE%]"
grTooltipFormatStockDefines the tooltip format in a Stock chart.Character string
  • Empty string to use the default format.
  • Combination of the following strings:
    [%SERIES%]: Displays the series label (defined by grSeriesLabel).
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
    [%MAX%]: Displays the highest value of the trading session.
    [%MIN%]: Displays the lowest value of the trading session.
    [%OPEN%]: Displays the opening value of the trading session.
    [%CLOSE%]: Displays the closing value of the trading session.
By default, the format is as follows:
"[%CATEGORY%]"+CR+"Min.=[%MIN%]"+CR+"Max.=[%MAX%]"+CR+"Open=[%OPEN%]"+CR+"Close=[%CLOSE%]"
grTooltipFormatRadialBarDefines the tooltip format in a Radial Bar chart.Character string
  • Empty string to use the default format.
  • Combination of the following strings:
    [%SERIES%]: Displays the series label (defined by grSeriesLabel).
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
    [%VALUE%]: Displays the value
    [%%%]: Displays the percentage
    Example: "[%VALUE%]"+CR+"[%CATEGORY%]"+CR+"[%%%]"
By default, the format is as follows: "[%CATEGORY%]"+CR+"[%VALUE%]"+CR+"[%%%]"
grTooltipFormatCrosshairHeaderDefines the format of the chart crosshair header.Character string
  • Empty string to use the default format.
  • Character string containing the following string:
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
By default, the format is as follows: "[%CATEGORY%]" Stacked Column chart: You can add the total value of a stacked column to the tooltip of a Stacked Column chart by using the following syntax:
grTooltip(MySelf, grTooltipFormatCrosshairHeader, ...
"[%CATEGORY%], Sum = [%VALUE%]")
grTooltipFormatBubbleChartDefines the tooltip format in a Bubble chart.Character string
  • Empty string to use the default format.
  • Combination of the following strings:
    [%SERIES%]: Displays the series label (defined by grSeriesLabel).
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
    [%X%]: Displays the X-coordinate (first series)
    [%Y%]: Displays the Y-coordinate (second series)
    [%Z%]: Displays the value of the third series.
By default, the format is as follows: "([%X%];[%Y%]): [%Z%]"+CR+"[%CATEGORY%]"
grTooltipFormatScatterDefines the tooltip format in a Scatter chart.Character string
  • Empty string to use the default format.
  • Combination of the following strings:
    [%SERIES%]: Displays the series label (defined by grSeriesLabel).
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
    [%X%]: Displays the X-coordinate.
By default, the format is as follows: "[%X%]"+CR+"[%Y%]"+CR+"[%SERIES%]"+CR+"[%CATEGORY%]"
grTooltipFormatHeatMapDefines the tooltip format in a Heatmap chart. Character string
  • Empty string to use the default format.
  • Combination of the following strings:
    [%SERIES%]: Displays the series label (defined by grSeriesLabel).
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
    [%X%]: Displays the X-coordinate (first series)
    [%Y%]: Displays the Y-coordinate (second series)
    [%Z%]: Displays the value of the third series.
By default, the format is as follows: "([%X%];[%Y%]): [%Z%]"+CR+"[%CATEGORY%]"
grTooltipFormatPieDefines the tooltip format in a Pie chart.Character string
  • Empty string to use the default format.
  • Combination of the following strings:
    [%SERIES%]: Displays the series label (defined by grSeriesLabel).
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
    [%VALUE%]: Displays the value
    [%%%]: Displays the percentage
    Example: "[%VALUE%]"+CR+"[%CATEGORY%]"+CR+"[%%%]"
By default, the format is as follows: "[%CATEGORY%]"+CR+"[%VALUE%]"+CR+"[%%%]"
New in version 2024
grTooltipFormatWaffle
Defines the tooltip format in a Waffle chart.Character string
  • Empty string to use the default format.
  • Combination of the following strings:
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
    [%VALUE%]: Displays the value
    [%%%]: Displays the percentage
    Example: "[%VALUE%]"+CR+"[%CATEGORY%]"+CR+"[%%%]"
By default, the format is as follows: "[%CATEGORY%]"+CR+"[%VALUE%]"+CR+"[%%%]"
grTooltipFormatRangeAreaDefines the tooltip format in a Range Area chart.Character string
  • Empty string to use the default format.
  • Combination of the following strings:
    [%OPEN%]: Displays the opening value of the range.
    [%CLOSE%]: Displays the closing value of the range.
    [%CATEGORY%]: Displays the category label (defined by grCategoryLabel).
    Example: "[%OPEN%]"+CR+"[%CLOSE%]"+CR+"[%CATEGORY%]"
By default, the format is as follows: "[%OPEN%]"+CR+"[%CLOSE%]

If the default format is used:
  • "[%CATEGORY%]" is ignored if no category label was specified by grCategoryLabel.
  • "[%SERIES%]" is ignored if no series label was specified with grSeriesLabel.
Caution: If you use dynamic string construction ("Allow "[% %]" in strings" in the "Compilation" tab of the project description), a compilation error occurs (unknown identifier). In this case, each string must be preceded by '-%'. Example:
grTooltip(CHART_Deadline, grTooltipFormat, "[%CATEGORY%]" + CR + CR+ "[%VALUE%]" + " H")
becomes
grTooltip(CHART_Deadline, grTooltipFormat, -%"[%CATEGORY%]" + CR + CR + -%"[%VALUE%]" + " H")

Enabling/Disabling the tooltip

The tooltip activation/deactivation (grShowTooltip constant) takes effect only when grDraw is executed.
WEBDEV - Browser code The activation/deactivation of the tooltip (grShowTooltip constant) takes effect immediately.

Formatting the elements displayed in the tooltip

To format the values displayed in the tooltip (value and percentage), use grMask.
Business / UI classification: UI Code
Component: wd290grf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 02/14/2024

Send a report | Local help