Skip to content

: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.

chore(charts): prune dead exports and add CI-band visual guard (#63874)

Sam Penningtoneedcdadc8cce
diff --git a/packages/quill/packages/charts/src/charts/LineChart/LineChart.stories.tsx b/packages/quill/packages/charts/src/charts/LineChart/LineChart.stories.tsx
index 0e9d4c5bc359..ed8c065f4c20 100644
--- a/packages/quill/packages/charts/src/charts/LineChart/LineChart.stories.tsx
+++ b/packages/quill/packages/charts/src/charts/LineChart/LineChart.stories.tsx
@@ -267,6 +267,36 @@ export const CombinedOverlays: Story = {
},
}
+/** Confidence band whose lower bound dips below zero — the y-axis must widen to
+ * include it rather than clipping at the data minimum. Visual guard for the
+ * band-aware domain (lowerData folded into the value range). */
+export const ConfidenceBandBelowZero: Story = {
+ render: () => {
+ const theme = useReactiveTheme()
+ const color = theme.colors[0]
+ const data = [6, 4, 8, 5, 9, 4, 7]
+ // Hand-built wide band so the lower edge crosses zero on several points.
+ const lower = [1, -2, 3, -1, 4, -3, 2]
+ const upper = [11, 10, 13, 11, 14, 11, 12]
+ const series: Series[] = [
+ { key: 'visits', label: 'Visits', color, data, points: { radius: 3 } },
+ {
+ key: 'visits__ci',
+ label: 'Visits (CI)',
+ color,
+ data: upper,
+ fill: { opacity: 0.2, lowerData: lower },
+ visibility: { tooltip: false, valueLabel: false },
+ },
+ ]
+ return (
+ <Stage width={560} height={320}>
+ <LineChart series={series} labels={DAYS} config={BASIC} theme={theme} />
+ </Stage>
+ )
+ },
+}
+
/** Single series spanning a few orders of magnitude — locks in log-axis tick generation. */
export const LogScale: Story = {
render: () => {
diff --git a/packages/quill/packages/charts/src/index.ts b/packages/quill/packages/charts/src/index.ts
index 37c3e48f2738..2611b980d1ec 100644
--- a/packages/quill/packages/charts/src/index.ts
+++ b/packages/quill/packages/charts/src/index.ts
@@ -23,7 +23,7 @@ export type { MetricCardProps, ChangeColor, MetricChange } from './components/Me
export { Chart } from './core/Chart'
export type { ChartProps } from './core/Chart'
export { ChartErrorBoundary } from './core/ChartErrorBoundary'
-export { RadialChart, RADIAL_MARGINS } from './core/RadialChart'
+export { RadialChart } from './core/RadialChart'
export type { RadialChartProps, RadialLayoutBuilder } from './core/RadialChart'
export { DEFAULT_MARGINS } from './core/hooks/useChartMargins'
@@ -102,7 +102,7 @@ export type { ThemeFromCssOptions } from './core/theme'
// Built-in tooltip (for reference or extension)
export { DefaultTooltip } from './overlays/DefaultTooltip'
// Shared tooltip surface — reuse to build custom tooltips with the quill look
-export { TooltipSurface, TooltipSwatch, TOOLTIP_FALLBACK_BG, TOOLTIP_FALLBACK_COLOR } from './overlays/TooltipSurface'
+export { TooltipSurface, TooltipSwatch } from './overlays/TooltipSurface'
// Optional overlays
export { ReferenceLine, ReferenceLines } from './overlays/ReferenceLine'
@@ -128,7 +128,7 @@ export type { AnomalyMarker } from './overlays/AnomalyPointsLayer'
export { movingAverageKey } from './charts/TimeSeriesLineChart/utils/derived-series'
// Timeseries utils
-export { createXAxisTickCallback, parseDateForAxis } from './utils/dates'
+export { createXAxisTickCallback } from './utils/dates'
export type { TimeInterval } from './utils/dates'
export { buildYTickFormatter } from './utils/y-formatters'
export type { YAxisFormat, YFormatterConfig } from './utils/y-formatters'
diff --git a/packages/quill/packages/charts/src/overlays/AnomalyPointsLayer.test.tsx b/packages/quill/packages/charts/src/overlays/AnomalyPointsLayer.test.tsx
index 78e2e2c16d04..48026240a301 100644
--- a/packages/quill/packages/charts/src/overlays/AnomalyPointsLayer.test.tsx
+++ b/packages/quill/packages/charts/src/overlays/AnomalyPointsLayer.test.tsx
@@ -74,15 +74,13 @@ describe('AnomalyPointsLayer', () => {
expect(dot.style.left).toBe('395px')
})
- it('skips a marker whose label is unknown to the x-scale', () => {
+ it.each([
// dataIndex 9 is out of the labels array → no x pixel.
- const { container } = renderInChart(<AnomalyPointsLayer markers={[marker({ dataIndex: 9 })]} />)
- expect(dots(container)).toHaveLength(0)
- })
-
- it('skips a marker whose y value falls outside the plot bounds', () => {
+ ['label unknown to the x-scale', marker({ dataIndex: 9 })],
// value 500 → yScale(500) = 368 - 1760 = well above plotTop, out of bounds.
- const { container } = renderInChart(<AnomalyPointsLayer markers={[marker({ value: 500 })]} />)
+ ['y value outside the plot bounds', marker({ value: 500 })],
+ ])('skips a marker with %s', (_label, m) => {
+ const { container } = renderInChart(<AnomalyPointsLayer markers={[m]} />)
expect(dots(container)).toHaveLength(0)
})