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(hog-charts): move LineChart into its own folder (#60756)

Sam Pennington0a6409128909
diff --git a/frontend/src/lib/hog-charts/charts/LineChart.stories.tsx b/frontend/src/lib/hog-charts/charts/LineChart/LineChart.stories.tsx
similarity index 97%
rename from frontend/src/lib/hog-charts/charts/LineChart.stories.tsx
rename to frontend/src/lib/hog-charts/charts/LineChart/LineChart.stories.tsx
index 584700eb034b..c31e8fff8e8d 100644
--- a/frontend/src/lib/hog-charts/charts/LineChart.stories.tsx
+++ b/frontend/src/lib/hog-charts/charts/LineChart/LineChart.stories.tsx
@@ -1,11 +1,11 @@
import { Meta, StoryObj } from '@storybook/react'
-import type { LineChartConfig, Series } from '../core/types'
-import { DEFAULT_Y_AXIS_ID } from '../core/types'
-import { ReferenceLine } from '../overlays/ReferenceLine'
-import { ValueLabels } from '../overlays/ValueLabels'
-import { playHoverAtFraction, Stage, useReactiveTheme } from '../story-helpers'
-import { ciRanges, trendLine } from '../utils/statistics'
+import type { LineChartConfig, Series } from '../../core/types'
+import { DEFAULT_Y_AXIS_ID } from '../../core/types'
+import { ReferenceLine } from '../../overlays/ReferenceLine'
+import { ValueLabels } from '../../overlays/ValueLabels'
+import { playHoverAtFraction, Stage, useReactiveTheme } from '../../story-helpers'
+import { ciRanges, trendLine } from '../../utils/statistics'
import { LineChart } from './LineChart'
const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
diff --git a/frontend/src/lib/hog-charts/charts/LineChart.test.tsx b/frontend/src/lib/hog-charts/charts/LineChart/LineChart.test.tsx
similarity index 98%
rename from frontend/src/lib/hog-charts/charts/LineChart.test.tsx
rename to frontend/src/lib/hog-charts/charts/LineChart/LineChart.test.tsx
index e33ecc1e4e79..b41c5a640731 100644
--- a/frontend/src/lib/hog-charts/charts/LineChart.test.tsx
+++ b/frontend/src/lib/hog-charts/charts/LineChart/LineChart.test.tsx
@@ -1,6 +1,6 @@
-import type { ChartTheme, Series } from '../core/types'
-import { ReferenceLine } from '../overlays/ReferenceLine'
-import { renderHogChart } from '../testing'
+import type { ChartTheme, Series } from '../../core/types'
+import { ReferenceLine } from '../../overlays/ReferenceLine'
+import { renderHogChart } from '../../testing'
import { LineChart } from './LineChart'
const THEME: ChartTheme = {
diff --git a/frontend/src/lib/hog-charts/charts/LineChart.tsx b/frontend/src/lib/hog-charts/charts/LineChart/LineChart.tsx
similarity index 96%
rename from frontend/src/lib/hog-charts/charts/LineChart.tsx
rename to frontend/src/lib/hog-charts/charts/LineChart/LineChart.tsx
index 14065c972a52..6d1145deba18 100644
--- a/frontend/src/lib/hog-charts/charts/LineChart.tsx
+++ b/frontend/src/lib/hog-charts/charts/LineChart/LineChart.tsx
@@ -1,9 +1,9 @@
import React, { useCallback, useMemo } from 'react'
-import { drawArea, drawGrid, drawHighlightPoint, drawLine, drawPoints } from '../core/canvas-renderer'
-import type { DrawContext } from '../core/canvas-renderer'
-import { Chart } from '../core/Chart'
-import { ChartErrorBoundary } from '../core/ChartErrorBoundary'
+import { drawArea, drawGrid, drawHighlightPoint, drawLine, drawPoints } from '../../core/canvas-renderer'
+import type { DrawContext } from '../../core/canvas-renderer'
+import { Chart } from '../../core/Chart'
+import { ChartErrorBoundary } from '../../core/ChartErrorBoundary'
import {
buildSegmentResolveValue,
buildStackedPositionValue,
@@ -12,9 +12,9 @@ import {
createScales as createLineScales,
resolveYScaleForSeries,
yTickCountForHeight,
-} from '../core/scales'
-import type { ScaleSet, StackedBand } from '../core/scales'
-import { DEFAULT_Y_AXIS_ID } from '../core/types'
+} from '../../core/scales'
+import type { ScaleSet, StackedBand } from '../../core/scales'
+import { DEFAULT_Y_AXIS_ID } from '../../core/types'
import type {
ChartDimensions,
ChartDrawArgs,
@@ -27,7 +27,7 @@ import type {
Series,
TooltipContext,
YAxisScale,
-} from '../core/types'
+} from '../../core/types'
// Brand for the private ChartScales._private slot used by LineChart. The base Chart
// and other chart types treat this as opaque; LineChart's drawStatic narrows back to it.
diff --git a/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.tsx b/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.tsx
index d505d078e5b5..346bd832b488 100644
--- a/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.tsx
+++ b/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.tsx
@@ -4,7 +4,7 @@ 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'
+import { LineChart } from '../LineChart/LineChart'
export interface SparklineProps {
data: number[]
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx b/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx
index 56a64505c2b6..ae7ca17f396c 100644
--- a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx
+++ b/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx
@@ -17,7 +17,7 @@ import {
type XAxisConfig,
type YAxisConfig,
} from '../../utils/use-axis-formatters'
-import { LineChart } from '../LineChart'
+import { LineChart } from '../LineChart/LineChart'
import {
resolveValueLabelsConfig,
useSeriesWithValueLabelAllowlist,
diff --git a/frontend/src/lib/hog-charts/index.ts b/frontend/src/lib/hog-charts/index.ts
index 8b715aebe9b8..07a5397769da 100644
--- a/frontend/src/lib/hog-charts/index.ts
+++ b/frontend/src/lib/hog-charts/index.ts
@@ -1,8 +1,8 @@
// Components
export { BarChart } from './charts/BarChart/BarChart'
export type { BarChartProps } from './charts/BarChart/BarChart'
-export { LineChart } from './charts/LineChart'
-export type { LineChartProps } from './charts/LineChart'
+export { LineChart } from './charts/LineChart/LineChart'
+export type { LineChartProps } from './charts/LineChart/LineChart'
export { TimeSeriesLineChart } from './charts/TimeSeriesLineChart/TimeSeriesLineChart'
export type {
ConfidenceIntervalConfig,
diff --git a/frontend/src/lib/hog-charts/overlays/ReferenceLine.stories.tsx b/frontend/src/lib/hog-charts/overlays/ReferenceLine.stories.tsx
index f841b3be4e52..6982298253ce 100644
--- a/frontend/src/lib/hog-charts/overlays/ReferenceLine.stories.tsx
+++ b/frontend/src/lib/hog-charts/overlays/ReferenceLine.stories.tsx
@@ -1,6 +1,6 @@
import { Meta, StoryObj } from '@storybook/react'
-import { LineChart } from '../charts/LineChart'
+import { LineChart } from '../charts/LineChart/LineChart'
import type { LineChartConfig, Series } from '../core/types'
import { Stage, useReactiveTheme } from '../story-helpers'
import { ReferenceLine } from './ReferenceLine'
diff --git a/frontend/src/lib/hog-charts/overlays/ValueLabels.stories.tsx b/frontend/src/lib/hog-charts/overlays/ValueLabels.stories.tsx
index 591371bcd7ef..02519d4495b9 100644
--- a/frontend/src/lib/hog-charts/overlays/ValueLabels.stories.tsx
+++ b/frontend/src/lib/hog-charts/overlays/ValueLabels.stories.tsx
@@ -1,6 +1,6 @@
import { Meta, StoryObj } from '@storybook/react'
-import { LineChart } from '../charts/LineChart'
+import { LineChart } from '../charts/LineChart/LineChart'
import type { LineChartConfig, Series } from '../core/types'
import { Stage, useReactiveTheme } from '../story-helpers'
import { ValueLabels } from './ValueLabels'