Tooltip in ASP.NET Core Accumulation chart component
18 Nov 20183 minutes to read
Tooltip for the accumulation chart can be enabled by using the Enable property.
Header
We can specify header for the tooltip using Header property.
Format
By default, tooltip shows information of x and y value in points. In addition to that, you can show more information in tooltip. For example the format ${series.name} ${point.x} shows series name and point x value.
Inline tooltip formatting
The tooltip content can be formatted directly within the format property by adding DateTime or number format specifiers to supported tooltip tokens. This allows you to control how point and series values are displayed without using additional events.
A format specifier can be applied to a tooltip token by adding a colon (:) followed by the required format.
For example:
<e-accumulationchart-tooltipsettings enable="true" format="${point.x:MMM yyyy} : <b>${point.y:n2}%</b>">
</e-accumulationchart-tooltipsettings>In the above example, point.x is displayed in month-year format, and point.y is displayed with two decimal places.
Inline formatting can be applied to the following tooltip tokens:
-
point.x– Specifies the x-value or category value of the accumulation chart point. -
point.y– Specifies the numeric y-value of the accumulation chart point. -
point.percentage– Specifies the percentage contribution of the point value in the accumulation chart. -
point.text– Specifies the text value mapped to the point, when text mapping is configured. -
point.tooltip– Specifies the tooltip value mapped from the data source, when tooltip mapping is configured. -
point.index– Specifies the index position of the point in the accumulation chart. -
point.color– Specifies the fill color applied to the point. -
point.visible– Specifies the visibility state of the point. -
series.name– Specifies the name assigned to the accumulation chart series. -
series.type– Specifies the rendering type of the accumulation chart series, such asPie,Doughnut,Pyramid, orFunnel. -
series.opacity– Specifies the opacity value applied to the accumulation chart series. This value controls the visual transparency of the series and can be customized in the series configuration.
Important: The availability of point-specific tokens depends on the values configured in the data source and the accumulation chart series type. For example, point.percentage is useful for pie and doughnut charts, while point.text and point.tooltip depend on the corresponding field mappings. The series.name and series.type tokens return string values, so DateTime or number formatting is not applied to these tokens.
The following format types are supported:
- DateTime formats such as
MMM yyyy,MM:yy, anddd MMM - Number formats such as:
-
n2– number with two decimal places -
n0– number without decimals -
c2– currency format -
p1– percentage format -
e1– exponential notation
-
If the specified format does not match the resolved value type, the original value is displayed.
Tooltip format
Any HTML element can be displayed in the tooltip by using the Template property.
Fixed tooltip
By default, tooltip track the mouse movement, but you can set a fixed position for the tooltip by using the Location property.
Customization
The Fill and Border properties are used to customize the background color and border of the tooltip respectively. The TextStyle property in the tooltip is used to customize the font of the tooltip text. The HighlightColor property can be used to change the color of the data point when hovering.
To customize individual tooltip
Using TooltipRender event, you can customize a tooltip for particular point.
Tooltip mapping name
By default, tooltip shows information of x and y value in points. You can show more information from datasource in tooltip by using the TooltipMappingName property of the tooltip. You can use the ${point.tooltip} as place holders to display the specified tooltip content.
Enable highlight
By setting the EnableHighlight property to true, the hovered pie slice is highlighted, while the remaining slices are dimmed, enhancing focus and clarity.
Follow pointer
The follow pointer feature enables the tooltip to follow the mouse cursor or touch pointer as users interact with the accumulation chart. This provides a more dynamic experience by keeping the tooltip close to the user’s interaction point.
Enable this feature by setting the FollowPointer property to true in the tooltip.