:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(hog-charts): smoother pie chart hover interaction (#61529)
Sam Penningtoncee503207303
diff --git a/packages/quill/packages/charts/src/charts/PieChart/PieChart.tsx b/packages/quill/packages/charts/src/charts/PieChart/PieChart.tsxindex 2345daaafe14..13dc637b41eb 100644--- a/packages/quill/packages/charts/src/charts/PieChart/PieChart.tsx+++ b/packages/quill/packages/charts/src/charts/PieChart/PieChart.tsx@@ -1,6 +1,7 @@-import React, { useCallback, useMemo } from 'react'+import React, { useCallback, useMemo, useRef } from 'react'import { ChartErrorBoundary } from '../../core/ChartErrorBoundary'+import { mixColors } from '../../core/color-utils'import type { RadialSlicePayload } from '../../core/hooks/useRadialInteraction'import { useRadialLayout } from '../../core/radial-context'import { RadialChart } from '../../core/RadialChart'@@ -21,9 +22,13 @@ export interface PieChartConfig<Meta = unknown> {/** Render slice values as percentages of total. Drives both axes-label-style formatting* and the on-slice / tooltip formatting. */isPercent?: boolean- /** Pixels the hovered slice slides out along its bisector. Default 16. */- hoverOffset?: number- /** Disable the hover pop-out — useful for snapshot stability or constrained layouts. */+ /** Pixels the hovered slice's outer radius grows on hover (center stays fixed). Default 8. */+ hoverGrowth?: number+ /** Duration (ms) of the hover transition — the slice eases outward and brightens over this+ * window rather than snapping. Default 150. `0` disables (instant). */+ hoverAnimationMs?: number+ /** Disable the hover grow effect — useful for snapshot stability or constrained layouts.+ * Legacy name: this gates the whole hover effect (grow + brighten + dim), not just an offset. */disableHoverOffset?: boolean/** Hide on-slice labels for slices smaller than this fraction of the total. Default 0.05. */minSlicePercentForLabel?: number@@ -61,8 +66,22 @@ export interface PieChartProps<Meta = unknown> {onError?: (error: Error, info: React.ErrorInfo) => void}-const DEFAULT_HOVER_OFFSET = 16+const DEFAULT_HOVER_GROWTH = 8+const DEFAULT_HOVER_ANIMATION_MS = 150const DEFAULT_MIN_SLICE_PERCENT = 0.05+// Hovered slice eases toward white by this fraction at full hover — a subtle highlight.+const HOVER_HIGHLIGHT_TARGET = '#ffffff'+const HOVER_HIGHLIGHT_AMOUNT = 0.15+// Non-hovered slices ease toward the chart background by this fraction, fading into the+// backdrop so the hovered slice stands out.+const HOVER_DIM_AMOUNT = 0.55+// Used only when the theme omits `backgroundColor`. Assumes a light backdrop — consumers on a+// dark theme should set `theme.backgroundColor` so slices dim toward the dark surface instead.+const HOVER_DIM_TARGET_FALLBACK = '#ffffff'++function easeOutCubic(t: number): number {+ return 1 - Math.pow(1 - t, 3)+}const CENTER_LABEL_STYLE: React.CSSProperties = {position: 'absolute',@@ -111,7 +130,8 @@ function PieChartInner<Meta = unknown>({showValueOnSlice = true,showLabelOnSlice = false,isPercent = false,- hoverOffset = DEFAULT_HOVER_OFFSET,+ hoverGrowth = DEFAULT_HOVER_GROWTH,+ hoverAnimationMs = DEFAULT_HOVER_ANIMATION_MS,disableHoverOffset = false,minSlicePercentForLabel = DEFAULT_MIN_SLICE_PERCENT,padAngle = 0,@@ -135,57 +155,60 @@ function PieChartInner<Meta = unknown>({[sliceValue, innerRadiusRatio, padAngle, sort])- const effectiveHoverOffset = disableHoverOffset ? 0 : hoverOffset+ const effectiveHoverGrowth = disableHoverOffset ? 0 : hoverGrowth+ const effectiveHoverAnimationMs = disableHoverOffset ? 0 : hoverAnimationMs++ // Backdrop-dim level (0 = none, 1 = full), held across slice crossings — see the ramp in+ // drawHover for why it can't be read straight off hoverProgress.+ const dimRef = useRef(0)const drawStatic = useCallback((args: ChartDrawArgs) => {const layout = getLayoutFromArgs<Meta>(args)if (!layout) {return}- drawSlices(args.ctx, layout, args.theme, { skipIndex: -1, offset: 0 })+ drawSlices(args.ctx, layout, { outerRadiusBoost: 0 })}, [])const drawHover = useCallback((args: ChartDrawArgs): boolean => {const layout = getLayoutFromArgs<Meta>(args)- if (!layout || args.hoverIndex < 0) {- return false- }- // Single-slice charts have nothing to pop out — drawing the offset would visually- // shift the whole wheel.- if (layout.slices.length <= 1 || effectiveHoverOffset === 0) {+ // A lone full-circle slice has nothing to highlight against — growing it just+ // pulses the whole wheel.+ const slice = layout && args.hoverIndex >= 0 ? layout.slices[args.hoverIndex] : null+ if (!layout || !slice || layout.slices.length <= 1 || effectiveHoverGrowth === 0) {+ dimRef.current = 0return false}- // The mask step below relies on `theme.backgroundColor` to erase the static-canvas- // copy of the slice. Without one, the popped-out slice would partially overlap the- // original and smear — better to skip the pop-out than render that.- if (!args.theme.backgroundColor) {- return false- }- const slice = layout.slices[args.hoverIndex]- if (!slice) {- return false+ // The focused slice's growth + tint ease over `hoverProgress` (0→1 from useChartDraw's+ // RAF loop), so it swells and brightens rather than snapping.+ const eased = easeOutCubic(args.hoverProgress)+ // Ramp the backdrop dim with the same fade, but only ever upward: `hoverProgress`+ // resets to 0 on each hoverIndex change, so reading the dim straight off it would+ // flash the rest of the pie back to full color every time the cursor crosses into the+ // next slice. Holding the max keeps the backdrop steady (and lets an in-progress fade+ // continue) as you sweep across segments; it resets on hover-out (guard above).+ dimRef.current = Math.max(dimRef.current, eased * HOVER_DIM_AMOUNT)+ // Repaint every *other* slice over its static copy in a color faded toward the+ // background, dimming the rest so the hovered slice stands out. The fade fill must be+ // opaque — a translucent fill would composite against the full-color static slice+ // beneath the overlay and not dim at all.+ const dimTarget = args.theme.backgroundColor || HOVER_DIM_TARGET_FALLBACK+ for (let i = 0; i < layout.slices.length; i++) {+ if (i === args.hoverIndex) {+ continue+ }+ const other = layout.slices[i]+ const faded = mixColors(other.color, dimTarget, dimRef.current)+ drawSliceShape(args.ctx, other, layout, { outerRadiusBoost: 0, fillStyle: faded })}- // Two-pass paint on the (always-cleared) overlay canvas:- // 1. Fill the slice's original footprint with the theme background. The overlay- // sits above the static canvas, so this *visually* erases the un-offset copy- // that `useChartDraw` re-paints on the static layer every render.- // 2. Paint the slice in its real color at the offset position.- // Without step 1 the offset copy only partially overlaps the original, leaving a- // crescent of the un-offset slice visible — a smear, not a clean pop-out.- drawSliceShape(args.ctx, slice, layout, {- offset: 0,- fillStyle: args.theme.backgroundColor,- withStroke: undefined,- })- drawSliceShape(args.ctx, slice, layout, {- offset: effectiveHoverOffset,- fillStyle: slice.color,- withStroke: layout.slices.length > 1 ? args.theme.backgroundColor : undefined,- })+ // Hovered slice last, on top of the dimmed others.+ const outerRadiusBoost = eased * effectiveHoverGrowth+ const fillStyle = mixColors(slice.color, HOVER_HIGHLIGHT_TARGET, eased * HOVER_HIGHLIGHT_AMOUNT)+ drawSliceShape(args.ctx, slice, layout, { outerRadiusBoost, fillStyle })return true},- [effectiveHoverOffset]+ [effectiveHoverGrowth])const renderTooltip = useMemo(@@ -207,7 +230,8 @@ function PieChartInner<Meta = unknown>({tooltip={renderTooltip}showTooltip={showTooltip}onSliceClick={onSliceClick}- hitOuterSlack={effectiveHoverOffset}+ hitOuterSlack={effectiveHoverGrowth}+ hoverAnimationMs={effectiveHoverAnimationMs}className={className}dataAttr={dataAttr}>@@ -242,56 +266,34 @@ function getLayoutFromArgs<Meta>(args: ChartDrawArgs): PieLayout<Meta> | null {}interface DrawSlicesOptions {- skipIndex: number- offset: number+ outerRadiusBoost: number}function drawSlices<Meta>(ctx: CanvasRenderingContext2D,layout: PieLayout<Meta>,- theme: ChartTheme,- { skipIndex, offset }: DrawSlicesOptions+ { outerRadiusBoost }: DrawSlicesOptions): void {for (let i = 0; i < layout.slices.length; i++) {- if (i === skipIndex) {- continue- }- drawSlice(ctx, layout.slices[i], layout, theme, { offset })+ drawSliceShape(ctx, layout.slices[i], layout, { outerRadiusBoost, fillStyle: layout.slices[i].color })}}-interface DrawSliceOptions {- offset: number-}--function drawSlice<Meta>(- ctx: CanvasRenderingContext2D,- slice: PieLayout<Meta>['slices'][number],- layout: PieLayout<Meta>,- theme: ChartTheme,- { offset }: DrawSliceOptions-): void {- // Inter-slice stroke in the theme background — visually separates adjacent slices- // without a heavy outline. Skipped when there's only one slice (no neighbour to separate from).- const withStroke = layout.slices.length > 1 ? theme.backgroundColor : undefined- drawSliceShape(ctx, slice, layout, { offset, fillStyle: slice.color, withStroke })-}-interface DrawSliceShapeOptions {- offset: number+ /** Pixels added to the outer radius (center fixed) — drives the hover grow. */+ outerRadiusBoost: numberfillStyle: string- /** Inter-slice stroke color (typically `theme.backgroundColor`). Omit to skip stroking. */- withStroke: string | undefined}-/** Lower-level slice painter — takes explicit fill / stroke so the hover layer can both- * mask (background fill, no stroke) and re-paint (slice color, with stroke) using the same- * arc geometry. */+/** Lower-level slice painter — takes an explicit fill so the hover layer can re-paint a slice+ * (grown + brightened) over its static base using the same center and angles. Slices are drawn+ * borderless: with many thin wedges, an inter-slice stroke piles up into a white cone at the+ * apex, so adjacent slices are separated by color alone (matching the legacy pie). */function drawSliceShape<Meta>(ctx: CanvasRenderingContext2D,slice: PieLayout<Meta>['slices'][number],layout: PieLayout<Meta>,- { offset, fillStyle, withStroke }: DrawSliceShapeOptions+ { outerRadiusBoost, fillStyle }: DrawSliceShapeOptions): void {const halfPad = layout.padAngle / 2const start = slice.startAngle + halfPad@@ -299,10 +301,8 @@ function drawSliceShape<Meta>(if (start >= end) {return}- const offsetX = offset === 0 ? 0 : Math.sin(slice.centroidAngle) * offset- const offsetY = offset === 0 ? 0 : -Math.cos(slice.centroidAngle) * offset- const cx = layout.cx + offsetX- const cy = layout.cy + offsetY+ const { cx, cy, innerRadius } = layout+ const outerRadius = layout.outerRadius + outerRadiusBoost// Canvas arc convention: 0 = 3 o'clock, increasing clockwise. d3.pie uses// 0 = 12 o'clock. Subtract π/2 to align.@@ -311,19 +311,13 @@ function drawSliceShape<Meta>(ctx.fillStyle = fillStylectx.beginPath()- if (layout.innerRadius > 0) {- ctx.arc(cx, cy, layout.outerRadius, cStart, cEnd, false)- ctx.arc(cx, cy, layout.innerRadius, cEnd, cStart, true)+ if (innerRadius > 0) {+ ctx.arc(cx, cy, outerRadius, cStart, cEnd, false)+ ctx.arc(cx, cy, innerRadius, cEnd, cStart, true)} else {ctx.moveTo(cx, cy)- ctx.arc(cx, cy, layout.outerRadius, cStart, cEnd, false)+ ctx.arc(cx, cy, outerRadius, cStart, cEnd, false)}ctx.closePath()ctx.fill()-- if (withStroke) {- ctx.lineWidth = 1- ctx.strokeStyle = withStroke- ctx.stroke()- }}diff --git a/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.test.tsx b/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.test.tsxindex 3e5fd29c45b4..1734be6bcfe1 100644--- a/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.test.tsx+++ b/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.test.tsx@@ -6,7 +6,8 @@ import type { RadialLayoutContextValue } from '../../core/radial-context'import type { ResolvedSeries } from '../../core/types'import { computePieLayout } from './computePieLayout'import type { PieLayout } from './computePieLayout'-import { SliceLabels } from './SliceLabels'+import { nonCollidingKeys, SliceLabels } from './SliceLabels'+import type { LabelBox } from './SliceLabels'const PLOT = { plotLeft: 0, plotTop: 0, plotWidth: 400, plotHeight: 400 }@@ -102,4 +103,26 @@ describe('SliceLabels', () => {expect(a.textContent).toContain('A')expect(a.textContent).toContain('50')})++ // y=0 for every box, so overlap is decided purely by x against the summed half-widths.+ function box(key: string, x: number, value: number, halfWidth = 10): LabelBox {+ return { key, x, y: 0, halfWidth, halfHeight: 10, value, lines: [key] }+ }++ it('keeps every label when none of the boxes overlap', () => {+ const kept = nonCollidingKeys([box('a', 0, 1), box('b', 100, 1), box('c', 200, 1)])+ expect([...kept].sort()).toEqual(['a', 'b', 'c'])+ })++ it('drops the smaller-value label when two boxes overlap', () => {+ // 5px apart, half-widths 10 each → boxes overlap; b carries the larger value.+ const kept = nonCollidingKeys([box('a', 0, 3), box('b', 5, 9)])+ expect(kept.has('b')).toBe(true)+ expect(kept.has('a')).toBe(false)+ })++ it('keeps only the largest label in a crowded cluster', () => {+ const kept = nonCollidingKeys([box('a', 0, 1), box('b', 4, 5), box('c', 8, 3)])+ expect([...kept]).toEqual(['b'])+ })})diff --git a/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.tsx b/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.tsxindex 46f0fb2b9539..bd4cddf23e5b 100644--- a/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.tsx+++ b/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.tsx@@ -1,6 +1,7 @@import React from 'react'import { useRadialLayout } from '../../core/radial-context'+import { FONT_FAMILY, measureLabelWidth } from '../../utils/text-measure'export interface SliceLabelsProps {valueFormatter?: (value: number) => string@@ -14,13 +15,20 @@ export interface SliceLabelsProps {isPercent?: boolean}+const LABEL_FONT_SIZE = 14+const LABEL_LINE_HEIGHT = 1.2+const LABEL_FONT = `600 ${LABEL_FONT_SIZE}px ${FONT_FAMILY}`+// Breathing room added around each label box so near-touching labels still count as colliding.+const LABEL_PADDING_X = 4+const LABEL_PADDING_Y = 2+const LABEL_STYLE_BASE: React.CSSProperties = {position: 'absolute',pointerEvents: 'none',color: 'white',- fontSize: 12,+ fontSize: LABEL_FONT_SIZE,fontWeight: 600,- lineHeight: 1.2,+ lineHeight: LABEL_LINE_HEIGHT,textAlign: 'center',textShadow: '0 1px 2px rgba(0, 0, 0, 0.45)',whiteSpace: 'nowrap',@@ -35,6 +43,35 @@ function formatPercent(fraction: number): string {return `${Math.round(fraction * 1000) / 10}%`}+export interface LabelBox {+ key: string+ x: number+ y: number+ halfWidth: number+ halfHeight: number+ value: number+ lines: string[]+}++function overlaps(a: LabelBox, b: LabelBox): boolean {+ return Math.abs(a.x - b.x) < a.halfWidth + b.halfWidth && Math.abs(a.y - b.y) < a.halfHeight + b.halfHeight+}++/** Slices whose centered label box doesn't collide with an already-kept one. Larger slices win,+ * so when adjacent thin slices crowd the same arc the most significant labels survive and the+ * rest are dropped rather than overlapping. */+export function nonCollidingKeys(boxes: LabelBox[]): Set<string> {+ const kept: LabelBox[] = []+ const keptKeys = new Set<string>()+ for (const box of [...boxes].sort((a, b) => b.value - a.value)) {+ if (kept.every((other) => !overlaps(box, other))) {+ kept.push(box)+ keptKeys.add(box.key)+ }+ }+ return keptKeys+}+export function SliceLabels({valueFormatter = defaultFormatter,showValueOnSlice = true,@@ -47,32 +84,51 @@ export function SliceLabels({return null}const midR = layout.innerRadius + (layout.outerRadius - layout.innerRadius) / 2++ const boxes: LabelBox[] = []+ for (let i = 0; i < layout.slices.length; i++) {+ const slice = layout.slices[i]+ if (slice.series.visibility?.valueLabel === false || slice.fraction < minSlicePercentForLabel) {+ continue+ }+ const lines: string[] = []+ if (showLabelOnSlice) {+ lines.push(slice.series.label)+ }+ if (showValueOnSlice) {+ lines.push(isPercent ? formatPercent(slice.fraction) : valueFormatter(slice.value))+ }+ const width = Math.max(0, ...lines.map((line) => measureLabelWidth(line, LABEL_FONT)))+ boxes.push({+ // Slice positions can shift when the input series changes, but the series key is stable+ // across re-renders of the same series, which keeps React's reconciliation predictable.+ key: slice.series.key || String(i),+ x: layout.cx + Math.sin(slice.centroidAngle) * midR,+ y: layout.cy - Math.cos(slice.centroidAngle) * midR,+ halfWidth: width / 2 + LABEL_PADDING_X,+ halfHeight: (lines.length * LABEL_FONT_SIZE * LABEL_LINE_HEIGHT) / 2 + LABEL_PADDING_Y,+ value: slice.value,+ lines,+ })+ }++ const visibleKeys = nonCollidingKeys(boxes)+return (<>- {layout.slices.map((slice, i) => {- if (slice.series.visibility?.valueLabel === false) {- return null- }- if (slice.fraction < minSlicePercentForLabel) {- return null- }- const x = layout.cx + Math.sin(slice.centroidAngle) * midR- const y = layout.cy - Math.cos(slice.centroidAngle) * midR- const valueText = isPercent ? formatPercent(slice.fraction) : valueFormatter(slice.value)- return (+ {boxes+ .filter((box) => visibleKeys.has(box.key))+ .map((box) => (<div- // Slice positions can shift when the input series changes, but `seriesIndex`- // is stable across re-renders of the same series, which keeps React's- // reconciliation predictable.- key={slice.series.key || i}+ key={box.key}data-attr="hog-chart-pie-slice-label"- style={{ ...LABEL_STYLE_BASE, left: Math.round(x), top: Math.round(y) }}+ style={{ ...LABEL_STYLE_BASE, left: Math.round(box.x), top: Math.round(box.y) }}>- {showLabelOnSlice ? <div>{slice.series.label}</div> : null}- {showValueOnSlice ? <div>{valueText}</div> : null}+ {box.lines.map((line, li) => (+ <div key={li}>{line}</div>+ ))}</div>- )- })}+ ))}</>)}diff --git a/packages/quill/packages/charts/src/core/RadialChart.tsx b/packages/quill/packages/charts/src/core/RadialChart.tsxindex 519a41c0e3cf..74f16869ed87 100644--- a/packages/quill/packages/charts/src/core/RadialChart.tsx+++ b/packages/quill/packages/charts/src/core/RadialChart.tsx@@ -72,6 +72,8 @@ export interface RadialChartProps<Meta = unknown> {onSliceClick?: (payload: RadialSlicePayload<Meta>) => void/** Slack beyond `outerRadius` for hit-testing — typically the hover pop-out distance. */hitOuterSlack?: number+ /** Duration (ms) of the hover-overlay transition. `0` disables (instant pop-out). */+ hoverAnimationMs?: numberclassName?: stringdataAttr?: stringchildren?: React.ReactNode@@ -87,6 +89,7 @@ export function RadialChart<Meta = unknown>({showTooltip = true,onSliceClick,hitOuterSlack = 0,+ hoverAnimationMs = 0,className,dataAttr,children,@@ -149,6 +152,7 @@ export function RadialChart<Meta = unknown>({theme,drawStatic,drawHover,+ hoverAnimationMs,})const ariaLabel = useMemo(() => {@@ -215,7 +219,7 @@ export function RadialChart<Meta = unknown>({<Tooltipcontext={tooltipCtx}renderTooltip={renderTooltip}- placement="follow-data"+ placement="cursor"/>)}</div>diff --git a/packages/quill/packages/charts/src/core/color-utils.test.ts b/packages/quill/packages/charts/src/core/color-utils.test.tsnew file mode 100644index 000000000000..0a1d076f7bee--- /dev/null+++ b/packages/quill/packages/charts/src/core/color-utils.test.ts@@ -0,0 +1,18 @@+import { mixColors } from './color-utils'++describe('mixColors', () => {+ it.each([+ { name: 'midpoint is halfway between the two colors', from: '#000000', to: '#ffffff', t: 0.5, expected: 'rgb(128, 128, 128)' },+ { name: 't=0 returns the from color', from: '#000000', to: '#ffffff', t: 0, expected: 'rgb(0, 0, 0)' },+ { name: 't=1 returns the to color', from: '#000000', to: '#ffffff', t: 1, expected: 'rgb(255, 255, 255)' },+ { name: 't below 0 clamps to the from color', from: '#000000', to: '#ffffff', t: -1, expected: 'rgb(0, 0, 0)' },+ { name: 't above 1 clamps to the to color', from: '#000000', to: '#ffffff', t: 2, expected: 'rgb(255, 255, 255)' },+ { name: 'interpolates opacity', from: 'rgba(255, 0, 0, 0.2)', to: 'rgba(255, 0, 0, 0.8)', t: 0.5, expected: 'rgba(255, 0, 0, 0.5)' },+ ])('$name', ({ from, to, t, expected }) => {+ expect(mixColors(from, to, t)).toBe(expected)+ })++ it('returns the original string when a color cannot be parsed', () => {+ expect(mixColors('not-a-color', '#ffffff', 0.5)).toBe('not-a-color')+ })+})diff --git a/packages/quill/packages/charts/src/core/color-utils.ts b/packages/quill/packages/charts/src/core/color-utils.tsindex abaaa7ce34a9..554fc952fcbb 100644--- a/packages/quill/packages/charts/src/core/color-utils.ts+++ b/packages/quill/packages/charts/src/core/color-utils.ts@@ -1,4 +1,4 @@-import { color as d3Color } from 'd3-color'+import { color as d3Color, rgb as d3Rgb } from 'd3-color'import type { ResolvedSeries, Series } from './types'@@ -8,6 +8,20 @@ export function dimColor(color: string, alpha: number): string {return d3Color(color)?.copy({ opacity: alpha }).toString() ?? color}+/** Linear RGB interpolation between two colors. `t` is clamped to [0, 1]; `t=0` returns `from`,+ * `t=1` returns `to`. Falls back to `from` when either color can't be parsed. */+export function mixColors(from: string, to: string, t: number): string {+ const a = d3Rgb(from)+ const b = d3Rgb(to)+ // d3 returns an RGBColor with NaN channels (not null) for unparseable input.+ if (Number.isNaN(a.r) || Number.isNaN(b.r)) {+ return from+ }+ const clamped = Math.max(0, Math.min(1, t))+ const lerp = (x: number, y: number): number => x + (y - x) * clamped+ return d3Rgb(lerp(a.r, b.r), lerp(a.g, b.g), lerp(a.b, b.b), lerp(a.opacity, b.opacity)).toString()+}+/** Fill color for the bar at `index`: the per-bar override (`bars[index].color`) when set, else the* series color. The one resolver every bar color-read site (fill, hover highlight, tooltip swatch,* value labels) should use, so a per-bar series can't accidentally render bars in the series color. */diff --git a/packages/quill/packages/charts/src/core/hooks/useRadialInteraction.ts b/packages/quill/packages/charts/src/core/hooks/useRadialInteraction.tsindex fd964c24ed4d..5cef48246b1e 100644--- a/packages/quill/packages/charts/src/core/hooks/useRadialInteraction.ts+++ b/packages/quill/packages/charts/src/core/hooks/useRadialInteraction.ts@@ -19,8 +19,8 @@ interface UseRadialInteractionOptions<Meta> {wrapperRef: React.RefObject<HTMLDivElement>showTooltip: booleanonSliceClick?: (payload: RadialSlicePayload<Meta>) => void- /** Allowance beyond `outerRadius` for hit-testing so the popped-out slice still hovers.- * Typically equal to `hoverOffset`. */+ /** Allowance beyond `outerRadius` for hit-testing so the grown slice still hovers.+ * Typically equal to `hoverGrowth`. */hitOuterSlack?: number}@@ -41,8 +41,8 @@ function buildPieTooltipCtx<Meta>(cursor: { x: number; y: number } | null,canvasBounds: DOMRect): TooltipContext<Meta> {- // Anchor at the centroid of the slice (mid-radius along bisector) so the tooltip points- // at the slice it describes, not at the cursor.+ // Centroid of the slice (mid-radius along bisector). The tooltip follows the cursor via+ // `hoverPosition`; this is the fallback anchor for rebuilds with no cursor (e.g. a pin).const midR = (layout.innerRadius + layout.outerRadius) / 2const ax = layout.cx + Math.sin(slice.centroidAngle) * midRconst ay = layout.cy - Math.cos(slice.centroidAngle) * midRdiff --git a/packages/quill/packages/charts/src/utils/text-measure.ts b/packages/quill/packages/charts/src/utils/text-measure.tsindex df43291d9602..b5a19d1dfd4d 100644--- a/packages/quill/packages/charts/src/utils/text-measure.ts+++ b/packages/quill/packages/charts/src/utils/text-measure.ts@@ -1,8 +1,10 @@// Cached offscreen canvas — createElement+getContext is slow, measureText is fast.// Callers must set ctx.font themselves before measuring.-export const AXIS_LABEL_FONT =- '12px -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif'+export const FONT_FAMILY =+ '-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif'++export const AXIS_LABEL_FONT = `12px ${FONT_FAMILY}`export const ELLIPSIS = '…'