Tooltip in ASP.NET MVC 3D Circular Chart component
18 Nov 20183 minutes to read
The 3D Circular Chart will display details about the points through a tooltip, when the mouse is moved over a specific point. By default, the tooltip is not visible. It can be enabled by using the Enable property in Tooltip to true.
Header
You can specify a header for the tooltip by using the Header property in Tooltip.
Format
By default, the tooltip shows information about the x and y values in points. Additionally, more information can be displayed in the tooltip by using the Format property. For example, the format ${series.name} : ${point.x} shows the series name and the point’s 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 is applied by adding a colon (:) followed by the required format.
For example:
.Tooltip(tooltip => tooltip.Enable(true).Format("${point.x:MMM yyyy} : <b>${point.y:n2}%</b>"))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 3D circular chart point. -
point.y– Specifies the numeric y-value of the 3D circular chart point. -
point.percentage– Specifies the percentage contribution of the point value in the 3D circular 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 3D circular 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 3D circular chart series. -
series.opacity– Specifies the opacity value applied to the 3D circular chart series.
Important: The availability of point-specific tokens depends on the values configured in the data source and the 3D circular chart series. For example, point.percentage is useful for pie and doughnut charts, while point.text and point.tooltip depend on the corresponding field mappings. String tokens such as series.name, point.text, point.tooltip, point.color, and point.visible 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 template
Any HTML elements can be displayed in the tooltip by using the Template property in the tooltip.
Fixed tooltip
By default, the tooltip tracks the mouse movement, but it can be set to a fixed position using the Location property in Tooltip.
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. Additionally, the HighlightColor property can be used to change the color of the data point when hovering.
Customization of individual tooltip
Using the TooltipRender event, you can customize tooltip values for a particular point.