Skip to content

Commit 3c7a92d

Browse files
committed
fix(webapp): keep the line-style tooltip indicator on the stacked area chart
The shared tooltip element dropped indicator="line", so stacked areas fell back to a dot. Add a stable module-level StackedAreaTooltip so the stacked view keeps its line indicator without reintroducing the portaled-tooltip remount flicker.
1 parent 4b52aac commit 3c7a92d

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

apps/webapp/app/components/primitives/charts/ChartLine.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ function OverlayFilteredTooltip(props: any) {
7272
);
7373
}
7474

75+
// Stable module-level tooltip for the stacked area chart: keeps the line-style indicator the
76+
// stacked view has always used (ChartTooltipContent otherwise defaults to a dot). Module-level for
77+
// the same reconcile-in-place reason as OverlayFilteredTooltip — an inline element would remount
78+
// the portaled tooltip on every hover re-render and flicker.
79+
function StackedAreaTooltip(props: any) {
80+
return <ChartTooltipContent {...props} indicator="line" />;
81+
}
82+
7583
// ============================================================================
7684
// COMPOUND COMPONENT API
7785
// ============================================================================
@@ -455,6 +463,16 @@ export function ChartLineRenderer({
455463

456464
// Render stacked area chart if stacked prop is true
457465
if (stacked && visibleSeries.length > 1) {
466+
// Same variants as the line chart's tooltipContent, but the default popup keeps the stacked
467+
// view's line-style indicator (warning overlay never applies to stacked areas).
468+
const stackedTooltipContent =
469+
syncZoomSelection && zoomFrom != null && zoomTo != null ? (
470+
<ZoomRangeTooltip from={zoomFrom} to={zoomTo} />
471+
) : showLegend ? (
472+
() => null
473+
) : (
474+
<StackedAreaTooltip valueFormatter={tooltipValueFormatter} />
475+
);
458476
return (
459477
<AreaChart
460478
data={data}
@@ -470,7 +488,7 @@ export function ChartLineRenderer({
470488
{/* When legend is shown below, render tooltip with cursor only (no content popup) */}
471489
<ChartTooltip
472490
cursor={{ stroke: "rgba(255, 255, 255, 0.1)", strokeWidth: 1 }}
473-
content={tooltipContent}
491+
content={stackedTooltipContent}
474492
labelFormatter={tooltipLabelFormatter}
475493
isAnimationActive={false}
476494
allowEscapeViewBox={{ x: true, y: true }}

0 commit comments

Comments
 (0)