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.

refactor(frontend): move shared chart helpers to lib/charts (#126837)

Paul D'Ambrab04bcc23df02
diff --git a/frontend/bin/layer-baseline.txt b/frontend/bin/layer-baseline.txt
index a2b83280e0f6..6a139b5e92f4 100644
--- a/frontend/bin/layer-baseline.txt
+++ b/frontend/bin/layer-baseline.txt
@@ -522,17 +522,7 @@ frontend/src/queries/nodes/DataTable/renderColumn.tsx -> products/mcp_analytics/
frontend/src/queries/nodes/DataTable/renderColumn.tsx -> products/persons/frontend/components/GroupActorDisplay.tsx
frontend/src/queries/nodes/DataTable/renderColumn.tsx -> products/persons/frontend/components/PersonDisplay.tsx
frontend/src/queries/nodes/DataTable/renderColumn.tsx -> products/persons/frontend/person-utils.ts
-frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.tsx -> products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts
-frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBoxPlot.tsx -> products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts
-frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlComboGraph.tsx -> products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts
-frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlLineGraph.tsx -> products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts
frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlMetricCard.tsx -> frontend/src/scenes/insights/EmptyStates/index.ts
-frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlMetricCard.tsx -> products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts
-frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlPieGraph.tsx -> products/product_analytics/frontend/insights/trends/TrendsPieChart/DonutCenterLabel.tsx
-frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlPieGraph.tsx -> products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts
-frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlProportionBar.tsx -> products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts
-frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlScatterGraph.tsx -> products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts
-frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts -> products/product_analytics/frontend/insights/shared/chartStyleAdapter.ts
frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts -> products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.ts
frontend/src/queries/nodes/DataVisualization/Components/Heatmap/TwoDimensionalHeatmap.tsx -> frontend/src/scenes/insights/EmptyStates/index.ts
frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.tsx -> frontend/src/scenes/insights/aggregationAxisFormat.ts
diff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/DonutCenterLabel.tsx b/frontend/src/lib/charts/DonutCenterLabel.tsx
similarity index 100%
rename from products/product_analytics/frontend/insights/trends/TrendsPieChart/DonutCenterLabel.tsx
rename to frontend/src/lib/charts/DonutCenterLabel.tsx
diff --git a/products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts b/frontend/src/lib/charts/chartErrorHandler.ts
similarity index 100%
rename from products/product_analytics/frontend/insights/trends/shared/chartErrorHandler.ts
rename to frontend/src/lib/charts/chartErrorHandler.ts
diff --git a/products/product_analytics/frontend/insights/shared/chartStyleAdapter.test.ts b/frontend/src/lib/charts/chartStyleAdapter.test.ts
similarity index 100%
rename from products/product_analytics/frontend/insights/shared/chartStyleAdapter.test.ts
rename to frontend/src/lib/charts/chartStyleAdapter.test.ts
diff --git a/products/product_analytics/frontend/insights/shared/chartStyleAdapter.ts b/frontend/src/lib/charts/chartStyleAdapter.ts
similarity index 100%
rename from products/product_analytics/frontend/insights/shared/chartStyleAdapter.ts
rename to frontend/src/lib/charts/chartStyleAdapter.ts
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.tsx
index 69943d1e74d4..69d49b307867 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.tsx
@@ -10,12 +10,11 @@ import {
type ValueLabelContext,
} from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { AnnotationsLayer } from 'lib/components/AnnotationsOverlay/AnnotationsLayer'
import { ChartDisplayType } from '~/types'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { type SqlChartProps } from './SqlChart'
import { SqlChartTooltip } from './SqlChartTooltip'
import {
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBoxPlot.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBoxPlot.tsx
index d7f74c867ba9..18c77cf57152 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBoxPlot.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBoxPlot.tsx
@@ -5,12 +5,11 @@ import { useEffect, useMemo } from 'react'
import { BoxPlot } from '@posthog/quill-charts'
import type { BoxPlotConfig } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartConfig, useChartTheme } from 'lib/charts/hooks'
import { ChartSettings } from '~/queries/schema/schema-general'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { Column } from '../../dataVisualizationLogic'
import { buildSqlBoxPlotModel } from './sqlBoxPlotAdapter'
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlComboGraph.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlComboGraph.tsx
index 064a3abac521..7e4af843d525 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlComboGraph.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlComboGraph.tsx
@@ -2,10 +2,9 @@ import clsx from 'clsx'
import { TimeSeriesComboChart, type PointClickData } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { AnnotationsLayer } from 'lib/components/AnnotationsOverlay/AnnotationsLayer'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { type SqlChartProps } from './SqlChart'
import { SqlChartTooltip } from './SqlChartTooltip'
import { SqlLineSeriesMeta, buildComboChartConfig } from './sqlLineGraphAdapter'
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlLineGraph.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlLineGraph.tsx
index bb7dc94a7565..c6515d4c2119 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlLineGraph.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlLineGraph.tsx
@@ -3,10 +3,9 @@ import { useCallback } from 'react'
import { TimeSeriesLineChart, type PointClickData, type TooltipContext } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { AnnotationsLayer } from 'lib/components/AnnotationsOverlay/AnnotationsLayer'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { type SqlChartProps } from './SqlChart'
import { SqlChartTooltip } from './SqlChartTooltip'
import { SqlLineSeriesMeta, buildLineChartConfig } from './sqlLineGraphAdapter'
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlMetricCard.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlMetricCard.tsx
index e3e66a90b5ab..6bfb47080e2d 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlMetricCard.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlMetricCard.tsx
@@ -2,6 +2,7 @@ import clsx from 'clsx'
import { MetricCard } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartTheme } from 'lib/charts/hooks'
import {
METRIC_DEFAULT_DECREASE_COLOR,
@@ -14,8 +15,6 @@ import { InsightEmptyState } from 'scenes/insights/EmptyStates'
import { MetricChartSettings } from '~/queries/schema/schema-general'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { AxisSeries } from '../../dataVisualizationLogic'
import { formatSqlSeriesValue } from './sqlLineGraphAdapter'
import { useSqlMetricModel } from './useSqlMetricModel'
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlPieGraph.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlPieGraph.tsx
index fb8f83877550..e20ebc4137b9 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlPieGraph.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlPieGraph.tsx
@@ -4,10 +4,10 @@ import { useCallback, useMemo } from 'react'
import { ChartLegend, PieChart, TooltipSurface, TooltipSwatch, useChartLegend } from '@posthog/quill-charts'
import type { PieChartConfig, TooltipContext } from '@posthog/quill-charts'
-import { ChartDisplayType } from '~/types'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
+import { DonutCenterLabel } from 'lib/charts/DonutCenterLabel'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-import { DonutCenterLabel } from 'products/product_analytics/frontend/insights/trends/TrendsPieChart/DonutCenterLabel'
+import { ChartDisplayType } from '~/types'
import { SqlChartProps } from './SqlChart'
import { formatPieSliceCount } from './sqlPieGraphAdapter'
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlProportionBar.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlProportionBar.tsx
index 0b1692d9f3ef..ae71760607b6 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlProportionBar.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlProportionBar.tsx
@@ -3,10 +3,9 @@ import clsx from 'clsx'
import { ProportionBar } from '@posthog/quill-charts'
import type { ProportionBarConfig } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartConfig } from 'lib/charts/hooks'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { SqlChartProps } from './SqlChart'
import { useSqlPartOfWholeChart } from './useSqlPartOfWholeChart'
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlScatterGraph.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlScatterGraph.tsx
index dcc0f8c1a5aa..a1ecb54abdbd 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlScatterGraph.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlScatterGraph.tsx
@@ -9,12 +9,11 @@ import {
ChartLegendConfig,
} from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartConfig, useChartTheme } from 'lib/charts/hooks'
import { ChartSettings } from '~/queries/schema/schema-general'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { AxisSeries } from '../../dataVisualizationLogic'
import { buildScatterConfig, buildScatterSeries, SqlScatterSeries, SqlScatterPointMeta } from './sqlScatterGraphAdapter'
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts b/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts
index 5a9fac208c67..c02ea05c3ed5 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts
@@ -18,12 +18,12 @@ import {
type YAxisConfig,
} from '@posthog/quill-charts'
+import { chartStyleCurve } from 'lib/charts/chartStyleAdapter'
import { dayjs } from 'lib/dayjs'
import { ChartSettings, GoalLine, YAxisSettings } from '~/queries/schema/schema-general'
import { ChartDisplayType } from '~/types'
-import { chartStyleCurve } from 'products/product_analytics/frontend/insights/shared/chartStyleAdapter'
import {
goalLinesToReferenceLines,
schemaGoalLinesToConfigs,
diff --git a/frontend/src/scenes/billing/BillingChart.tsx b/frontend/src/scenes/billing/BillingChart.tsx
index e3be6512fd1c..6750a5b05a20 100644
--- a/frontend/src/scenes/billing/BillingChart.tsx
+++ b/frontend/src/scenes/billing/BillingChart.tsx
@@ -8,11 +8,10 @@ import type {
TimeSeriesLineChartConfig,
} from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartConfig, useChartTheme } from 'lib/charts/hooks'
import { getColorVar, getSeriesColor } from 'lib/colors'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { BillingPeriodMarkers } from './BillingPeriodMarkers'
import type { BillingPeriodMarker } from './BillingPeriodMarkers'
import { FOLDED_SERIES_LABEL, MAX_CHARTED_BILLING_SERIES } from './constants'
diff --git a/products/ai_observability/frontend/clusters/ClusterDetailScatterPlot.tsx b/products/ai_observability/frontend/clusters/ClusterDetailScatterPlot.tsx
index 2e5ffcf7702b..894832991029 100644
--- a/products/ai_observability/frontend/clusters/ClusterDetailScatterPlot.tsx
+++ b/products/ai_observability/frontend/clusters/ClusterDetailScatterPlot.tsx
@@ -4,10 +4,9 @@ import { useEffect, useMemo, useState } from 'react'
import { ScatterChart } from '@posthog/quill-charts'
import type { ScatterAreaSelection, ScatterChartConfig, ScatterPointDatum } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartTheme } from 'lib/charts/hooks'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { clusterDetailLogic } from './clusterDetailLogic'
import { navigateToClusterItem } from './clusterScatter'
import type { ClusterScatterMeta } from './clusterScatter'
diff --git a/products/ai_observability/frontend/clusters/ClusterScatterPlot.tsx b/products/ai_observability/frontend/clusters/ClusterScatterPlot.tsx
index 4fcd6264d136..754ba379b55e 100644
--- a/products/ai_observability/frontend/clusters/ClusterScatterPlot.tsx
+++ b/products/ai_observability/frontend/clusters/ClusterScatterPlot.tsx
@@ -5,11 +5,10 @@ import { useEffect, useMemo, useState } from 'react'
import { ScatterChart } from '@posthog/quill-charts'
import type { ScatterAreaSelection, ScatterChartConfig, ScatterPointDatum } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartTheme } from 'lib/charts/hooks'
import { urls } from 'scenes/urls'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { navigateToClusterItem } from './clusterScatter'
import type { ClusterScatterMeta } from './clusterScatter'
import { ClusterOverviewTooltip } from './ClusterScatterTooltip'
diff --git a/products/alerts/frontend/components/AlertEvaluationHistoryChart.tsx b/products/alerts/frontend/components/AlertEvaluationHistoryChart.tsx
index 2aeb2f47e140..a18da5c2b192 100644
--- a/products/alerts/frontend/components/AlertEvaluationHistoryChart.tsx
+++ b/products/alerts/frontend/components/AlertEvaluationHistoryChart.tsx
@@ -11,11 +11,10 @@ import {
useChartTheme,
} from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { humanFriendlyNumber } from 'lib/utils/numbers'
import { pluralize } from 'lib/utils/strings'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
const handleChartError = makeChartErrorHandler('alerts-evaluation-history-chart')
const ROLLING_WINDOW = 5
diff --git a/products/alerts/frontend/components/AlertPreviewCard.tsx b/products/alerts/frontend/components/AlertPreviewCard.tsx
index f385eba71e6b..ec8ee4e8f96b 100644
--- a/products/alerts/frontend/components/AlertPreviewCard.tsx
+++ b/products/alerts/frontend/components/AlertPreviewCard.tsx
@@ -2,6 +2,7 @@ import { IconInfo } from '@posthog/icons'
import { LemonSkeleton, LemonTag, Tooltip } from '@posthog/lemon-ui'
import { LineChart, ReferenceLines, useChartTheme } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { humanFriendlyNumber } from 'lib/utils/numbers'
import { AlertConditionType, InsightThresholdType } from '~/queries/schema/schema-general'
@@ -15,7 +16,6 @@ import {
TrendsAlertPreviewSeries,
} from 'products/alerts/frontend/logic/trendsAlertPreview'
import { isFunnelsAlertConfig, isHogQLAlertConfig, isTrendsAlertConfig } from 'products/alerts/frontend/types'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
import { FunnelAlertPreviewBanner } from './AlertDefinitionFields'
import { AlertThresholdLine, shouldUseLogScale, thresholdReferenceLines } from './AlertPreviewCard.utils'
diff --git a/products/alerts/frontend/views/SimulationSummary.tsx b/products/alerts/frontend/views/SimulationSummary.tsx
index 3bab907b7ac8..b4d113049782 100644
--- a/products/alerts/frontend/views/SimulationSummary.tsx
+++ b/products/alerts/frontend/views/SimulationSummary.tsx
@@ -10,14 +10,13 @@ import {
useChartTheme,
} from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { dayjs } from 'lib/dayjs'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { humanFriendlyNumber } from 'lib/utils/numbers'
import { DetectorConfig, DetectorType } from '~/queries/schema/schema-general'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { AlertSimulationResult, BreakdownSimulationResult } from '../types'
const handleChartError = makeChartErrorHandler('alerts-simulation-chart')
diff --git a/products/endpoints/frontend/nodes/EndpointsUsageTrendsNode.tsx b/products/endpoints/frontend/nodes/EndpointsUsageTrendsNode.tsx
index ca82c61cfb38..c6c64ab786f0 100644
--- a/products/endpoints/frontend/nodes/EndpointsUsageTrendsNode.tsx
+++ b/products/endpoints/frontend/nodes/EndpointsUsageTrendsNode.tsx
@@ -4,6 +4,7 @@ import { useMemo, useState } from 'react'
import { LemonSkeleton } from '@posthog/lemon-ui'
import { TimeSeriesLineChart, type TimeSeriesLineChartConfig } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartConfig, useChartTheme } from 'lib/charts/hooks'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { teamLogic } from 'scenes/teamLogic'
@@ -17,8 +18,6 @@ import {
import { QueryContext } from '~/queries/types'
import { IntervalType } from '~/types'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import {
type EndpointsUsageMetric,
type TrendsDataPoint,
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx
index 8cc40d5963e5..6e66ef1a225f 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx
@@ -10,6 +10,7 @@ import type {
TooltipContext,
} from '@posthog/quill-charts'
+import { chartStyleCurve } from 'lib/charts/chartStyleAdapter'
import { useChartConfig, useChartTheme, useDateRangeZoom } from 'lib/charts/hooks'
import { AnnotationsLayer } from 'lib/components/AnnotationsOverlay/AnnotationsLayer'
import { useChartLegendSeriesMenu } from 'lib/components/ChartLegendSeriesMenu/useChartLegendSeriesMenu'
@@ -25,7 +26,6 @@ import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'
import { isFunnelsQuery } from '~/queries/utils'
import { ChartParams, type FlattenedFunnelStepByBreakdown } from '~/types'
-import { chartStyleCurve } from '../../shared/chartStyleAdapter'
import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'
import { INSIGHT_TOOLTIP_CONFIG } from '../../shared/tooltipConfig'
import { buildBaseLegendConfig } from '../../trends/shared/buildBaseLegendConfig'
diff --git a/products/product_analytics/frontend/insights/paths/PathsChart.tsx b/products/product_analytics/frontend/insights/paths/PathsChart.tsx
index 310c14e18e69..0f53fcfb3bff 100644
--- a/products/product_analytics/frontend/insights/paths/PathsChart.tsx
+++ b/products/product_analytics/frontend/insights/paths/PathsChart.tsx
@@ -6,6 +6,7 @@ import { useCallback, useMemo, useRef } from 'react'
import { SankeyChart } from '@posthog/quill-charts'
import type { SankeyChartConfig, SankeyHighlight, SankeyTooltipHit } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartTheme } from 'lib/charts/hooks'
import { useResizeObserver } from 'lib/hooks/useResizeObserver'
import { InsightEmptyState, InsightErrorState } from 'scenes/insights/EmptyStates'
@@ -15,8 +16,6 @@ import { insightLogic } from 'scenes/insights/insightLogic'
import { PathsLink } from '~/queries/schema/schema-general'
import { shouldQueryBeAsync } from '~/queries/utils'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import { FALLBACK_CANVAS_WIDTH } from './constants'
import { PathNodeCards } from './PathNodeCards'
import { buildPathsGraph, maxPathLayer, pathsChartWidth } from './pathsChartData'
diff --git a/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx b/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx
index f091bf4747c0..80e819c65c4f 100644
--- a/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx
+++ b/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx
@@ -5,6 +5,7 @@ import { useCallback, useMemo, type ErrorInfo } from 'react'
import { TimeSeriesLineChart } from '@posthog/quill-charts'
import type { PointClickData, TooltipContext } from '@posthog/quill-charts'
+import { chartStyleCurve } from 'lib/charts/chartStyleAdapter'
import { useChartConfig, useChartTheme } from 'lib/charts/hooks'
import { getColorVar } from 'lib/colors'
import { roundToDecimal } from 'lib/utils/numbers'
@@ -17,7 +18,6 @@ import type { GroupTypeIndex, LabelGroupType } from '~/types'
import type { SeriesDatum } from 'products/product_analytics/frontend/insights/shared/InsightTooltip/insightTooltipUtils'
-import { chartStyleCurve } from '../../shared/chartStyleAdapter'
import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'
import { INSIGHT_TOOLTIP_CONFIG } from '../../shared/tooltipConfig'
import { dimHexColor } from '../../trends/shared/compareDimming'
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx
index b051d4bca8a0..1a3a69fbf4f6 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx
@@ -4,6 +4,7 @@ import { useCallback, useMemo } from 'react'
import { TimeSeriesBarChart } from '@posthog/quill-charts'
import type { PointClickData, Series, TimeSeriesBarChartConfig, TooltipContext } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartConfig, useChartTheme } from 'lib/charts/hooks'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
import { insightLogic } from 'scenes/insights/insightLogic'
@@ -24,7 +25,6 @@ import type { IndexedTrendResult } from 'products/product_analytics/frontend/ins
import { hasTrendsChartData } from '../../shared/hasTrendsChartData'
import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'
import { getSeriesIdentification } from '../../shared/seriesIdentification'
-import { makeChartErrorHandler } from '../../trends/shared/chartErrorHandler'
import { getTrendsSeriesDisplayLabel } from '../../trends/shared/getTrendsSeriesDisplayLabel'
import {
buildTrendsSeriesMeta,
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx
index b3366b30de22..37eb08e5292f 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx
@@ -4,6 +4,8 @@ import { useCallback, useMemo } from 'react'
import { TimeSeriesLineChart } from '@posthog/quill-charts'
import type { PointClickData, Series, TimeSeriesLineChartConfig, TooltipContext } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
+import { chartStyleCurve } from 'lib/charts/chartStyleAdapter'
import { useChartConfig, useChartTheme } from 'lib/charts/hooks'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
import { insightLogic } from 'scenes/insights/insightLogic'
@@ -20,11 +22,9 @@ import type { SeriesDatum } from 'products/product_analytics/frontend/insights/s
import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'
import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'
-import { chartStyleCurve } from '../../shared/chartStyleAdapter'
import { hasTrendsChartData } from '../../shared/hasTrendsChartData'
import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'
import { getSeriesIdentification } from '../../shared/seriesIdentification'
-import { makeChartErrorHandler } from '../../trends/shared/chartErrorHandler'
import { getTrendsSeriesDisplayLabel } from '../../trends/shared/getTrendsSeriesDisplayLabel'
import {
buildTrendsSeriesMeta,
diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx
index adbd3109dbb8..00656d8a4fbd 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx
@@ -12,6 +12,7 @@ import {
} from '@posthog/quill-charts'
import type { BarChartConfig, PointClickData, TimeSeriesBarChartConfig, TooltipContext } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartTheme, useChartConfig, useDateRangeZoom } from 'lib/charts/hooks'
import { AnnotationsLayer } from 'lib/components/AnnotationsOverlay/AnnotationsLayer'
import { percentage } from 'lib/utils/numbers'
@@ -37,7 +38,6 @@ import { hasTrendsChartData } from '../../shared/hasTrendsChartData'
import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'
import { getSeriesIdentification } from '../../shared/seriesIdentification'
import { INSIGHT_TOOLTIP_CONFIG } from '../../shared/tooltipConfig'
-import { makeChartErrorHandler } from '../shared/chartErrorHandler'
import { getTrendsSeriesDisplayLabel } from '../shared/getTrendsSeriesDisplayLabel'
import { goalLinesToReferenceLines } from '../shared/goalLinesAdapter'
import {
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx
index 24b0b0c5ff3c..c40ec440e27e 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx
@@ -4,6 +4,7 @@ import { useCallback, useMemo } from 'react'
import { TimeSeriesBarChart } from '@posthog/quill-charts'
import type { ChartLegendConfig, PointClickData, TooltipContext } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartConfig, useChartTheme, useDateRangeZoom } from 'lib/charts/hooks'
import { getBarColorFromStatus } from 'lib/colors'
import { AnnotationsLayer } from 'lib/components/AnnotationsOverlay/AnnotationsLayer'
@@ -25,7 +26,6 @@ import type { IndexedTrendResult } from 'products/product_analytics/frontend/ins
import { hasTrendsChartData } from '../../shared/hasTrendsChartData'
import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'
import { buildBaseLegendConfig } from '../shared/buildBaseLegendConfig'
-import { makeChartErrorHandler } from '../shared/chartErrorHandler'
import {
canHandleTrendsChartClick,
handleTrendsChartClick,
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx
index 492be6739d96..2e03c65cedad 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx
@@ -5,6 +5,8 @@ import { useCallback, useMemo } from 'react'
import { DEFAULT_Y_AXIS_ID, TimeSeriesLineChart } from '@posthog/quill-charts'
import type { PointClickData, TooltipContext } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
+import { chartStyleCurve } from 'lib/charts/chartStyleAdapter'
import { useChartTheme, useChartConfig, useDateRangeZoom } from 'lib/charts/hooks'
import { AnnotationsLayer } from 'lib/components/AnnotationsOverlay/AnnotationsLayer'
import { dayjs } from 'lib/dayjs'
@@ -29,12 +31,10 @@ import type { SeriesDatum } from 'products/product_analytics/frontend/insights/s
import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'
import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'
-import { chartStyleCurve } from '../../shared/chartStyleAdapter'
import { hasTrendsChartData } from '../../shared/hasTrendsChartData'
import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'
import { getSeriesIdentification } from '../../shared/seriesIdentification'
import { INSIGHT_TOOLTIP_CONFIG } from '../../shared/tooltipConfig'
-import { makeChartErrorHandler } from '../shared/chartErrorHandler'
import { getTrendsSeriesDisplayLabel } from '../shared/getTrendsSeriesDisplayLabel'
import { canHandleTrendsChartClick, handleTrendsChartClick } from '../shared/handleTrendsChartClick'
import { withHighlightedSeries } from '../shared/highlightedSeries'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx
index ad872fddb471..1539b0df87e7 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx
@@ -6,6 +6,7 @@ import { useMemo, type ErrorInfo } from 'react'
import { PieChart } from '@posthog/quill-charts'
import type { PieChartConfig } from '@posthog/quill-charts'
+import { DonutCenterLabel } from 'lib/charts/DonutCenterLabel'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
import { insightLogic } from 'scenes/insights/insightLogic'
@@ -15,7 +16,6 @@ import { trendsDataLogic } from 'products/product_analytics/frontend/insights/tr
import type { TrendsSeriesMeta } from '../shared/trendsSeriesMeta'
import { type TrendsPartOfWholeChartProps, useTrendsPartOfWholeChart } from '../shared/useTrendsPartOfWholeChart'
-import { DonutCenterLabel } from './DonutCenterLabel'
const DONUT_INNER_RADIUS_RATIO = 0.6
diff --git a/products/product_analytics/frontend/insights/trends/TrendsProportionBar/TrendsProportionBar.tsx b/products/product_analytics/frontend/insights/trends/TrendsProportionBar/TrendsProportionBar.tsx
index 66d457d002ae..81fce775fefd 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsProportionBar/TrendsProportionBar.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsProportionBar/TrendsProportionBar.tsx
@@ -1,10 +1,10 @@
import { ProportionBar } from '@posthog/quill-charts'
import type { ProportionBarConfig } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartConfig } from 'lib/charts/hooks'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
-import { makeChartErrorHandler } from '../shared/chartErrorHandler'
import type { TrendsSeriesMeta } from '../shared/trendsSeriesMeta'
import { type TrendsPartOfWholeChartProps, useTrendsPartOfWholeChart } from '../shared/useTrendsPartOfWholeChart'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsSlopeChart/TrendsSlopeChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsSlopeChart/TrendsSlopeChart.tsx
index 5acca889aa0f..4186b8176bde 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsSlopeChart/TrendsSlopeChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsSlopeChart/TrendsSlopeChart.tsx
@@ -4,6 +4,7 @@ import { useMemo } from 'react'
import { SlopeChart, createXAxisTickCallback } from '@posthog/quill-charts'
import type { Series, SlopeChartConfig, SlopeSeriesMeta } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartTheme } from 'lib/charts/hooks'
import { formatAggregationAxisValue } from 'scenes/insights/aggregationAxisFormat'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
@@ -17,8 +18,6 @@ import { QueryContext } from '~/queries/types'
import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'
import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'
-import { makeChartErrorHandler } from '../shared/chartErrorHandler'
-
interface TrendsSlopeChartProps {
context?: QueryContext<InsightVizNode>
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/SpendTrajectoryChart.tsx b/products/replay_vision/frontend/replay_scanners/components/SpendTrajectoryChart.tsx
index 4f91af3ce098..46caf26ebc68 100644
--- a/products/replay_vision/frontend/replay_scanners/components/SpendTrajectoryChart.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/SpendTrajectoryChart.tsx
@@ -2,12 +2,11 @@ import { memo, useMemo } from 'react'
import { TimeSeriesLineChart } from '@posthog/quill-charts'
+import { makeChartErrorHandler } from 'lib/charts/chartErrorHandler'
import { useChartConfig, useChartTheme } from 'lib/charts/hooks'
import { getColorVar } from 'lib/colors'
import { dayjs } from 'lib/dayjs'
-import { makeChartErrorHandler } from 'products/product_analytics/frontend/insights/trends/shared/chartErrorHandler'
-
import type { VisionQuotaApi } from '../../generated/api.schemas'
import { formatCreditCount, formatCreditNumber } from '../../utils/credits'
import type { SpendSeries } from '../visionUsageLogic'