Charts - Tooltip

Show data details on hover with mode, snap strategy, crosshair, custom content, OHLC layout, position control, and delays.

#Usage

import { ChartSvg, ChartTooltip } from '@primeui/vue-chart';
<ChartSvg>
    <!-- series and axes -->
    <ChartTooltip />
</ChartSvg>

Hover details are opt-in: add ChartTooltip to show a tooltip on hover; remove it and hover produces nothing. It works across all chart types with no additional wiring. Mode, snap strategy, crosshair, and custom content are all configured on the same component.

#Basic

Add ChartTooltip to display a tooltip when hovering over data elements. The default mode="item" shows details for the specific element under the cursor: one series, one value.

Loading Demo...

#Shared Mode

Set mode="shared" to show all series values at the hovered position in a single tooltip. This works for multi-series charts where comparing values at the same anchor is the main interaction. The tooltip snaps to the nearest anchor regardless of where the cursor is off-axis.

Loading Demo...

#Snap Strategy

Use snap to control how the hovered point is selected. category snaps to the nearest category (bar/column default), x snaps along the X axis (line/area default), xy picks the Euclidean-nearest point (scatter/bubble default), y snaps along the Y axis, and none disables neighborhood search so the tooltip only appears on exact shape hover. When unset, each chart type uses its natural default. Heatmap is the exception that snaps without being asked: its cells tile the plot, so the spacing between them is decoration rather than background, and the cursor resolves to the cell whose band it falls in. Pass none there for exact hover on the painted cell only.

Loading Demo...

#Crosshair

Set crosshair to display a reference line at the hovered position. Pass true for default styling or a CrosshairConfig object for fine control. Set x/y to show vertical or horizontal lines independently, and dashArray, color, width to customize their appearance.

Loading Demo...

#Position

Set position to control where the tooltip appears relative to the hovered element. cursor (default) follows the mouse, top and bottom pin it to the chart edges, left and right align it to the sides. Use offsetX and offsetY to adjust placement after the position is applied.

Loading Demo...

#Custom Tooltip

Set render to replace the default tooltip with custom content. The callback receives a TooltipRenderContext object containing all series items at the hovered position, the chart type, and theme information. Return a VNode.

Loading Demo...
Security. The built-in tooltip renders values as text (textContent), so raw data cannot inject markup. It is XSS-safe by default. When you supply a custom render, you control the VNode tree: never build it from untrusted strings via v-html/innerHTML. Bind values as text ({{ value }}) and your tooltip stays safe.

#OHLC Layout

On candlestick charts, the tooltip renders open, high, low, and close values in a structured layout with no configuration. Use render to replace this layout with custom content if needed.

Loading Demo...

#API

#ChartTooltip

PropTypeDefaultDescription
mode'item' | 'shared''item'item = tooltip for the specific hovered element. shared = tooltip for all series at the snapped anchor
snap'x' | 'y' | 'xy' | 'category' | 'none'type defaultPoint selection strategy. none disables neighborhood search (exact shape hover only). When unset, each chart type uses its natural default (scatter=xy, line/area=x, bar/column=category). Heatmap snaps to the cell whose band contains the cursor unless set to none.
crosshairboolean | CrosshairConfigfalseShow a reference line or band at the hovered position. Pass true for defaults or a CrosshairConfig object for fine control
position'cursor' | 'top' | 'bottom' | 'left' | 'right''cursor'Tooltip placement relative to the chart
offsetXnumber-Horizontal offset in pixels applied after position
offsetYnumber-Vertical offset in pixels applied after position
followCursorbooleantrueTooltip tracks cursor movement when position is cursor
showDelaynumber0Milliseconds to wait before showing the tooltip. Raise to hold the tooltip back while the cursor sweeps across dense hit targets
hideDelaynumber0Milliseconds the tooltip lingers after the cursor leaves a point. The crosshair and the colour-legend indicator linger with it, so the three never disagree
render(context: TooltipRenderContext) => unknown-Custom tooltip renderer. Replaces the default layout entirely

#CrosshairConfig

Pass to crosshair for fine-grained control over the reference line appearance.

FieldTypeDefaultDescription
xbooleantrueShow vertical reference line (X axis position)
ybooleantrueShow horizontal reference line (Y axis position)
dashArraynumber[][4, 4]Dash pattern [dashLength, gapLength]
colorstringthemeCrosshair line color
widthnumber1Crosshair line width in pixels

#TooltipRenderContext

Passed to the render callback. Represents the primary hovered item. Use allSeries to access all series values at the hovered position.

FieldTypeDescription
datasetIdstringThe series identifier
indexnumberData index of the hovered element
labelstringCategory or data point label
valuenumberRaw data value
percentagenumber | undefinedPercentage of total. Populated for pie, donut, and polar charts
colorstringSeries color
xnumber | undefinedPixel X coordinate of the hovered point
ynumber | undefinedPixel Y coordinate of the hovered point
ohlc{ open, high, low, close } | undefinedOHLC prices. Populated for candlestick charts
allSeriesTooltipItem[]All series values at the hovered position. Use for multi-series tooltips with mode="shared"

#TooltipItem

Each entry in TooltipRenderContext.allSeries.

FieldTypeDescription
datasetIdstringDataset identifier. Stable key for list rendering
namestring | undefinedHuman-readable series name from the name prop on the series component
labelstringCategory label at the hovered position. Same for all items in the list
colorstringSeries color
valuenumberRaw numeric value
formattedValuestringPre-formatted value string. Respects axis tick format, stacking mode, and display units. Use this for display, not value
percentagenumber | undefinedPercentage of total (0–100). Populated for percent-stacked bar charts
ohlc{ open, high, low, close } | undefinedOHLC prices. Populated for candlestick series