Chart 1.4.0 is out for Vue, React and Angular. Most of it is about the tooltip and the crosshair: where they sit, how they move, what they show and who can reach them. It also brings boost to bars, histograms and candlesticks, one setting for reduced motion, and fixes to zoom and synced charts.
npm install @primeui/[email protected]
npm install @primeui/[email protected]
npm install @primeui/[email protected]
Several defaults change, so an existing chart will look and move a little differently after the upgrade. Each change is listed under Upgrading, with the setting that brings the old behavior back.
The tooltip sits on the point
In 1.3.1 the tooltip followed the pointer by default. It covered the data it was
describing, and it jumped from point to point. On a pie, polar, radar, treemap
or gauge chart it could not be pinned at all: followCursor: false had no
effect there.
On cartesian charts the tooltip now sits on the hovered point, 10px away from it, and glides to the next point in 180ms. It prefers the space above the point and flips to the other side when there is no room. Bars face their value end, so the tooltip of a negative bar sits below it and a horizontal bar’s sits beside it. A tooltip that follows the cursor never glides, because a glide toward a target that moves every frame reads as lag.
Pie, polar, radar, treemap and gauge charts still follow the cursor by default,
and followCursor: false now pins them too, at the center of the hovered slice
or cell. A gauge pins at its needle tip, or, without a needle, at the middle of
its filled arc. followCursor: true makes any chart follow the cursor again.
One placement rule
The side was chosen before the offset was added, and nothing kept the card
inside the chart afterwards, so an offset could push it over the edge. In a
400px chart, a 100px card at the cursor with offsetX: 200 landed at 382px to
482px, cut off. In right-to-left pages the card did not flip toward the open
side, so near the left edge it ran out of the chart.
The offset now counts when the side is chosen, and the card is always kept 8px inside the chart. The same card lands at 292px to 392px. Offsets keep their direction in right-to-left pages, and the card flips toward the open side there as well. A card also never grows wider than the chart minus 16px.
position now also takes an { x, y } object, next to 'cursor', 'top',
'bottom', 'left' and 'right', for a fixed spot in chart pixels. Giving
only one axis pins that axis alone: { y: 0 } keeps the card on the top edge
while it follows the point horizontally. The new allowOverflow lets the card
overhang the chart up to the edge of the window instead of flipping, which suits
a small chart with a large tooltip. An ancestor with overflow: hidden still
clips it.
<ChartTooltip position={{ y: 0 }} />
<ChartTooltip allowOverflow />
Motion and dismissal
The tooltip appeared and vanished instantly, so sweeping across the gaps between
bars made it blink. It now fades in over 150ms, and after the pointer leaves a
mark it stays at full opacity for hideDelay, now 300ms by default, then fades
out over 600ms. The crosshair holds and fades with it, and a new hit during the
fade brings the tooltip straight back. All of this can be tuned, or turned off
with animation: false on the tooltip. The chart’s own animation: false stops
the series and axes but leaves the tooltip alone:
<ChartTooltip hideDelay={150} animation={{ duration: 240, easing: 'easeOutCubic', show: { duration: 100 }, hide: { duration: 300 } }} />
Escape could only clear keyboard focus. It now hides the tooltip and the crosshair at once, from anywhere on the page, with no hold and no fade. The chart does not claim the key, so a dialog around the chart still closes on the same press. The tooltip stays hidden while the pointer stays on that point and comes back on the next one.
Snapping to the nearest point
snap now decides which point is hovered whenever a tooltip is present. Line,
area, bar, candlestick, histogram and heatmap charts default to category: they
pick along the category axis first. Scatter and bubble charts default to xy,
the nearest point in a straight line. Bars and histograms with a plain tooltip
stay exact, so the gaps between columns still show nothing. The hover highlight
follows the same pick, so the highlighted point and the tooltip always agree.
Click and point-hover events still fire only on an exact hit.
The interactive tooltip
interactive lets the pointer move onto the tooltip and use what is in it, such
as a link or a button. A custom tooltip is the usual place for one:
<ChartTooltip interactive render={(ctx: TooltipRenderContext) => (
<div className="p-chart-tooltip">
<span>{ctx.label}</span>
<button type="button" onClick={() => openOrders(ctx.label)}>Open orders</button>
</div>
)} />
<ChartTooltip interactive :render="render" />
<p-chart-tooltip interactive>
<ng-template pChartTooltipDef let-ctx>
<div class="p-chart-tooltip">
<span>{{ ctx.label }}</span>
<button type="button" (click)="openOrders(ctx.label)">Open orders</button>
</div>
</ng-template>
</p-chart-tooltip>
Getting the pointer onto a tooltip is harder than it sounds: on the way there, it crosses other points, and the tooltip would move away. While the pointer is heading toward the box, the chart holds the current point for up to 250ms, and a move in any other direction lets go at once. Once the pointer is on the box, the box keeps its point. Wheel, drag and click on the box no longer reach the chart’s zoom and click handlers, and focus or a text selection inside the box survives when the point changes.
Pie, polar, radar, treemap and gauge tooltips follow the cursor by default, so
the pointer can never reach them. Set followCursor: false there as well.
The box is also reachable from the keyboard when keyboard navigation is on. Tab
from the focused point moves into the box, Tab from its last control moves on to
the legend and zoom buttons, and Shift+Tab from its first control goes back to
the point. Escape inside the box returns focus to the point the box describes,
and a second Escape closes it. A tooltip that is not interactive is now inert,
so its contents are out of the tab order, and screen readers keep hearing the
focused point through the chart’s live region as before.
The crosshair
Values beside their points
With a crosshair, the series values were stacked on the value axis in shared
mode, and a single value sat above the point in item mode. They now sit beside
their points by default, as Name: value in the series color, and badges that
would overlap are pushed apart with a short line back to their point. The new
seriesBadges option chooses the layout: 'point', 'axis' for the 1.3.1
stack on the axis, or false for none, in which case the tooltip box shows next
to the crosshair.
<ChartTooltip mode="shared" crosshair={{ seriesBadges: 'axis' }} />

A custom tooltip used to disappear as soon as a crosshair was on. It now shows,
and it replaces the series badges unless seriesBadges is set.
Lines that lock to the point
The crosshair lines now lock to the hovered point, using the same snap rule as
the tooltip, and glide with it. A badge on a locked line reads the point’s
value, and a badge on a free line reads the cursor. crosshair.snap takes
false to let both lines follow the cursor again, or 'x', 'y' or 'xy' to
lock only some of them. Locked lines land at once on wheel, pinch and pan steps,
so they never trail a zoom.
Formatting and styling
Both the tooltip and the crosshair get a formatter for their labels and a style object, so a custom render is no longer needed just to change a date format or a background color:
labelFormatterformats the tooltip header. It receives the raw x value, a timestamp on a time axis, and returningundefinedkeeps the default.crosshair.formatterformats every badge. Its context says which badge it is (category,valueorseries) and carries the default text, so a formatter can change one badge and pass the others through.cardStyleandcrosshair.badgeStyletakefontSize,fontFamily,fontWeight,color,backgroundColor,borderColor,borderRadiusandpadding.- The colors in
badgeStylework like a seriescolor. A plain string styles the axis badges only, and the series badges keep their series color. To color the series badges, pass a function, called with the point’s context, or an array, cycled by point index. A function that returnsundefinedkeeps the series color for that badge.
The histogram of Apple’s daily returns in Q1 2024 uses both formatters and
badgeStyle. The tooltip header and the bin badge read as a range, the count
badge is a bare number, and the badges get a firmer edge:

The tooltip part of that demo, with bins, formatTick, datesByBin and
returns coming from its data setup. valueFormatter is not new: it fills the
rows under the header.
const formatRange = (_value: number | string, ctx: TooltipLabelContext): string => {
const i = ctx.index ?? 0;
return `${formatTick(bins[i])} to ${formatTick(bins[i + 1])}`;
};
const tooltipRows = (value: number, ctx: TooltipValueContext): TooltipRow[] => {
const dates = datesByBin[ctx.index ?? -1] ?? [];
const when = dates.length > 3 ? `${dates.slice(0, 3).join(', ')} +${dates.length - 3} more` : dates.join(', ');
return [
{ label: 'Trading days', value: String(value), color: ctx.color },
{ label: 'Share of the quarter', value: `${Math.round((value / returns.length) * 100)}%` },
{ label: 'When', value: when || '—' }
];
};
const formatBadge = (value: number | string, ctx: CrosshairBadgeContext): string => (ctx.axis === 'x' ? ctx.formattedValue.replace(' – ', ' to ') : String(Math.round(Number(value))));
const badgeStyle: CrosshairBadgeStyle = { backgroundColor: 'light-dark(#ffffff, #18181b)', color: 'light-dark(#0f172a, #f4f4f5)', borderColor: 'light-dark(#94a3b8, #71717a)', borderRadius: 4, padding: '3px 8px', fontWeight: 600 };
const CROSSHAIR = { snap: 'xy' as const, seriesBadges: false as const, formatter: formatBadge, badgeStyle };
<ChartTooltip labelFormatter={formatRange} valueFormatter={tooltipRows} crosshair={CROSSHAIR} />;
The colors in that badgeStyle are plain strings, so they style the two axis
badges. To color the series badges, give a function instead, here red for values
below zero and the series color otherwise:
<ChartTooltip crosshair={{ badgeStyle: { backgroundColor: (ctx) => ((ctx.value ?? 0) < 0 ? '#dc2626' : undefined) } }} />
A custom render also receives formattedXValue, the x value exactly as its axis
writes it, time zone and tickFormat included. Custom tooltips used to format
timestamps themselves and easily disagreed with the axis.
The badges have their own theme tokens now,
--p-chart-crosshair-badge-background, --p-chart-crosshair-badge-color and
--p-chart-crosshair-badge-border, and take the axis label font instead of a
fixed 11px. A series badge picks a text color that contrasts with its series
color, where it was always white.
Boost on bars, histograms and candlesticks
boost draws a large series as a few merged shapes instead of one element per
mark. Bars, histograms and candlesticks now accept it, next to line and scatter:
<ChartBar data={rows} categoryXField="day" valueYField="volume" boost />
boost also means the same thing on every series now. In 1.3.1 it merged the
markers of a line and turned off the hover effects of a scatter, and nothing
else. A boosted series now always draws merged where it can, skips animation and
data labels, and has no hover styling per mark. Bars keep their corner radius,
gradients become their main color, and candlesticks keep dojis and hollow
bodies. Keyboard navigation still steps through every point.
The default is 'auto', which turns boost on from 5,000 marks in a series,
counted on what the series draws. A series with 200 marks or fewer keeps one
element per mark even when boosted, because screen readers describe each mark of
a series that small. While any series in a chart may be boosted, the whole chart
lands without a tween, axes included, so marks never sit off their gridlines for
the length of an axis animation.
Motion
Reduced motion
The operating system’s reduced-motion setting was read once, when the chart was created, and only by the mark animations. Axes, the navigator, canvas overlays and the tooltip kept moving. It is now one decision for all motion in the chart, the tooltip and the crosshair included, and it follows a change of the setting while the page is open. A chart that must keep moving anyway, such as a kiosk display or a screen recording, can opt out:
<ChartSvg animation={{ respectReducedMotion: false }}>
Animations that skipped ahead
An animation took its start time from the first frame the browser offered. If the page was busy just as it started, after a heavy re-render or a legend toggle, the first visible step covered the whole delay, and the series jumped before it started to ease. On a line chart with a 150ms block, one step moved 34px between steps of under 2px. Every animation now starts on the first frame it actually draws, from one clock shared by the series, the axes, the navigator and the overlays, and interrupted polar and radar animations carry on from what was last drawn.
Overlays and easing
The animate() helper in custom canvas renders ignored animation: false and
reduced motion, so a pulsing marker kept pulsing. With motion off it now returns
its end value at once, and loops that are already running stop.
Every easing option now takes the same values: a built-in name such as
'easeOutCubic', a name registered with registerEasing, or a
(t: number) => number function. The navigator’s easing and the animate()
helper used to accept names only. An unknown name falls back to
'easeOutQuart'.
Zoom and the navigator
- The tooltip stays up during wheel zoom. A wheel zoom counted as a drag until 150ms after the last notch, so the tooltip and crosshair blinked off on every step. They now stay, and the series, the navigator selection, synced charts and the hovered point all land in the same frame as each wheel, pinch or pan step. A button or a drag-select zoom still animates.
- Gapless time axes pan by points. With
gapless, panning and zooming moved the window by elapsed time, so a pan could jump across a weekend. It now moves point by point, and the zoom buttons center on the middle point. The navigator strip of a gapless axis is drawn without the gap too. - Category zoom is continuous. A zoomed category axis was rounded out to whole categories, so steps were coarse and the wheel did not stay on the category under the pointer. The axis now shows the exact window, with partial categories at the edges, and button zoom animates on category axes as well.
- A wheel step against a bound that changes nothing no longer redraws the chart, and dragging the canvas navigator redraws only its selection.
Synced charts
Synced charts, shared tooltips and keyboard navigation found a series’ point by its row number. That fails as soon as series hold different rows: a series missing its first rows highlighted the wrong category on the peer chart, a series with no value for the hovered category borrowed its neighbor’s, and two time series stamped seconds apart did not line up at all. They now match by the category, or by the value on a numeric or time axis. A peer that has no point there shows nothing. A synced peer’s tooltip also shows the series name now, as the hovered chart does.
Leaving the chart in the same frame as the last pointer move could bring the hover back after the pointer was gone. The move is now dropped when the pointer leaves.
Other fixes
In all three frameworks:
- A heatmap with many columns drew no cells once a column was narrower than
about 2px, because the default 1px gap on each side left nothing. The gap now
drops to 0 along an axis whose cells are under 3px. An explicit
spacingis still applied as given. - The SVG tooltip had no shadow in the default theme, because the theme value was not valid CSS. It is fixed in the default and PrimeOne themes.
- Style callbacks on line and scatter series received an empty
seriesId, and their label formatters received no data row. Both are filled in. - The
mainentry of@primeui/chart-typespointed at a source file that is not in the package. It now points at the built types.
Vue only: a custom tooltip render is updated in place when the point changes, instead of being rebuilt.
Angular only: the hovered point was measured against the chart’s outer element, so padding on the chart shifted it. It is now measured against the plot area.
Upgrading
Upgrade every chart package together: the framework package,
@primeui/chart-core, @primeui/chart-types and @primeui/chart-style. A
1.3.x framework package keeps working on the new core, but synced charts still
match by row number in that combination.
These changes are visible in an existing chart:
- Cartesian tooltips sit on the point. Set
followCursor: trueto follow the cursor again. - Tooltips hold and fade. Set
hideDelay: 0andanimation: falsefor the 1.3.1 behavior. End-to-end tests that expect the tooltip to be gone right after the pointer leaves need the same settings, or a wait of about 900ms. - Line, scatter and candlestick tooltips snap to the nearest point. Set
snap: 'none'to show the tooltip on exact hits only. - Crosshair lines lock to the point. Set
crosshair: { snap: false }to let them follow the cursor. - Crosshair values sit beside their points. Set
crosshair: { seriesBadges: 'axis' }for the stack on the value axis. - Crosshair badges look different. They are opaque, take the axis label
font, and use the new
--p-chart-crosshair-badge-*tokens. - Boost turns on from 5,000 marks per series, down from 50,000. Line and
scatter series between those sizes now draw merged, without data labels or
animation. Set
boost: falseon the series to keep the old rendering. animation.limitcounts each series. It was compared with the total of all series, so three series of 2,000 points did not animate. They now do.- Axis animations use the update timing,
animation.update, like the series. - Reduced motion stops the tooltip and crosshair too. Set
animation.respectReducedMotion: falseon the chart to keep all motion. - A heatmap with very narrow cells loses its gaps under 3px.
- The tooltip is rendered beside the chart container, inside a new wrapper
element, not inside the container. A selector such as
[data-chart-container] .p-chart-tooltipno longer matches, while.p-chart-tooltipstill does. Position, opacity and transition are now set inline on the card, so CSS that setleft,toportransformon it no longer applies. - The tooltip font size is set inline from the chart’s font. Use
cardStyle.fontSizeinstead of afont-sizerule on.p-chart-tooltip. - A chart with a category x axis no longer syncs with a chart with a time x
axis. They lined up by row number before. Set
type: 'time'on the category chart’s x axis. - Point events fire only inside the plot area.
point-hoverandpoint-clickno longer fire just outside it.
The tooltip, crosshair and animation options are documented, with live demos, on vue.primeuipro.dev, react.primeuipro.dev and angular.primeuipro.dev. The previous release is covered in Chart 1.3.1.