: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): add Sparkline component (#60080)
Sam Penningtond7e80b18d398
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 93b5d6c27c81..f8bf8410407d 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -616,6 +616,26 @@ snapshots:hash: v1.k794b7964.bf6bedb1f09bacdd7008902e47f2118b353f59b59d2dfbf7abecb7ad8fa09bd1.-uNfx0wyQ72E6nc1PrqC8rHg8J7gY8-7i9nop7w4Y2Mcomponents-hogcharts-referenceline--vertical-reference-lines--light:hash: v1.k794b7964.fde30e22b2056f1e8e22850bb06c5220d2953cfc94fbfd66bfb7f7b8eeb7323f.mR0MdlvDVJmrXWFmM9o48B66Ikx9Qavg8VWdW4bYy6s+ components-hogcharts-sparkline--custom-color--dark:+ hash: v1.k794b7964.9a599ca7e855408c1bda17c3b9094b60c333249c9df7d14d0be865a4f9fb424d.EFS4alrXA5COnCpJYXUfVxFvJd4GWClskV2utoqKWtE+ components-hogcharts-sparkline--custom-color--light:+ hash: v1.k794b7964.af97dc25575ee74487ebf3ded42aff5af86b9133469c0bf7654047c03e52542f.QjZCQYpkNyOBPZ6m_zB8aK_JG6vRYRgDAjioFndEGQ8+ components-hogcharts-sparkline--default--dark:+ hash: v1.k794b7964.bbfe7f33815104ae340c50cf548833104ee7a6ac5177f596dc7cb8ed883974ee.VmAFZptKWU8izuAm82dpb0nFv1fNO1Y69T7mBPm95RY+ components-hogcharts-sparkline--default--light:+ hash: v1.k794b7964.86f4f5f914b7abc96f0eec6db7ee2b341d938b98245e73a4140821dff2e18948.xGf_AmD32h-OLyy8VOZYZQju67R19WGKMCKuKONpI1A+ components-hogcharts-sparkline--fill-opacity-variants--dark:+ hash: v1.k794b7964.cf8c9b6982bebc81204d5dcc711c45690f3b8fed7f088730bde95ad154f0a850.eT0oRxwQLdyqGJKeMa2X-ZkYoDJfmUjeA_7iXT3Zfrw+ components-hogcharts-sparkline--fill-opacity-variants--light:+ hash: v1.k794b7964.b1a6e56ad4416d4d324d2b2acc026040453b4ea7151d6f4933354d875b040265.TCskBkXRQIIGxeP1TVg5gtlv03_fbl0bgjBjs5B472U+ components-hogcharts-sparkline--flat--dark:+ hash: v1.k794b7964.f59b778cbf14145daebb90deda9e4d6e43b39f37db39652065faa4bd6dc78d56.Bg-gXDV14nTLdohXrehOyHFXNI6qaRjZaQOdQ8qYopY+ components-hogcharts-sparkline--flat--light:+ hash: v1.k794b7964.2d4a2093d64f5f8764d7c8c0305ac1e3954c7e6153800997dffbc583acff03c2.U6ySgBGnwKgJll1d0uPKeb7Z8MBxmsflJ7eN6oRlQJ8+ components-hogcharts-sparkline--volatile--dark:+ hash: v1.k794b7964.4840b4db90794f9305ff9b1fc6d68eb7132b4dab0ffb1180b34711373d8afa9f.JkLiHnw1a2oCYKLSeI-XwZ-HO7zUWZ-ZMqW_dbkJHr0+ components-hogcharts-sparkline--volatile--light:+ hash: v1.k794b7964.a1c48718d5430b6c2be309c3b421caa6bb880a2f7291452723b4d506ec2bf8b9.l0afGkktvS_ulydwlBchwKA0ClsF2c1C_qDXeRPhMFUcomponents-hogcharts-timeseriesbarchart--basic--dark:hash: v1.k794b7964.49a1e8a1eb97155c19c31ce91b1d86e105a1b5e0f765d06c84344ace6f8f6a58.s3nR2e7gLDKDRXx9IV6TIz0Y3kOHl-PL9cjCmS-aFOYcomponents-hogcharts-timeseriesbarchart--basic--light:@@ -4751,7 +4771,7 @@ snapshots:scenes-app-insights-funnels--funnel-left-to-right-edit-viewports--superwide--light:hash: v1.k794b7964.c95c5a49f7a20b7fcb1041dd26c73ee87c9a906cb229247a44fd4633bbdc9173.StrJ2VBA5acLqvnsiO2CS_o6qadxeaeO6ST8lxf5UdIscenes-app-insights-funnels--funnel-left-to-right-edit-viewports--wide--dark:- hash: v1.k794b7964.c47bdb853ef9b6becfb675e2ca0bdbdb0c1b4385cf2442d50dd92752d90f7906.URrKOLP9uUjbKWcui2yOA7hm_JsXsbkAlOcWJshoQrI+ hash: v1.k794b7964.293297b83994468984576e5c15fa2cbbb2c4c0a7a8234959b9deba539efa383b.O7SwG4Drfr3z02hcLNC1LsLsGWddouhybBp4xZaUE-Ascenes-app-insights-funnels--funnel-left-to-right-edit-viewports--wide--light:hash: v1.k794b7964.c63132bb5b13cbe97938ebdb2e59e320ebc338bd12b2d3bfd6af81e56270650a.KSiw8WpvjWXIDh87ExL4cPnopVJlTXvzU8N8ruh6Hi8scenes-app-insights-funnels--funnel-time-to-convert--dark:diff --git a/frontend/src/lib/hog-charts/README.md b/frontend/src/lib/hog-charts/README.mdindex 48a799ee64b2..c614d4019d3b 100644--- a/frontend/src/lib/hog-charts/README.md+++ b/frontend/src/lib/hog-charts/README.md@@ -72,6 +72,19 @@ function GoalLine() {</LineChart>```+## Sparkline++`Sparkline` is an axis-less line+area preset over `LineChart`, intended as a+compact "trend at a glance" building block. It hides both axes and the+tooltip, draws the area with a vertical gradient fill, and exposes+`onHoverIndexChange` so consumers can drive a hover-following headline+without subscribing to `useChartHover` directly.++```tsx+import { Sparkline } from 'lib/hog-charts'+;<Sparkline data={[4200, 5100, 4700, /* … */ 8800]} theme={THEME} />+```+## More- Building a new chart type, library architecture, conventions →diff --git a/frontend/src/lib/hog-charts/charts/LineChart.tsx b/frontend/src/lib/hog-charts/charts/LineChart.tsxindex 8684891fec36..2bdb900493e3 100644--- a/frontend/src/lib/hog-charts/charts/LineChart.tsx+++ b/frontend/src/lib/hog-charts/charts/LineChart.tsx@@ -70,17 +70,23 @@ function LineChartInner<Meta = unknown>({}: LineChartProps<Meta>): React.ReactElement {const { yScaleType = 'linear', percentStackView = false, showGrid = false } = config ?? {}- const hasAreaFill = useMemo(() => series.some((s) => s.fill !== undefined && !s.fill.lowerData), [series])+ const hasMultipleFilledSeries = useMemo(() => {+ const filledSeries = series.filter((s) => s.fill && !s.fill.lowerData)+ return filledSeries.length >= 2+ }, [series])const stackedData = useMemo((): Map<string, StackedBand> | undefined => {if (percentStackView) {return computePercentStackData(series, labels)}- if (hasAreaFill) {+ // Only stack when there are 2+ fillable series — a single area series has nothing to stack+ // against, and forcing a stacked band would feed a `bottomValues` array into the canvas+ // renderer, which disables the gradient fill path.+ if (hasMultipleFilledSeries) {return computeStackData(series, labels)}return undefined- }, [percentStackView, hasAreaFill, series, labels])+ }, [percentStackView, hasMultipleFilledSeries, series, labels])const chartConfig = useMemo(() => {const base = { ...config, isPercent: percentStackView }diff --git a/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.stories.tsx b/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.stories.tsxnew file mode 100644index 000000000000..9a38880399a9--- /dev/null+++ b/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.stories.tsx@@ -0,0 +1,71 @@+import { Meta, StoryObj } from '@storybook/react'++import { Stage, useReactiveTheme } from '../../story-helpers'+import { Sparkline } from './Sparkline'++const RISING = [4200, 5100, 4700, 5400, 6000, 5800, 6400, 6900, 7200, 7700, 8100, 8800]+const FALLING = [9800, 9200, 8600, 8400, 7700, 7300, 6900, 6500, 6000, 5400, 4800, 4200]+const VOLATILE = [40, 65, 30, 85, 20, 70, 45, 90, 35, 75, 25, 60]+const FLAT = [50, 52, 49, 51, 50, 53, 48, 50, 51, 49, 52, 50]++const meta: Meta = { title: 'Components/HogCharts/Sparkline', parameters: { layout: 'centered' } }+export default meta++type Story = StoryObj++export const Default: Story = {+ render: () => {+ const theme = useReactiveTheme()+ return (+ <Stage width={360} height={120}>+ <Sparkline data={RISING} theme={theme} />+ </Stage>+ )+ },+}++export const CustomColor: Story = {+ render: () => {+ const theme = useReactiveTheme()+ return (+ <Stage width={360} height={120}>+ <Sparkline data={FALLING} theme={theme} color="#fb7185" />+ </Stage>+ )+ },+}++export const Volatile: Story = {+ render: () => {+ const theme = useReactiveTheme()+ return (+ <Stage width={360} height={120}>+ <Sparkline data={VOLATILE} theme={theme} color="#a78bfa" />+ </Stage>+ )+ },+}++export const Flat: Story = {+ render: () => {+ const theme = useReactiveTheme()+ return (+ <Stage width={360} height={120}>+ <Sparkline data={FLAT} theme={theme} />+ </Stage>+ )+ },+}++export const FillOpacityVariants: Story = {+ render: () => {+ const theme = useReactiveTheme()+ return (+ <div className="flex flex-col gap-4 w-[360px]">+ <Sparkline data={RISING} theme={theme} fillOpacity={0.1} />+ <Sparkline data={RISING} theme={theme} fillOpacity={0.35} />+ <Sparkline data={RISING} theme={theme} fillOpacity={0.7} />+ </div>+ )+ },+}diff --git a/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.test.tsx b/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.test.tsxnew file mode 100644index 000000000000..4efb06ae17e6--- /dev/null+++ b/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.test.tsx@@ -0,0 +1,48 @@+import { fireEvent } from '@testing-library/react'++import type { ChartTheme } from '../../core/types'+import { renderHogChart } from '../../testing'+import { Sparkline } from './Sparkline'++const THEME: ChartTheme = { colors: ['#22d3ee'], backgroundColor: '#ffffff' }+const LABELS = ['Jan', 'Feb', 'Mar', 'Apr']++describe('Sparkline', () => {+ it('renders a canvas for the line chart', () => {+ const { container } = renderHogChart(<Sparkline data={[100, 200, 300, 400]} labels={LABELS} theme={THEME} />)+ expect(container.querySelector('canvas')).not.toBeNull()+ })++ it('fires onHoverIndexChange with the hovered index and -1 when leaving', () => {+ const onHover = jest.fn()+ const { chart, container } = renderHogChart(+ <Sparkline data={[100, 200, 300, 400]} labels={LABELS} theme={THEME} onHoverIndexChange={onHover} />+ )+ // Initial hoverIndex is -1, so the first subscription fire matches the "not hovering" state.+ expect(onHover).toHaveBeenCalledWith(-1)+ onHover.mockClear()++ chart.hoverAtIndex(2)+ expect(onHover).toHaveBeenLastCalledWith(2)++ const wrapper = container.querySelector('canvas')!.parentElement as HTMLElement+ fireEvent.mouseLeave(wrapper)+ expect(onHover).toHaveBeenLastCalledWith(-1)+ })++ it('fires -1 on unmount so a parent still mounted does not show a stale positive index', () => {+ const onHover = jest.fn()+ const { chart, unmount } = renderHogChart(+ <Sparkline data={[100, 200, 300]} labels={LABELS.slice(0, 3)} theme={THEME} onHoverIndexChange={onHover} />+ )+ chart.hoverAtIndex(1)+ onHover.mockClear()+ unmount()+ expect(onHover).toHaveBeenLastCalledWith(-1)+ })++ it('does not require labels — falls back to index strings', () => {+ const { container } = renderHogChart(<Sparkline data={[10, 20, 30]} theme={THEME} />)+ expect(container.querySelector('canvas')).not.toBeNull()+ })+})diff --git a/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.tsx b/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.tsxnew file mode 100644index 000000000000..d505d078e5b5--- /dev/null+++ b/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.tsx@@ -0,0 +1,92 @@+import React, { useEffect, useMemo } from 'react'++import { useChartHover } from '../../core/chart-context'+import { ChartErrorBoundary } from '../../core/ChartErrorBoundary'+import { useLatest } from '../../core/hooks/useLatest'+import type { ChartTheme, LineChartConfig, Series } from '../../core/types'+import { LineChart } from '../LineChart'++export interface SparklineProps {+ data: number[]+ /** Optional x-axis labels — when omitted, indices stand in. Consumers can look up+ * the hovered index against their own labels. */+ labels?: string[]+ theme: ChartTheme+ color?: string+ height?: number+ /** Peak opacity of the gradient fill under the line. Range 0–1. */+ fillOpacity?: number+ /** Fires the hovered index, or -1 when not hovering. */+ onHoverIndexChange?: (index: number) => void+ className?: string+ dataAttr?: string+ onError?: (error: Error, info: React.ErrorInfo) => void+}++const SPARKLINE_CONFIG: LineChartConfig = {+ hideXAxis: true,+ hideYAxis: true,+ showCrosshair: true,+ tooltip: { enabled: false },+ margins: { top: 0, right: 0, bottom: 0, left: 0 },+}++export function Sparkline(props: SparklineProps): React.ReactElement {+ const { onError, ...rest } = props+ return (+ <ChartErrorBoundary onError={onError}>+ <SparklineInner {...rest} />+ </ChartErrorBoundary>+ )+}++function SparklineInner({+ data,+ labels,+ theme,+ color,+ height = 120,+ fillOpacity = 0.35,+ onHoverIndexChange,+ className,+ dataAttr,+}: Omit<SparklineProps, 'onError'>): React.ReactElement {+ const resolvedColor = color ?? theme.colors[0]+ const resolvedLabels = useMemo<string[]>(+ () => labels ?? Array.from({ length: data.length }, (_, i) => String(i)),+ [labels, data.length]+ )+ const series = useMemo<Series[]>(+ () => [+ {+ key: 'sparkline',+ label: 'sparkline',+ data,+ color: resolvedColor,+ fill: { gradient: true, opacity: fillOpacity },+ },+ ],+ [data, resolvedColor, fillOpacity]+ )+ const wrapperStyle = useMemo<React.CSSProperties>(() => ({ height }), [height])++ return (+ <div className={`relative flex flex-col ${className ?? ''}`} style={wrapperStyle} data-attr={dataAttr}>+ <LineChart series={series} labels={resolvedLabels} theme={theme} config={SPARKLINE_CONFIG}>+ {onHoverIndexChange ? <HoverWatcher onHoverChange={onHoverIndexChange} /> : null}+ </LineChart>+ </div>+ )+}++function HoverWatcher({ onHoverChange }: { onHoverChange: (i: number) => void }): null {+ const { hoverIndex } = useChartHover()+ const cb = useLatest(onHoverChange)+ useEffect(() => {+ cb.current(hoverIndex)+ }, [hoverIndex, cb])+ // Reset to -1 on unmount so a parent still mounted after Sparkline tears down+ // doesn't keep showing the last positive hover index.+ useEffect(() => () => cb.current(-1), [cb])+ return null+}diff --git a/frontend/src/lib/hog-charts/core/Chart.tsx b/frontend/src/lib/hog-charts/core/Chart.tsxindex fffb9f57b063..ebeda6276972 100644--- a/frontend/src/lib/hog-charts/core/Chart.tsx+++ b/frontend/src/lib/hog-charts/core/Chart.tsx@@ -121,6 +121,7 @@ export function Chart<Meta = unknown>({showCrosshair = false,axisOrientation = 'vertical',isPercent = false,+ margins: marginsOverride,} = config ?? {}const interactionAxis: 'x' | 'y' = axisOrientation === 'horizontal' ? 'y' : 'x'const {@@ -139,6 +140,7 @@ export function Chart<Meta = unknown>({xTickFormatter,yTickFormatter,axisOrientation,+ override: marginsOverride,})const { canvasRef, overlayCanvasRef, wrapperRef, dimensions, ctx, overlayCtx } = useChartCanvas({ margins })diff --git a/frontend/src/lib/hog-charts/core/canvas-renderer.test.ts b/frontend/src/lib/hog-charts/core/canvas-renderer.test.tsindex be27260061c2..bb0391491251 100644--- a/frontend/src/lib/hog-charts/core/canvas-renderer.test.ts+++ b/frontend/src/lib/hog-charts/core/canvas-renderer.test.ts@@ -343,6 +343,59 @@ describe('hog-charts canvas-renderer', () => {})})+ describe('drawArea — gradient fill', () => {+ it('uses a vertical CanvasGradient as fillStyle when fill.gradient is true', () => {+ const ctx = mockCanvasContext()+ const gradient = { addColorStop: jest.fn() } as unknown as CanvasGradient+ ;(ctx as unknown as { createLinearGradient: jest.Mock }).createLinearGradient = jest+ .fn()+ .mockReturnValue(gradient)++ const labels = ['a', 'b', 'c']+ const series = makeSeries({ key: 's', data: [10, 20, 30], color: '#22d3ee', fill: { gradient: true } })++ const recordedFillStyles: unknown[] = []+ Object.defineProperty(ctx, 'fillStyle', {+ get: () => undefined,+ set: (v) => recordedFillStyles.push(v),+ })++ drawArea(makeDrawContext(ctx, labels), series)++ expect(ctx.createLinearGradient).toHaveBeenCalledWith(+ 0,+ dimensions.plotTop,+ 0,+ dimensions.plotTop + dimensions.plotHeight+ )+ expect(gradient.addColorStop).toHaveBeenCalledWith(0, '#22d3ee')+ expect(gradient.addColorStop).toHaveBeenCalledWith(1, 'transparent')+ expect(recordedFillStyles).toContain(gradient)+ })++ it('ignores gradient when lowerData is set (fill-between needs a solid fill)', () => {+ const ctx = mockCanvasContext()+ ;(ctx as unknown as { createLinearGradient: jest.Mock }).createLinearGradient = jest.fn()+ const labels = ['a', 'b']+ const series = makeSeries({ key: 's', data: [50, 80], color: '#22d3ee', fill: { gradient: true } })+ drawArea(makeDrawContext(ctx, labels), series, undefined, [10, 20])+ expect(ctx.createLinearGradient).not.toHaveBeenCalled()+ })++ it('lets the area extend below baseline when bottomValues is omitted (single-series negative case)', () => {+ // LineChart now skips stacking for a single fillable series, so drawArea is called+ // without bottomValues — meaning negative data is plotted against the raw scale,+ // not clamped to the baseline by a stacked band's Math.max(0, raw).+ const ctx = mockCanvasContext()+ const labels = ['a', 'b', 'c']+ const series = makeSeries({ key: 's', data: [10, -5, 20], color: '#22d3ee', fill: {} })+ drawArea(makeDrawContext(ctx, labels), series)+ const baseline = dimensions.plotTop + dimensions.plotHeight+ const lineToYs = (ctx.lineTo as jest.Mock).mock.calls.map(([, y]) => y as number)+ expect(lineToYs.some((y) => y > baseline)).toBe(true)+ })+ })+describe('drawArea — partial dashing', () => {it.each([{diff --git a/frontend/src/lib/hog-charts/core/canvas-renderer.ts b/frontend/src/lib/hog-charts/core/canvas-renderer.tsindex 787a24e1dfae..7e5aaa9e129e 100644--- a/frontend/src/lib/hog-charts/core/canvas-renderer.ts+++ b/frontend/src/lib/hog-charts/core/canvas-renderer.ts@@ -199,13 +199,23 @@ export function drawArea(ctx.globalAlpha = opacity+ // Gradient applies only to the un-stacked baseline fill; dashed-partial segments+ // stay on a solid fill via the branch below.+ const useGradient = series.fill?.gradient && !bottomValues+ let gradient: CanvasGradient | null = null+ if (useGradient) {+ gradient = ctx.createLinearGradient(0, dimensions.plotTop, 0, baseline)+ gradient.addColorStop(0, series.color)+ gradient.addColorStop(1, 'transparent')+ }+for (const { top, bottom } of segments) {if (top.length < 2) {continue}if (dashedFrom === null && dashedTo === null) {- ctx.fillStyle = series.color+ ctx.fillStyle = gradient ?? series.colorfillAreaPath(ctx, top, bottom)continue}diff --git a/frontend/src/lib/hog-charts/core/hooks/useChartMargins.ts b/frontend/src/lib/hog-charts/core/hooks/useChartMargins.tsindex f38567081f3d..6ae30e5a6aa9 100644--- a/frontend/src/lib/hog-charts/core/hooks/useChartMargins.ts+++ b/frontend/src/lib/hog-charts/core/hooks/useChartMargins.ts@@ -27,6 +27,8 @@ interface UseChartMarginsOptions {xTickFormatter?: (value: string, index: number) => string | nullyTickFormatter?: (value: number) => stringaxisOrientation?: 'vertical' | 'horizontal'+ /** Per-side overrides applied on top of the computed margins. */+ override?: Partial<ChartMargins>}function widestCategoryLabelWidth(@@ -73,6 +75,7 @@ export function useChartMargins({xTickFormatter,yTickFormatter,axisOrientation = 'vertical',+ override,}: UseChartMarginsOptions): ChartMargins {const isHorizontal = axisOrientation === 'horizontal'const normalizedXAxisLabel = normalizeAxisLabel(xAxisLabel)@@ -122,7 +125,8 @@ export function useChartMargins({) + (normalizedYAxisLabel ? Y_AXIS_TITLE_MARGIN : 0)const rightFloor = hasMultipleAxes && !hideYAxis ? MIN_RIGHT_MARGIN_DUAL_AXIS : DEFAULT_MARGINS.rightconst right = Math.max(rightFloor, xLabelHalfWidth + X_LABEL_EDGE_PADDING)- return { top: DEFAULT_MARGINS.top, right, bottom, left }+ const computed: ChartMargins = { top: DEFAULT_MARGINS.top, right, bottom, left }+ return override ? { ...computed, ...override } : computed}, [hideXAxis,hideYAxis,@@ -131,5 +135,6 @@ export function useChartMargins({xLabelHalfWidth,normalizedXAxisLabel,normalizedYAxisLabel,+ override,])}diff --git a/frontend/src/lib/hog-charts/core/types.ts b/frontend/src/lib/hog-charts/core/types.tsindex 70cb33e7327c..cfecf6518266 100644--- a/frontend/src/lib/hog-charts/core/types.ts+++ b/frontend/src/lib/hog-charts/core/types.ts@@ -64,6 +64,10 @@ export interface Series<Meta = unknown> {* When set, the area is drawn between `data` (top) and this (bottom) instead of* filling down to the x-axis baseline. */lowerData?: number[]+ /** Fade the fill vertically from the series color at the top of the plot to transparent+ * at the baseline. Ignored whenever the area has a bottom edge — stacking, `lowerData`,+ * or dashed `stroke.partial` (those branches need a solid fill / hatch). */+ gradient?: boolean}/** Auxiliary overlay derived from primary data — trend lines and moving averages.* Excluded from stack computation and from the y-axis baseline calculation, so a@@ -176,6 +180,10 @@ export interface ChartConfig {/** True for BarChart `barLayout: 'percent'` / LineChart `percentStackView`. Surfaced* on layout context so overlays can default to a percent formatter. */isPercent?: boolean+ /** Per-side overrides applied on top of the computed chart margins. Useful for sparklines+ * that want the plot area flush with the canvas edges (e.g. `{ left: 0, right: 0, top: 0, bottom: 0 }`).+ * Should be referentially stable — pass a module-level constant rather than an inline object. */+ margins?: Partial<ChartMargins>}export interface TooltipConfig {diff --git a/frontend/src/lib/hog-charts/index.ts b/frontend/src/lib/hog-charts/index.tsindex 10b769865145..80837d49f3ee 100644--- a/frontend/src/lib/hog-charts/index.ts+++ b/frontend/src/lib/hog-charts/index.ts@@ -14,6 +14,8 @@ export type {export type { ValueLabelsConfig } from './charts/utils/use-value-labels'export { TimeSeriesBarChart } from './charts/TimeSeriesBarChart/TimeSeriesBarChart'export type { TimeSeriesBarChartConfig, TimeSeriesBarChartProps } from './charts/TimeSeriesBarChart/TimeSeriesBarChart'+export { Sparkline } from './charts/Sparkline/Sparkline'+export type { SparklineProps } from './charts/Sparkline/Sparkline'// Base chart (for building new chart types)export { Chart } from './core/Chart'