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(quill): move hog-charts into quill workspace as @posthog/quill-charts (#59724)

Sam Penningtondf69c88f2dfa
diff --git a/common/storybook/.storybook/main.ts b/common/storybook/.storybook/main.ts
index d7abba743ac6..8c7cb7c0e372 100644
--- a/common/storybook/.storybook/main.ts
+++ b/common/storybook/.storybook/main.ts
@@ -15,6 +15,8 @@ const config: StorybookConfig = {
'../../../products/**/frontend/**/*.stories.@(js|jsx|ts|tsx)',
'../../../products/**/mcp/**/*.mdx',
'../../../products/**/mcp/**/*.stories.@(js|jsx|ts|tsx)',
+ '../../../packages/quill/packages/charts/src/**/*.mdx',
+ '../../../packages/quill/packages/charts/src/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
diff --git a/common/storybook/webpack.config.js b/common/storybook/webpack.config.js
index 5b099c1f255e..82ba6be669c8 100644
--- a/common/storybook/webpack.config.js
+++ b/common/storybook/webpack.config.js
@@ -78,6 +78,16 @@ function createEntry(entry) {
'@posthog/mcp-ui': path.resolve(__dirname, '..', '..', 'services', 'mcp', 'src', 'ui-apps', 'lib'),
'@posthog/shared-onboarding': path.resolve(__dirname, '..', '..', 'docs', 'onboarding'),
'@posthog/quill': path.resolve(__dirname, '..', '..', 'packages', 'quill', 'packages', 'quill', 'src'),
+ '@posthog/quill-charts': path.resolve(
+ __dirname,
+ '..',
+ '..',
+ 'packages',
+ 'quill',
+ 'packages',
+ 'charts',
+ 'src'
+ ),
types: path.resolve(__dirname, '..', '..', 'frontend', 'types'),
public: path.resolve(__dirname, '..', '..', 'frontend', 'public'),
process: 'process/browser',
diff --git a/common/tailwind/tailwind.config.js b/common/tailwind/tailwind.config.js
index 01e717e523d3..d740cac8b589 100644
--- a/common/tailwind/tailwind.config.js
+++ b/common/tailwind/tailwind.config.js
@@ -341,6 +341,9 @@ const config = {
// utilities for layout/spacing in its compiled JS. Scan dist here so
// those utilities get compiled into this pre-built Tailwind bundle.
'../../packages/quill/packages/quill/dist/**/*.{js,cjs}',
+ // @posthog/quill-charts is consumed from source; its overlays, legends and
+ // blocks use Tailwind utilities, so scan its src or those classes get purged.
+ '../../packages/quill/packages/charts/src/**/*.{ts,tsx}',
'!../../frontend/src/**/*Type.ts',
],
darkMode: ['selector', '[theme="dark"]'],
diff --git a/frontend/jest.config.ts b/frontend/jest.config.ts
index 7daa4b150fa4..226a59bf10be 100644
--- a/frontend/jest.config.ts
+++ b/frontend/jest.config.ts
@@ -62,7 +62,7 @@ const esmModules = [
'yaml/browser',
]
function rootDirectories(): string[] {
- return ['<rootDir>/src', '<rootDir>/../products']
+ return ['<rootDir>/src', '<rootDir>/../products', '<rootDir>/../packages/quill/packages/charts/src']
}
const config: Config = {
@@ -171,6 +171,9 @@ const config: Config = {
'^common/(.*)$': '<rootDir>/../common/$1',
'^@posthog/replay-shared$': '<rootDir>/../common/replay-shared/src/index.ts',
'^@posthog/replay-shared/(.*)$': '<rootDir>/../common/replay-shared/src/$1',
+ '^@posthog/quill-charts$': '<rootDir>/../packages/quill/packages/charts/src/index.ts',
+ '^@posthog/quill-charts/testing$': '<rootDir>/../packages/quill/packages/charts/src/testing/index.ts',
+ '^@posthog/quill-charts/story-helpers$': '<rootDir>/../packages/quill/packages/charts/src/story-helpers.tsx',
'^@posthog/shared-onboarding/(.*)$': '<rootDir>/../docs/onboarding/$1',
d3: '<rootDir>/node_modules/d3/dist/d3.min.js',
'^d3-(.*)$': `d3-$1/dist/d3-$1`,
diff --git a/frontend/package.json b/frontend/package.json
index 11e522605846..4114711c29e3 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -122,6 +122,7 @@
"@posthog/products-wizard": "workspace:*",
"@posthog/products-workflows": "workspace:*",
"@posthog/quill": "workspace:*",
+ "@posthog/quill-charts": "workspace:*",
"@posthog/react": "catalog:",
"@posthog/replay-shared": "workspace:*",
"@posthog/tailwind": "workspace:*",
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 9c2961c59a30..2474bc98eea5 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -509,7 +509,7 @@ snapshots:
components-hogcharts-barchart--with-bar-track--light:
hash: v1.k794b7964.38ac4a98dead12b49e1727bdd93240f6ea0066adff611a97c6c5e3e307fc8e62.Fg389h17t2lWX9lR9CffIAX1jEZRri29prNfW7egOCE
components-hogcharts-barchart--with-reference-line--dark:
- hash: v1.k794b7964.1f241d2818a3ac969e14d29dd555240c5fb732a4fb0871f4d55f2d6a6a1955ab.XpPYc4tDjAAsNMMtoNsCiwJkA_luAGbIdYSjniuzEkM
+ hash: v1.k794b7964.7c0bb5dc5860a1b2ca2a9af27d64fb0de03d7a7b9a512ad5115fefe4ecdb4ee2.8gTA4c58CPuYL_h26i9ourKhw_pe215qRkKCPB3sN6o
components-hogcharts-barchart--with-reference-line--light:
hash: v1.k794b7964.081e6b6e0d8258756a42817806f81c4c2c934e5086728e4e57731d618cb0f5bb.LLR8JlGiNzCaW5F55LVIYQ9V5biMi1zPB6HpZ_tpmMk
components-hogcharts-barchart--with-value-labels--dark:
@@ -569,7 +569,7 @@ snapshots:
components-hogcharts-legend--vertical--light:
hash: v1.k794b7964.613d93ab14bd635185a8f3f5eabfaa884a3a8f7b418cdbdec94478b2bc3da2d2.poxwlxr4MP5HbhAC8JKzXCBFxGSJwc8uUXs26xUUcHU
components-hogcharts-linechart--combined-overlays--dark:
- hash: v1.k794b7964.85034054b82c3649e42b84507f89c82af7df4341f89438376650298c79c8c484.ggHaFhXUXXHe0MKHvW6MT4xkpDndBHdkkn3Uy20U33o
+ hash: v1.k794b7964.19f341286f9610740679ef2c213f00b7cb8a5880560a4323a0ed204900a2d003.9cmwI_NSgRjcxdYEEmYXi7zektUahx7yg4QwK6cIc08
components-hogcharts-linechart--combined-overlays--light:
hash: v1.k794b7964.cf6c7c5dd1d82006ae2a61a85d1af550a61d67dc85983694666f7ae3489e44f5._2K1C-9C_CUAmaCrLAnq8ZKK_QUumt5EJvD6yK4_18w
components-hogcharts-linechart--dual-y-axis--dark:
@@ -681,23 +681,23 @@ snapshots:
components-hogcharts-piechart--with-breakdown-labels--light:
hash: v1.k794b7964.811f8e01cbeeb97d8319a76668d33864b6be08a2b8f270e5980fe951fafbc1bb.UoRHUDWOOnMGSCQcBN8D5TwfE6LL3IG58n0wUC_WOwo
components-hogcharts-referenceline--fill-sides--dark:
- hash: v1.k794b7964.c6b9d78f0423edc9a0baccf3dd9e05139aecb9387e8e3e5c32bcaec28663f279.zDKfyNa2u4-LWW40uD0XPkXVGUCnAZkfvJZI2TS0adA
+ hash: v1.k794b7964.20d0fdc405a9dd537216032ada6fcef0a23581f114ba00501d4d7e39e773310b.jFz7FFT43BMvL4egnlYnYiV1a3SOjimiYoTRg-Iygs4
components-hogcharts-referenceline--fill-sides--light:
hash: v1.k794b7964.670eaf8cf4ceecad58d9847836dcb80d7ad5c78197cb3c554453b0517b7248f1.4IWpGOyWBBAKyp0d5DaPblW4H_2kEGsKNtK4pyG9VtA
components-hogcharts-referenceline--horizontal-goal--dark:
- hash: v1.k794b7964.bd601ac8479ca60a3b1a5ddeca7415c9851940a088c2671df6e46afe4e5a5bf6.CzvyS5WWn5MmnUJByi9QpLWqgJQ5_TMY-SQt5PzFsBo
+ hash: v1.k794b7964.7a6c81425221aa7eb3b507c8f3e84f395cce0c9bc4a8c448f68e766c85929af1.QmARVqtLdYfbxHafs3gDn1duS9jIYVXSQzk8wYiyYns
components-hogcharts-referenceline--horizontal-goal--light:
hash: v1.k794b7964.e754e0914599e53edaa70b29b850bc96a87789d053c053759bac338afb082da8.foHtu1d4fJvvLBKASef_twIXnVo_-Lz5gb9EUjkcIUk
components-hogcharts-referenceline--horizontal-variants--dark:
- hash: v1.k794b7964.322b8a5a6690ff06abcd9fb7bdc2cda6d17339ebf52ae983991feb35e205b281.w0WsvX_fxKNz69xL6b4dmXzHE1HizDtbQaUHivYmVIQ
+ hash: v1.k794b7964.d2ade6790168c5c2230e869ef03ac01a9214d31f60d127fb033267589a22eb62._FSjAeZI9fdn6DN9Ixoa0-IWPQS7l_W9tpPXrhJwSvk
components-hogcharts-referenceline--horizontal-variants--light:
hash: v1.k794b7964.26a99a0a645f53188423b4f8baebc3fbc9859a0750c906dec8444224bf9659ba.ijrrhJAbnHW0d-1LrbE_V2LWPRH3joRZO3v6SCYk1UI
components-hogcharts-referenceline--label-start-vs-end--dark:
- hash: v1.k794b7964.fabcef88294104f29274ec587131942c155bf5ad07f7ccc44d5be4e043644c7c.8DxGcCR5SDI7WRkye1lRYYdqnoJyvsx29MIacSUYuUA
+ hash: v1.k794b7964.68cc28f12e7bcbbbddbbd094fb0b0f79d4c8e7ba72e68e8d928f982bd4ea59af.juDGhr-ceUIWwKIPTDE2OVR1BjSRqeFQuONFS6_PsXE
components-hogcharts-referenceline--label-start-vs-end--light:
hash: v1.k794b7964.01a5b66f446ee36aa45a34e9bcda11dc3a54b54f6f362516966893eedc2c3d28.-w1ofSvDPDJWRfZ61t22NmPqoUvryXhNB2M1ccWZkzk
components-hogcharts-referenceline--vertical-reference-lines--dark:
- hash: v1.k794b7964.0bbe67f3d4f76183952e66b1e693dfc4784ed0caf8649a8f57bb4a15cf5e80e6.RH3hRdwnNpHGXdce_YxCruBjdIsvuQKdX4GNH5gxckg
+ hash: v1.k794b7964.8975390ced81cc68a4e7e9b3f4a2418800dfe24c49c433a44040b6aeb6075671.8KjbPVakq7-Iyr-owU8ik9QOU1q-J50jTv48sJ2UZAQ
components-hogcharts-referenceline--vertical-reference-lines--light:
hash: v1.k794b7964.5dcb0a0659868117ed589cf16c5b9e5d5e09a43d6971dcc9d5b1ad5e890ab5c3.BxyNtR_8BsK51YOYJQ_K4M3iAGGQxztcJtNGS1JbS9Q
components-hogcharts-sparkline--custom-color--dark:
@@ -737,7 +737,7 @@ snapshots:
components-hogcharts-timeseriesbarchart--percent--light:
hash: v1.k794b7964.97eeda327c290f6a218c0c5a612b6180cdcf59738c4fcc6a2dd60343050b216d.5KrJNULtEF9jDv7lrNBQDHGXvT8Ic60zJ4ASkoFn3_g
components-hogcharts-timeseriesbarchart--with-goal-line--dark:
- hash: v1.k794b7964.7f3d17f5524960cd19f8397e98141cc368169d1c8cb33b100c49e610492226ad.mXs86Sw8Ay8lDkSwWpehLEZH2_AGc0Z-oFggDLCz6FI
+ hash: v1.k794b7964.7ee3282bf6f0a5c799e72c0653c7cc901690ac9237045e787d6c6d78e30ecb0f.GTH61b15PCrCOSWX7MhD_i3rwvY22bTo1kKzYEvRhPo
components-hogcharts-timeseriesbarchart--with-goal-line--light:
hash: v1.k794b7964.f858d12e2596161320b92a2030844a8c37c759beaf09d9dda1df5f2f9a1f287d.qQlKj0EqAs77chw4L8OTfGoDOvrajs1a1IDG9LPcmJU
components-hogcharts-timeseriesbarchart--with-value-labels--dark:
@@ -745,7 +745,7 @@ snapshots:
components-hogcharts-timeseriesbarchart--with-value-labels--light:
hash: v1.k794b7964.fad53a12e74f46bf1a8d26028935217ff279055cbb358d55f92f13c16129887e.fxKF3fI4mBYxukfGZiZlFh9syRkrNeguh2BuUdLh77Y
components-hogcharts-timeseriesbarchart--y-axis-formats--dark:
- hash: v1.k794b7964.8019eb7165d9abb73ad3b595d33f099759f0940a649bdd54cfe1335b1148b851.lS2FWNLUehmWeagXowg7IvZcCjwOikNGVR8CJDlefkM
+ hash: v1.k794b7964.1850f40ccaee8a715e9cdacc6f4f65323cf3031cae3bd665c28aeb77664d3f76.yoQUKQsF4c2Ltq4eqz9qufr1HZdI83jMTGdOjoBXSY0
components-hogcharts-timeseriesbarchart--y-axis-formats--light:
hash: v1.k794b7964.558538f869802c296bed33a7415816188b83cbffdcd3d8bdd56d94476c2c805a.UkrVCNekCAmcO703kMoQHXcKpGb5cJ5hkiPS8Fk1Qyc
components-hogcharts-timeserieslinechart--basic--dark:
@@ -761,7 +761,7 @@ snapshots:
components-hogcharts-timeserieslinechart--confidence-intervals--light:
hash: v1.k794b7964.b0042421c10a2581541d6030ac04947e65617e634f2fcf789c8211730eb9958a.CVwv8zsHTz8WMoKSwLbGU8C3iIzF6pwvxY5zUBEkoHE
components-hogcharts-timeserieslinechart--date-axis--dark:
- hash: v1.k794b7964.00e79f8da331546fcc019306e605bde70c38549d92bf3f26f90621e404f8e0a3.VR52bmR2FRi8K9S5j41ve8pMeWs6BgHB7XVMPi3RSlg
+ hash: v1.k794b7964.3f0bc37112474eaacbfebd3c76992fa7375fa4ea806e955ff8394087defc1f5d.jzMZyAfSX4qlwfmApTiU6TC6WAR4IsgGlXU_4ZxdB2M
components-hogcharts-timeserieslinechart--date-axis--light:
hash: v1.k794b7964.f3cf62927078c9ab23bbb052cce0599a175046bd2fa9a5da99e44da2ec5cfa45.m_Yw8UpdVpP6p5rrrbRFs8oukmSlEe_ZpbMjD2B_UyY
components-hogcharts-timeserieslinechart--moving-average--dark:
@@ -773,7 +773,7 @@ snapshots:
components-hogcharts-timeserieslinechart--trend-lines--light:
hash: v1.k794b7964.a43f290278850a9a9fab6886caf5ba3a1f25aa77e2ee781225b96b750bbc21e5.RzVq0fsJjMOqzCs_R4ZuiEVoO64OIMoWroUA4SnDOTA
components-hogcharts-timeserieslinechart--y-axis-formats--dark:
- hash: v1.k794b7964.9a96c054c748635c37966b316aa63d3746f8f38f6c8742ce20c2c1acb7561ee2.dRKiVITgt3sdf5YvDpzAmZpsubMhFXSoWtAuhpdQwpM
+ hash: v1.k794b7964.680261bed43b84eb20acf56730b7ed1d5a590e4a789bbba162ca9027f289f97b.tAVry025DOFHZ7Yvfcm2PLsNzHtr-g8gn-eyEuBiO3k
components-hogcharts-timeserieslinechart--y-axis-formats--light:
hash: v1.k794b7964.2bef66aacecd65e45499ee99bf537162c17cb404a4c8d4871b7435fd463e8727.zc_zuF07aw8GGaVPuSnLNC-oWq1W6s78IjNb62kwLjo
components-hogcharts-valuelabels--cross-series-overlap-removal--dark:
diff --git a/frontend/src/lib/hog-charts/blocks/Metric/Metric.stories.tsx b/frontend/src/lib/hog-charts/blocks/Metric/Metric.stories.tsx
index 7236b52d3d95..ef85243ad959 100644
--- a/frontend/src/lib/hog-charts/blocks/Metric/Metric.stories.tsx
+++ b/frontend/src/lib/hog-charts/blocks/Metric/Metric.stories.tsx
@@ -1,6 +1,7 @@
import { Meta, StoryObj } from '@storybook/react'
-import { Stage, useReactiveTheme } from '../../story-helpers'
+import { Stage, useReactiveTheme } from '@posthog/quill-charts/story-helpers'
+
import { Metric } from './Metric'
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
diff --git a/frontend/src/lib/hog-charts/blocks/Metric/Metric.test.tsx b/frontend/src/lib/hog-charts/blocks/Metric/Metric.test.tsx
index 970f122309aa..582c1ddf928d 100644
--- a/frontend/src/lib/hog-charts/blocks/Metric/Metric.test.tsx
+++ b/frontend/src/lib/hog-charts/blocks/Metric/Metric.test.tsx
@@ -1,7 +1,8 @@
import { render } from '@testing-library/react'
-import type { ChartTheme } from '../../core/types'
-import { renderHogChart, setupJsdom, setupSyncRaf } from '../../testing'
+import type { ChartTheme } from '@posthog/quill-charts'
+import { renderHogChart, setupJsdom, setupSyncRaf } from '@posthog/quill-charts/testing'
+
import { Metric, type MetricChange } from './Metric'
const THEME: ChartTheme = { colors: ['#22d3ee'], backgroundColor: '#ffffff' }
diff --git a/frontend/src/lib/hog-charts/blocks/Metric/Metric.tsx b/frontend/src/lib/hog-charts/blocks/Metric/Metric.tsx
index 2313fab4d5f3..8e5eef4f4b67 100644
--- a/frontend/src/lib/hog-charts/blocks/Metric/Metric.tsx
+++ b/frontend/src/lib/hog-charts/blocks/Metric/Metric.tsx
@@ -1,9 +1,7 @@
import React, { useMemo, useState } from 'react'
-import { Sparkline } from '../../charts/Sparkline/Sparkline'
-import { ChartErrorBoundary } from '../../core/ChartErrorBoundary'
-import type { ChartTheme } from '../../core/types'
-import { percentage } from '../../utils/format'
+import { ChartErrorBoundary, type ChartTheme, percentage, Sparkline } from '@posthog/quill-charts'
+
import { type MetricChange, resolveDelta } from './resolveDelta'
import { useAnimatedNumber } from './useAnimatedNumber'
diff --git a/frontend/src/lib/hog-charts/blocks/Metric/useAnimatedNumber.ts b/frontend/src/lib/hog-charts/blocks/Metric/useAnimatedNumber.ts
index ad5a4c7f6222..b85883c37b21 100644
--- a/frontend/src/lib/hog-charts/blocks/Metric/useAnimatedNumber.ts
+++ b/frontend/src/lib/hog-charts/blocks/Metric/useAnimatedNumber.ts
@@ -1,11 +1,11 @@
-import { useEffect, useState } from 'react'
-
-import { useLatest } from '../../core/hooks/useLatest'
+import { useEffect, useRef, useState } from 'react'
/** When `target` changes mid-animation, animation restarts from the currently-displayed value (no snap). */
export function useAnimatedNumber(target: number, duration = 350): number {
const [value, setValue] = useState(target)
- const valueRef = useLatest(value)
+ // Written during render so the animation reads the latest value from the same render pass.
+ const valueRef = useRef(value)
+ valueRef.current = value
useEffect(() => {
if (duration <= 0 || !Number.isFinite(target)) {
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/LineGraph.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/LineGraph.tsx
index 2bcd0a8d0714..b561c74f9314 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/LineGraph.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/LineGraph.tsx
@@ -13,6 +13,7 @@ import { useEffect, useMemo } from 'react'
import { IconX } from '@posthog/icons'
import { LemonTable, lemonToast } from '@posthog/lemon-ui'
+import { createXAxisTickCallback } from '@posthog/quill-charts'
import {
ActiveElement,
@@ -31,7 +32,6 @@ import {
import { resolveVariableColor } from 'lib/charts/utils/color'
import { getGraphColors, getSeriesColor } from 'lib/colors'
import { InsightLabel } from 'lib/components/InsightLabel'
-import { createXAxisTickCallback } from 'lib/hog-charts'
import { useChart } from 'lib/hooks/useChart'
import { useKeyHeld } from 'lib/hooks/useKeyHeld'
import { hexToRGBA, uuid } from 'lib/utils'
diff --git a/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx b/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx
index 28fe6e5a56d5..f3d9013e9b35 100644
--- a/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx
+++ b/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx
@@ -5,6 +5,7 @@ import { useDebouncedCallback } from 'use-debounce'
import { IconEllipsis, IconInfo } from '@posthog/icons'
import { LemonButton, LemonCheckbox, LemonInput, LemonSwitch, Tooltip } from '@posthog/lemon-ui'
+import { normalizeAxisLabel } from '@posthog/quill-charts'
import { ChartFilter } from 'lib/components/ChartFilter'
import { CompareFilter } from 'lib/components/CompareFilter/CompareFilter'
@@ -13,7 +14,6 @@ import { SmoothingFilter } from 'lib/components/SmoothingFilter/SmoothingFilter'
import { smoothingOptions } from 'lib/components/SmoothingFilter/smoothings'
import { UnitPicker } from 'lib/components/UnitPicker/UnitPicker'
import { FEATURE_FLAGS, NON_TIME_SERIES_DISPLAY_TYPES } from 'lib/constants'
-import { normalizeAxisLabel } from 'lib/hog-charts/utils/axis-labels'
import { LemonMenu, LemonMenuItems } from 'lib/lemon-ui/LemonMenu'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { DEFAULT_DECIMAL_PLACES } from 'lib/utils'
diff --git a/frontend/src/scenes/insights/EditorFilters/AxisLabelsFilter.tsx b/frontend/src/scenes/insights/EditorFilters/AxisLabelsFilter.tsx
index c3dadc8e7950..29cc97d9b172 100644
--- a/frontend/src/scenes/insights/EditorFilters/AxisLabelsFilter.tsx
+++ b/frontend/src/scenes/insights/EditorFilters/AxisLabelsFilter.tsx
@@ -2,8 +2,8 @@ import { useActions, useValues } from 'kea'
import { useEffect, useState } from 'react'
import { LemonInput, LemonLabel } from '@posthog/lemon-ui'
+import { normalizeAxisLabel } from '@posthog/quill-charts'
-import { normalizeAxisLabel } from 'lib/hog-charts/utils/axis-labels'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { insightLogic } from '../insightLogic'
diff --git a/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx b/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx
index febc9261fb1a..76a19ba2c4cb 100644
--- a/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx
+++ b/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx
@@ -9,6 +9,8 @@ import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { useEffect, useMemo, useRef } from 'react'
+import { createXAxisTickCallback } from '@posthog/quill-charts'
+
import {
ActiveElement,
Chart,
@@ -32,7 +34,6 @@ import { getBarColorFromStatus, getGraphColors } from 'lib/colors'
import { AnomalyPoint } from 'lib/components/Alerts/types'
import { AnnotationsOverlay } from 'lib/components/AnnotationsOverlay'
import { SeriesLetter } from 'lib/components/SeriesGlyph'
-import { createXAxisTickCallback } from 'lib/hog-charts'
import { useChart } from 'lib/hooks/useChart'
import { useKeyHeld } from 'lib/hooks/useKeyHeld'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
diff --git a/frontend/src/test/insight-testing/index.ts b/frontend/src/test/insight-testing/index.ts
index de53460645a1..2e04a48718ce 100644
--- a/frontend/src/test/insight-testing/index.ts
+++ b/frontend/src/test/insight-testing/index.ts
@@ -1,7 +1,7 @@
export { getChart } from './chart-accessor'
export type { Chart } from './chart-accessor'
-export { getHogChart } from 'lib/hog-charts/testing'
-export type { HogChart } from 'lib/hog-charts/testing'
+export { getHogChart } from '@posthog/quill-charts/testing'
+export type { HogChart } from '@posthog/quill-charts/testing'
export { createInsightTooltipAccessor } from './tooltip-helpers'
export type { InsightTooltipAccessor } from './tooltip-helpers'
export {
diff --git a/frontend/src/test/insight-testing/interactions.ts b/frontend/src/test/insight-testing/interactions.ts
index c0052bedc775..d8d72e448b69 100644
--- a/frontend/src/test/insight-testing/interactions.ts
+++ b/frontend/src/test/insight-testing/interactions.ts
@@ -1,7 +1,13 @@
import { fireEvent, screen, waitFor, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
-import { clickAtIndex, getHogChartTooltip, hoverUntilTooltip, waitForHogChartTooltip } from 'lib/hog-charts/testing'
+import {
+ clickAtIndex,
+ getHogChartTooltip,
+ hoverUntilTooltip,
+ waitForHogChartTooltip,
+} from '@posthog/quill-charts/testing'
+
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'
import { IndexedTrendResult } from 'scenes/trends/types'
diff --git a/frontend/src/test/insight-testing/tooltip-helpers.ts b/frontend/src/test/insight-testing/tooltip-helpers.ts
index 62e7590ac271..57784af2dce3 100644
--- a/frontend/src/test/insight-testing/tooltip-helpers.ts
+++ b/frontend/src/test/insight-testing/tooltip-helpers.ts
@@ -1,4 +1,4 @@
-import { createHogChartTooltip, type HogChartTooltip } from 'lib/hog-charts/testing'
+import { createHogChartTooltip, type HogChartTooltip } from '@posthog/quill-charts/testing'
/** Insight-flavored tooltip accessor. Extends the generic hog-charts tooltip
* with helpers for the InsightTooltip's table layout — a header `<th>` row
diff --git a/packages/quill/packages/charts/package.json b/packages/quill/packages/charts/package.json
new file mode 100644
index 000000000000..a0188e4f99ce
--- /dev/null
+++ b/packages/quill/packages/charts/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "@posthog/quill-charts",
+ "version": "0.0.0",
+ "private": true,
+ "description": "Internal workspace package (private, not published). Canvas-based charting library used for trends, dashboards, and any in-app chart that needs to render thousands of points smoothly. D3 (scale/shape/color/array sub-packages) powers the scales; the canvas does the drawing; React handles overlays.",
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/PostHog/posthog.git",
+ "directory": "packages/quill/packages/charts"
+ },
+ "type": "module",
+ "main": "./src/index.ts",
+ "module": "./src/index.ts",
+ "types": "./src/index.ts",
+ "exports": {
+ ".": "./src/index.ts",
+ "./testing": "./src/testing/index.ts",
+ "./story-helpers": "./src/story-helpers.tsx",
+ "./package.json": "./package.json"
+ },
+ "dependencies": {
+ "@floating-ui/react": "^0.27.19",
+ "d3-array": "^3.2.4",
+ "d3-color": "^3.1.0",
+ "d3-scale": "^4.0.2",
+ "d3-shape": "^3.2.0",
+ "dayjs": "1.11.11",
+ "simple-statistics": "^7.8.3"
+ },
+ "devDependencies": {
+ "@storybook/react": "catalog:",
+ "@testing-library/dom": ">=9.3.4",
+ "@testing-library/react": "^14.3.1",
+ "@types/d3-array": "^3.2.1",
+ "@types/d3-color": "^3.1.3",
+ "@types/d3-scale": "^4.0.8",
+ "@types/d3-shape": "^3.1.6",
+ "@types/jest": "catalog:",
+ "@types/react": "^18.3.27",
+ "@types/react-dom": "^18.3.7",
+ "jest": "^29.7.0"
+ },
+ "peerDependencies": {
+ "react": "^18.3.1 || ^19.0.0",
+ "react-dom": "^18.3.1 || ^19.0.0"
+ }
+}
diff --git a/frontend/src/lib/hog-charts/README.md b/packages/quill/packages/charts/src/README.md
similarity index 94%
rename from frontend/src/lib/hog-charts/README.md
rename to packages/quill/packages/charts/src/README.md
index a3f341c85ae1..ddb195f54301 100644
--- a/frontend/src/lib/hog-charts/README.md
+++ b/packages/quill/packages/charts/src/README.md
@@ -3,8 +3,8 @@
PostHog's canvas-based charting library, used for trends, dashboards, and any in-app chart that needs to render thousands of points smoothly. D3 powers the scales; the canvas does the drawing; React handles overlays.
```tsx
-import { LineChart } from 'lib/hog-charts'
-import type { ChartTheme, Series } from 'lib/hog-charts'
+import { LineChart } from '@posthog/quill-charts'
+import type { ChartTheme, Series } from '@posthog/quill-charts'
const SERIES: Series[] = [{ key: 'a', label: 'A', data: [10, 20, 30] }]
const LABELS = ['Mon', 'Tue', 'Wed']
@@ -65,7 +65,7 @@ tooltip, draws the area with a vertical gradient fill, and exposes
without subscribing to `useChartHover` directly.
```tsx
-import { Sparkline } from 'lib/hog-charts'
+import { Sparkline } from '@posthog/quill-charts'
;<Sparkline data={[4200, 5100, 4700, /* … */ 8800]} theme={THEME} />
```
diff --git a/frontend/src/lib/hog-charts/charts/BarChart/BarChart.stories.tsx b/packages/quill/packages/charts/src/charts/BarChart/BarChart.stories.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BarChart/BarChart.stories.tsx
rename to packages/quill/packages/charts/src/charts/BarChart/BarChart.stories.tsx
diff --git a/frontend/src/lib/hog-charts/charts/BarChart/BarChart.test.tsx b/packages/quill/packages/charts/src/charts/BarChart/BarChart.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BarChart/BarChart.test.tsx
rename to packages/quill/packages/charts/src/charts/BarChart/BarChart.test.tsx
diff --git a/frontend/src/lib/hog-charts/charts/BarChart/BarChart.tsx b/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx
similarity index 99%
rename from frontend/src/lib/hog-charts/charts/BarChart/BarChart.tsx
rename to packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx
index 100e3be878af..4ab41706cfeb 100644
--- a/frontend/src/lib/hog-charts/charts/BarChart/BarChart.tsx
+++ b/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx
@@ -1,4 +1,4 @@
-import * as d3 from 'd3'
+import { color as d3Color } from 'd3-color'
import React, { useCallback, useMemo, useRef } from 'react'
import { type BarChartPrivate, computeBarTrackRect, computeSeriesBars } from '../../core/bar-layout'
@@ -558,7 +558,7 @@ function BarChartInner<Meta = unknown>({
}
for (const { series: s, bar, isTrackHighlight } of items) {
if (isTrackHighlight) {
- const parsed = d3.color(barColorAt(s, bar.dataIndex))
+ const parsed = d3Color(barColorAt(s, bar.dataIndex))
// Always translucent — the bar color direct would paint an opaque full-height
// block if d3 can't parse the color.
let trackColor: string
@@ -576,7 +576,7 @@ function BarChartInner<Meta = unknown>({
)
} else {
const barColor = barColorAt(s, bar.dataIndex)
- const highlightColor = d3.color(barColor)?.darker(0.6).toString() ?? barColor
+ const highlightColor = d3Color(barColor)?.darker(0.6).toString() ?? barColor
drawBarHighlight(ctx, bar, highlightColor, highlightRadius)
}
}
diff --git a/frontend/src/lib/hog-charts/charts/BarChart/BarTooltip.tsx b/packages/quill/packages/charts/src/charts/BarChart/BarTooltip.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BarChart/BarTooltip.tsx
rename to packages/quill/packages/charts/src/charts/BarChart/BarTooltip.tsx
diff --git a/frontend/src/lib/hog-charts/charts/BarChart/utils/bars-under-cursor.test.ts b/packages/quill/packages/charts/src/charts/BarChart/utils/bars-under-cursor.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BarChart/utils/bars-under-cursor.test.ts
rename to packages/quill/packages/charts/src/charts/BarChart/utils/bars-under-cursor.test.ts
diff --git a/frontend/src/lib/hog-charts/charts/BarChart/utils/bars-under-cursor.ts b/packages/quill/packages/charts/src/charts/BarChart/utils/bars-under-cursor.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BarChart/utils/bars-under-cursor.ts
rename to packages/quill/packages/charts/src/charts/BarChart/utils/bars-under-cursor.ts
diff --git a/frontend/src/lib/hog-charts/charts/BoxPlot/BoxPlot.stories.tsx b/packages/quill/packages/charts/src/charts/BoxPlot/BoxPlot.stories.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BoxPlot/BoxPlot.stories.tsx
rename to packages/quill/packages/charts/src/charts/BoxPlot/BoxPlot.stories.tsx
diff --git a/frontend/src/lib/hog-charts/charts/BoxPlot/BoxPlot.test.tsx b/packages/quill/packages/charts/src/charts/BoxPlot/BoxPlot.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BoxPlot/BoxPlot.test.tsx
rename to packages/quill/packages/charts/src/charts/BoxPlot/BoxPlot.test.tsx
diff --git a/frontend/src/lib/hog-charts/charts/BoxPlot/BoxPlot.tsx b/packages/quill/packages/charts/src/charts/BoxPlot/BoxPlot.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BoxPlot/BoxPlot.tsx
rename to packages/quill/packages/charts/src/charts/BoxPlot/BoxPlot.tsx
diff --git a/frontend/src/lib/hog-charts/charts/BoxPlot/BoxPlotTooltip.tsx b/packages/quill/packages/charts/src/charts/BoxPlot/BoxPlotTooltip.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BoxPlot/BoxPlotTooltip.tsx
rename to packages/quill/packages/charts/src/charts/BoxPlot/BoxPlotTooltip.tsx
diff --git a/frontend/src/lib/hog-charts/charts/BoxPlot/computeBoxLayout.test.ts b/packages/quill/packages/charts/src/charts/BoxPlot/computeBoxLayout.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BoxPlot/computeBoxLayout.test.ts
rename to packages/quill/packages/charts/src/charts/BoxPlot/computeBoxLayout.test.ts
diff --git a/frontend/src/lib/hog-charts/charts/BoxPlot/computeBoxLayout.ts b/packages/quill/packages/charts/src/charts/BoxPlot/computeBoxLayout.ts
similarity index 91%
rename from frontend/src/lib/hog-charts/charts/BoxPlot/computeBoxLayout.ts
rename to packages/quill/packages/charts/src/charts/BoxPlot/computeBoxLayout.ts
index 784296783606..0b2608121a1e 100644
--- a/frontend/src/lib/hog-charts/charts/BoxPlot/computeBoxLayout.ts
+++ b/packages/quill/packages/charts/src/charts/BoxPlot/computeBoxLayout.ts
@@ -1,14 +1,15 @@
-import type { BoxPlotDatum as SchemaBoxPlotDatum } from '~/queries/schema/schema-general'
-
import type { BoxRect } from '../../core/canvas-renderer'
import type { BarScaleSet } from '../../core/scales'
export type { BoxRect }
-/** Six-number summary plus an opaque `day` identifier. Structurally compatible with the
- * canonical `BoxPlotDatum` in `queries/schema-general.ts` (we only care about the six
- * numbers; `day` is the consumer-side key for click handlers / persons-modal labels). */
-export type BoxPlotDatum = Pick<SchemaBoxPlotDatum, 'min' | 'p25' | 'median' | 'mean' | 'p75' | 'max'> & {
+/** The six-number summary the chart renders. Kept structurally compatible with the canonical
+ * `BoxPlotDatum` in the frontend's `queries/schema-general.ts` so consumers can pass it directly. */
+type BoxPlotSummary = { min: number; p25: number; median: number; mean: number; p75: number; max: number }
+
+/** Six-number summary plus an opaque `day` identifier (`day` is the consumer-side key for click
+ * handlers / persons-modal labels). */
+export type BoxPlotDatum = BoxPlotSummary & {
/** Optional identifier for this x position (e.g. ISO date). The chart treats it as opaque. */
day?: string
}
diff --git a/frontend/src/lib/hog-charts/charts/BoxPlot/utils/boxes-under-cursor.test.ts b/packages/quill/packages/charts/src/charts/BoxPlot/utils/boxes-under-cursor.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BoxPlot/utils/boxes-under-cursor.test.ts
rename to packages/quill/packages/charts/src/charts/BoxPlot/utils/boxes-under-cursor.test.ts
diff --git a/frontend/src/lib/hog-charts/charts/BoxPlot/utils/boxes-under-cursor.ts b/packages/quill/packages/charts/src/charts/BoxPlot/utils/boxes-under-cursor.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/BoxPlot/utils/boxes-under-cursor.ts
rename to packages/quill/packages/charts/src/charts/BoxPlot/utils/boxes-under-cursor.ts
diff --git a/frontend/src/lib/hog-charts/charts/LineChart/LineChart.stories.tsx b/packages/quill/packages/charts/src/charts/LineChart/LineChart.stories.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/LineChart/LineChart.stories.tsx
rename to packages/quill/packages/charts/src/charts/LineChart/LineChart.stories.tsx
diff --git a/frontend/src/lib/hog-charts/charts/LineChart/LineChart.test.tsx b/packages/quill/packages/charts/src/charts/LineChart/LineChart.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/LineChart/LineChart.test.tsx
rename to packages/quill/packages/charts/src/charts/LineChart/LineChart.test.tsx
diff --git a/frontend/src/lib/hog-charts/charts/LineChart/LineChart.tsx b/packages/quill/packages/charts/src/charts/LineChart/LineChart.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/LineChart/LineChart.tsx
rename to packages/quill/packages/charts/src/charts/LineChart/LineChart.tsx
diff --git a/frontend/src/lib/hog-charts/charts/PieChart/PieChart.stories.tsx b/packages/quill/packages/charts/src/charts/PieChart/PieChart.stories.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/PieChart/PieChart.stories.tsx
rename to packages/quill/packages/charts/src/charts/PieChart/PieChart.stories.tsx
diff --git a/frontend/src/lib/hog-charts/charts/PieChart/PieChart.tsx b/packages/quill/packages/charts/src/charts/PieChart/PieChart.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/PieChart/PieChart.tsx
rename to packages/quill/packages/charts/src/charts/PieChart/PieChart.tsx
diff --git a/frontend/src/lib/hog-charts/charts/PieChart/PieTooltip.tsx b/packages/quill/packages/charts/src/charts/PieChart/PieTooltip.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/PieChart/PieTooltip.tsx
rename to packages/quill/packages/charts/src/charts/PieChart/PieTooltip.tsx
diff --git a/frontend/src/lib/hog-charts/charts/PieChart/SliceLabels.test.tsx b/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/PieChart/SliceLabels.test.tsx
rename to packages/quill/packages/charts/src/charts/PieChart/SliceLabels.test.tsx
diff --git a/frontend/src/lib/hog-charts/charts/PieChart/SliceLabels.tsx b/packages/quill/packages/charts/src/charts/PieChart/SliceLabels.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/PieChart/SliceLabels.tsx
rename to packages/quill/packages/charts/src/charts/PieChart/SliceLabels.tsx
diff --git a/frontend/src/lib/hog-charts/charts/PieChart/computePieLayout.test.ts b/packages/quill/packages/charts/src/charts/PieChart/computePieLayout.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/PieChart/computePieLayout.test.ts
rename to packages/quill/packages/charts/src/charts/PieChart/computePieLayout.test.ts
diff --git a/frontend/src/lib/hog-charts/charts/PieChart/computePieLayout.ts b/packages/quill/packages/charts/src/charts/PieChart/computePieLayout.ts
similarity index 98%
rename from frontend/src/lib/hog-charts/charts/PieChart/computePieLayout.ts
rename to packages/quill/packages/charts/src/charts/PieChart/computePieLayout.ts
index f3c955b708dd..337459a12c09 100644
--- a/frontend/src/lib/hog-charts/charts/PieChart/computePieLayout.ts
+++ b/packages/quill/packages/charts/src/charts/PieChart/computePieLayout.ts
@@ -1,4 +1,4 @@
-import * as d3 from 'd3'
+import { pie } from 'd3-shape'
import type { ResolvedSeries } from '../../core/types'
@@ -108,8 +108,7 @@ export function computePieLayout<Meta = unknown>(opts: ComputePieLayoutOptions<M
return { slices: [], total: 0, cx, cy, outerRadius, innerRadius, padAngle }
}
- const pieGenerator = d3
- .pie<Indexed>()
+ const pieGenerator = pie<Indexed>()
.value((d) => d.value)
.padAngle(padAngle)
if (sort === null) {
diff --git a/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.stories.tsx b/packages/quill/packages/charts/src/charts/Sparkline/Sparkline.stories.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.stories.tsx
rename to packages/quill/packages/charts/src/charts/Sparkline/Sparkline.stories.tsx
diff --git a/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.test.tsx b/packages/quill/packages/charts/src/charts/Sparkline/Sparkline.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.test.tsx
rename to packages/quill/packages/charts/src/charts/Sparkline/Sparkline.test.tsx
diff --git a/frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.tsx b/packages/quill/packages/charts/src/charts/Sparkline/Sparkline.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/Sparkline/Sparkline.tsx
rename to packages/quill/packages/charts/src/charts/Sparkline/Sparkline.tsx
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesBarChart/TimeSeriesBarChart.stories.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.stories.tsx
similarity index 97%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesBarChart/TimeSeriesBarChart.stories.tsx
rename to packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.stories.tsx
index 83d3cb3bf9e6..98f2ce65d478 100644
--- a/frontend/src/lib/hog-charts/charts/TimeSeriesBarChart/TimeSeriesBarChart.stories.tsx
+++ b/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.stories.tsx
@@ -91,7 +91,7 @@ function DateAxisCell({ title, labels, series, interval, timezone }: DateAxisCel
return (
// eslint-disable-next-line react/forbid-dom-props
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
- <span className="text-xs text-muted">{title}</span>
+ <span className="text-xs text-muted-foreground">{title}</span>
<Stage width={420} height={220}>
<TimeSeriesBarChart
series={series}
@@ -118,7 +118,7 @@ function YFormatCell({ title, config, series }: YFormatCellProps): JSX.Element {
return (
// eslint-disable-next-line react/forbid-dom-props
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
- <span className="text-xs text-muted">{title}</span>
+ <span className="text-xs text-muted-foreground">{title}</span>
<Stage width={420} height={220}>
<TimeSeriesBarChart
series={series}
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesBarChart/TimeSeriesBarChart.test.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesBarChart/TimeSeriesBarChart.test.tsx
rename to packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.test.tsx
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx
rename to packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.stories.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.stories.tsx
similarity index 98%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.stories.tsx
rename to packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.stories.tsx
index 8392169242ca..658e6a9b5b47 100644
--- a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.stories.tsx
+++ b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.stories.tsx
@@ -60,7 +60,7 @@ function DateAxisCell({ title, labels, series, interval, timezone }: DateAxisCel
return (
// eslint-disable-next-line react/forbid-dom-props
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
- <span className="text-xs text-muted">{title}</span>
+ <span className="text-xs text-muted-foreground">{title}</span>
<Stage width={420} height={220}>
<TimeSeriesLineChart
series={series}
@@ -87,7 +87,7 @@ function YFormatCell({ title, config, series }: YFormatCellProps): JSX.Element {
return (
// eslint-disable-next-line react/forbid-dom-props
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
- <span className="text-xs text-muted">{title}</span>
+ <span className="text-xs text-muted-foreground">{title}</span>
<Stage width={420} height={220}>
<TimeSeriesLineChart
series={series}
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.test.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.test.tsx
rename to packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.test.tsx
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx
rename to packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/utils/derived-series.test.ts b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/utils/derived-series.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/utils/derived-series.test.ts
rename to packages/quill/packages/charts/src/charts/TimeSeriesLineChart/utils/derived-series.test.ts
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/utils/derived-series.ts b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/utils/derived-series.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/utils/derived-series.ts
rename to packages/quill/packages/charts/src/charts/TimeSeriesLineChart/utils/derived-series.ts
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/utils/use-derived-series.test.ts b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/utils/use-derived-series.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/utils/use-derived-series.test.ts
rename to packages/quill/packages/charts/src/charts/TimeSeriesLineChart/utils/use-derived-series.test.ts
diff --git a/frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/utils/use-derived-series.ts b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/utils/use-derived-series.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/TimeSeriesLineChart/utils/use-derived-series.ts
rename to packages/quill/packages/charts/src/charts/TimeSeriesLineChart/utils/use-derived-series.ts
diff --git a/frontend/src/lib/hog-charts/charts/time-series-fixtures.ts b/packages/quill/packages/charts/src/charts/time-series-fixtures.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/time-series-fixtures.ts
rename to packages/quill/packages/charts/src/charts/time-series-fixtures.ts
diff --git a/frontend/src/lib/hog-charts/charts/utils/use-value-labels.ts b/packages/quill/packages/charts/src/charts/utils/use-value-labels.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/charts/utils/use-value-labels.ts
rename to packages/quill/packages/charts/src/charts/utils/use-value-labels.ts
diff --git a/frontend/src/lib/hog-charts/components/Legend/ChartLegend.test.tsx b/packages/quill/packages/charts/src/components/Legend/ChartLegend.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/components/Legend/ChartLegend.test.tsx
rename to packages/quill/packages/charts/src/components/Legend/ChartLegend.test.tsx
diff --git a/frontend/src/lib/hog-charts/components/Legend/ChartLegend.tsx b/packages/quill/packages/charts/src/components/Legend/ChartLegend.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/components/Legend/ChartLegend.tsx
rename to packages/quill/packages/charts/src/components/Legend/ChartLegend.tsx
diff --git a/frontend/src/lib/hog-charts/components/Legend/ChartLegendLayout.test.tsx b/packages/quill/packages/charts/src/components/Legend/ChartLegendLayout.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/components/Legend/ChartLegendLayout.test.tsx
rename to packages/quill/packages/charts/src/components/Legend/ChartLegendLayout.test.tsx
diff --git a/frontend/src/lib/hog-charts/components/Legend/ChartLegendLayout.tsx b/packages/quill/packages/charts/src/components/Legend/ChartLegendLayout.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/components/Legend/ChartLegendLayout.tsx
rename to packages/quill/packages/charts/src/components/Legend/ChartLegendLayout.tsx
diff --git a/frontend/src/lib/hog-charts/components/Legend/Legend.stories.tsx b/packages/quill/packages/charts/src/components/Legend/Legend.stories.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/components/Legend/Legend.stories.tsx
rename to packages/quill/packages/charts/src/components/Legend/Legend.stories.tsx
diff --git a/frontend/src/lib/hog-charts/components/Legend/Legend.test.tsx b/packages/quill/packages/charts/src/components/Legend/Legend.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/components/Legend/Legend.test.tsx
rename to packages/quill/packages/charts/src/components/Legend/Legend.test.tsx
diff --git a/frontend/src/lib/hog-charts/components/Legend/Legend.tsx b/packages/quill/packages/charts/src/components/Legend/Legend.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/components/Legend/Legend.tsx
rename to packages/quill/packages/charts/src/components/Legend/Legend.tsx
diff --git a/frontend/src/lib/hog-charts/components/Legend/legendItemsFromSeries.test.ts b/packages/quill/packages/charts/src/components/Legend/legendItemsFromSeries.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/components/Legend/legendItemsFromSeries.test.ts
rename to packages/quill/packages/charts/src/components/Legend/legendItemsFromSeries.test.ts
diff --git a/frontend/src/lib/hog-charts/components/Legend/legendItemsFromSeries.ts b/packages/quill/packages/charts/src/components/Legend/legendItemsFromSeries.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/components/Legend/legendItemsFromSeries.ts
rename to packages/quill/packages/charts/src/components/Legend/legendItemsFromSeries.ts
diff --git a/frontend/src/lib/hog-charts/core/Chart.tsx b/packages/quill/packages/charts/src/core/Chart.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/core/Chart.tsx
rename to packages/quill/packages/charts/src/core/Chart.tsx
diff --git a/frontend/src/lib/hog-charts/core/ChartErrorBoundary.tsx b/packages/quill/packages/charts/src/core/ChartErrorBoundary.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/core/ChartErrorBoundary.tsx
rename to packages/quill/packages/charts/src/core/ChartErrorBoundary.tsx
diff --git a/frontend/src/lib/hog-charts/core/RadialChart.tsx b/packages/quill/packages/charts/src/core/RadialChart.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/core/RadialChart.tsx
rename to packages/quill/packages/charts/src/core/RadialChart.tsx
diff --git a/frontend/src/lib/hog-charts/core/bar-canvas-renderer.test.ts b/packages/quill/packages/charts/src/core/bar-canvas-renderer.test.ts
similarity index 99%
rename from frontend/src/lib/hog-charts/core/bar-canvas-renderer.test.ts
rename to packages/quill/packages/charts/src/core/bar-canvas-renderer.test.ts
index 8425995b944a..9f516b6f30df 100644
--- a/frontend/src/lib/hog-charts/core/bar-canvas-renderer.test.ts
+++ b/packages/quill/packages/charts/src/core/bar-canvas-renderer.test.ts
@@ -1,4 +1,4 @@
-import * as d3 from 'd3'
+import { scaleLinear } from 'd3-scale'
import { dimensions, makeSeries } from '../testing'
import {
@@ -35,7 +35,7 @@ function makeDrawContext(ctx: CanvasRenderingContext2D, labels: string[]): DrawC
const idx = labels.indexOf(label)
return idx < 0 ? undefined : 100 + idx * 60
}
- const yScale = d3.scaleLinear().domain([0, 100]).range([368, 16])
+ const yScale = scaleLinear().domain([0, 100]).range([368, 16])
return { ctx, dimensions, xScale, yScale, labels }
}
diff --git a/frontend/src/lib/hog-charts/core/bar-layout.test.ts b/packages/quill/packages/charts/src/core/bar-layout.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/bar-layout.test.ts
rename to packages/quill/packages/charts/src/core/bar-layout.test.ts
diff --git a/frontend/src/lib/hog-charts/core/bar-layout.ts b/packages/quill/packages/charts/src/core/bar-layout.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/bar-layout.ts
rename to packages/quill/packages/charts/src/core/bar-layout.ts
diff --git a/frontend/src/lib/hog-charts/core/bar-scales.test.ts b/packages/quill/packages/charts/src/core/bar-scales.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/bar-scales.test.ts
rename to packages/quill/packages/charts/src/core/bar-scales.test.ts
diff --git a/frontend/src/lib/hog-charts/core/canvas-renderer.test.ts b/packages/quill/packages/charts/src/core/canvas-renderer.test.ts
similarity index 98%
rename from frontend/src/lib/hog-charts/core/canvas-renderer.test.ts
rename to packages/quill/packages/charts/src/core/canvas-renderer.test.ts
index 3a9585102a74..08b5744369ad 100644
--- a/frontend/src/lib/hog-charts/core/canvas-renderer.test.ts
+++ b/packages/quill/packages/charts/src/core/canvas-renderer.test.ts
@@ -1,4 +1,4 @@
-import * as d3 from 'd3'
+import { scaleLinear, scalePoint } from 'd3-scale'
import { dimensions, makeSeries } from '../testing'
import { composeDrawHoverWithCrosshair, drawArea, drawGrid, drawLine, type DrawContext } from './canvas-renderer'
@@ -25,15 +25,15 @@ function mockCanvasContext(): jest.Mocked<CanvasRenderingContext2D> {
}
function makeDrawContext(ctx: CanvasRenderingContext2D, labels: string[]): DrawContext {
- const xScale = d3.scalePoint<string>().domain(labels).range([48, 784]).padding(0)
- const yScale = d3.scaleLinear().domain([0, 100]).range([368, 16])
+ const xScale = scalePoint<string>().domain(labels).range([48, 784]).padding(0)
+ const yScale = scaleLinear().domain([0, 100]).range([368, 16])
return { ctx, dimensions, xScale, yScale, labels }
}
/** Builds a DrawContext where specific y-values produce Infinity (simulating gaps). */
function makeDrawContextWithGaps(ctx: CanvasRenderingContext2D, labels: string[], gapValues: Set<number>): DrawContext {
- const xScale = d3.scalePoint<string>().domain(labels).range([48, 784])
- const origYScale = d3.scaleLinear().domain([0, 100]).range([368, 16])
+ const xScale = scalePoint<string>().domain(labels).range([48, 784])
+ const origYScale = scaleLinear().domain([0, 100]).range([368, 16])
const patchedYScale = (v: number): number => (gapValues.has(v) ? Infinity : origYScale(v))
Object.assign(patchedYScale, origYScale)
return { ctx, dimensions, xScale, yScale: patchedYScale as any, labels }
diff --git a/frontend/src/lib/hog-charts/core/canvas-renderer.ts b/packages/quill/packages/charts/src/core/canvas-renderer.ts
similarity index 99%
rename from frontend/src/lib/hog-charts/core/canvas-renderer.ts
rename to packages/quill/packages/charts/src/core/canvas-renderer.ts
index 2dc60f82f85e..9c364a3b553d 100644
--- a/frontend/src/lib/hog-charts/core/canvas-renderer.ts
+++ b/packages/quill/packages/charts/src/core/canvas-renderer.ts
@@ -1,4 +1,4 @@
-import * as d3 from 'd3'
+import { type ScaleLinear, type ScaleLogarithmic } from 'd3-scale'
import { barColorAt } from './color-utils'
import { yTickCountForHeight } from './scales'
@@ -8,7 +8,7 @@ export interface DrawContext {
ctx: CanvasRenderingContext2D
dimensions: ChartDimensions
xScale: (label: string) => number | undefined
- yScale: d3.ScaleLinear<number, number> | d3.ScaleLogarithmic<number, number>
+ yScale: ScaleLinear<number, number> | ScaleLogarithmic<number, number>
labels: string[]
}
@@ -324,7 +324,7 @@ export function drawGrid(drawCtx: DrawContext, options: DrawGridOptions = {}): v
const tickAxisLength = orientation === 'horizontal' ? dimensions.plotWidth : dimensions.plotHeight
const categoryTicks = options.categoryTicks ?? []
- const valueTicks = (yScale as d3.ScaleLinear<number, number>).ticks?.(yTickCountForHeight(tickAxisLength)) ?? []
+ const valueTicks = (yScale as ScaleLinear<number, number>).ticks?.(yTickCountForHeight(tickAxisLength)) ?? []
ctx.strokeStyle = gridColor
ctx.lineWidth = 1
diff --git a/frontend/src/lib/hog-charts/core/chart-context.test.tsx b/packages/quill/packages/charts/src/core/chart-context.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/core/chart-context.test.tsx
rename to packages/quill/packages/charts/src/core/chart-context.test.tsx
diff --git a/frontend/src/lib/hog-charts/core/chart-context.ts b/packages/quill/packages/charts/src/core/chart-context.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/chart-context.ts
rename to packages/quill/packages/charts/src/core/chart-context.ts
diff --git a/frontend/src/lib/hog-charts/core/color-utils.ts b/packages/quill/packages/charts/src/core/color-utils.ts
similarity index 89%
rename from frontend/src/lib/hog-charts/core/color-utils.ts
rename to packages/quill/packages/charts/src/core/color-utils.ts
index 9d23cffb025e..abaaa7ce34a9 100644
--- a/frontend/src/lib/hog-charts/core/color-utils.ts
+++ b/packages/quill/packages/charts/src/core/color-utils.ts
@@ -1,11 +1,11 @@
-import * as d3 from 'd3'
+import { color as d3Color } from 'd3-color'
import type { ResolvedSeries, Series } from './types'
/** Translucent variant of a series colour (any CSS color form d3 can parse — hex 3/6 digit,
* rgb/rgba, named, HSL). Falls back to the raw string when `d3.color` returns `null`. */
export function dimColor(color: string, alpha: number): string {
- return d3.color(color)?.copy({ opacity: alpha }).toString() ?? color
+ return d3Color(color)?.copy({ opacity: alpha }).toString() ?? color
}
/** Fill color for the bar at `index`: the per-bar override (`bars[index].color`) when set, else the
diff --git a/frontend/src/lib/hog-charts/core/hooks/useChartCanvas.ts b/packages/quill/packages/charts/src/core/hooks/useChartCanvas.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useChartCanvas.ts
rename to packages/quill/packages/charts/src/core/hooks/useChartCanvas.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useChartDraw.ts b/packages/quill/packages/charts/src/core/hooks/useChartDraw.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useChartDraw.ts
rename to packages/quill/packages/charts/src/core/hooks/useChartDraw.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useChartInteraction.test.ts b/packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useChartInteraction.test.ts
rename to packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useChartInteraction.ts b/packages/quill/packages/charts/src/core/hooks/useChartInteraction.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useChartInteraction.ts
rename to packages/quill/packages/charts/src/core/hooks/useChartInteraction.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useChartMargins.test.ts b/packages/quill/packages/charts/src/core/hooks/useChartMargins.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useChartMargins.test.ts
rename to packages/quill/packages/charts/src/core/hooks/useChartMargins.test.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useChartMargins.ts b/packages/quill/packages/charts/src/core/hooks/useChartMargins.ts
similarity index 98%
rename from frontend/src/lib/hog-charts/core/hooks/useChartMargins.ts
rename to packages/quill/packages/charts/src/core/hooks/useChartMargins.ts
index 60be84b80c96..ed7105cc9fd6 100644
--- a/frontend/src/lib/hog-charts/core/hooks/useChartMargins.ts
+++ b/packages/quill/packages/charts/src/core/hooks/useChartMargins.ts
@@ -1,4 +1,4 @@
-import * as d3 from 'd3'
+import { scaleLinear } from 'd3-scale'
import { useMemo } from 'react'
import { normalizeAxisLabel } from '../../utils/axis-labels'
@@ -62,7 +62,7 @@ function widestValueLabelWidth(series: Series[], yTickFormatter: ((value: number
}
const min = range.min > 0 ? 0 : range.min
const max = range.max < 0 ? 0 : range.max
- const ticks = d3.scaleLinear().domain([min, max]).nice(6).ticks(6)
+ const ticks = scaleLinear().domain([min, max]).nice(6).ticks(6)
if (ticks.length === 0) {
return 0
}
diff --git a/frontend/src/lib/hog-charts/core/hooks/useLatest.ts b/packages/quill/packages/charts/src/core/hooks/useLatest.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useLatest.ts
rename to packages/quill/packages/charts/src/core/hooks/useLatest.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useRadialInteraction.ts b/packages/quill/packages/charts/src/core/hooks/useRadialInteraction.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useRadialInteraction.ts
rename to packages/quill/packages/charts/src/core/hooks/useRadialInteraction.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useResolvedYFormatters.ts b/packages/quill/packages/charts/src/core/hooks/useResolvedYFormatters.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useResolvedYFormatters.ts
rename to packages/quill/packages/charts/src/core/hooks/useResolvedYFormatters.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useStableResolveValue.ts b/packages/quill/packages/charts/src/core/hooks/useStableResolveValue.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useStableResolveValue.ts
rename to packages/quill/packages/charts/src/core/hooks/useStableResolveValue.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useTooltipLifecycle.test.ts b/packages/quill/packages/charts/src/core/hooks/useTooltipLifecycle.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useTooltipLifecycle.test.ts
rename to packages/quill/packages/charts/src/core/hooks/useTooltipLifecycle.test.ts
diff --git a/frontend/src/lib/hog-charts/core/hooks/useTooltipLifecycle.ts b/packages/quill/packages/charts/src/core/hooks/useTooltipLifecycle.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/hooks/useTooltipLifecycle.ts
rename to packages/quill/packages/charts/src/core/hooks/useTooltipLifecycle.ts
diff --git a/frontend/src/lib/hog-charts/core/interaction.test.ts b/packages/quill/packages/charts/src/core/interaction.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/interaction.test.ts
rename to packages/quill/packages/charts/src/core/interaction.test.ts
diff --git a/frontend/src/lib/hog-charts/core/interaction.ts b/packages/quill/packages/charts/src/core/interaction.ts
similarity index 99%
rename from frontend/src/lib/hog-charts/core/interaction.ts
rename to packages/quill/packages/charts/src/core/interaction.ts
index aed6fa5aa5d4..ad184582f5fc 100644
--- a/frontend/src/lib/hog-charts/core/interaction.ts
+++ b/packages/quill/packages/charts/src/core/interaction.ts
@@ -1,4 +1,4 @@
-import { bisector } from 'd3'
+import { bisector } from 'd3-array'
import { barColorAt } from './color-utils'
import type {
diff --git a/frontend/src/lib/hog-charts/core/radial-context.ts b/packages/quill/packages/charts/src/core/radial-context.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/radial-context.ts
rename to packages/quill/packages/charts/src/core/radial-context.ts
diff --git a/frontend/src/lib/hog-charts/core/scales.test.ts b/packages/quill/packages/charts/src/core/scales.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/scales.test.ts
rename to packages/quill/packages/charts/src/core/scales.test.ts
diff --git a/frontend/src/lib/hog-charts/core/scales.ts b/packages/quill/packages/charts/src/core/scales.ts
similarity index 90%
rename from frontend/src/lib/hog-charts/core/scales.ts
rename to packages/quill/packages/charts/src/core/scales.ts
index 69c7778cc33e..651a620e850b 100644
--- a/frontend/src/lib/hog-charts/core/scales.ts
+++ b/packages/quill/packages/charts/src/core/scales.ts
@@ -1,4 +1,14 @@
-import * as d3 from 'd3'
+import {
+ scaleBand,
+ scaleLinear,
+ scaleLog,
+ scalePoint,
+ type ScaleBand,
+ type ScaleLinear,
+ type ScaleLogarithmic,
+ type ScalePoint,
+} from 'd3-scale'
+import { stack as stackGen, stackOffsetDiverging, stackOffsetExpand, stackOffsetNone } from 'd3-shape'
import type { ChartDimensions, ChartScales, ResolveValueFn, Series, ValueDomain } from './types'
import { DEFAULT_Y_AXIS_ID } from './types'
@@ -6,10 +16,10 @@ import { DEFAULT_Y_AXIS_ID } from './types'
/** Inner padding fraction applied to the band scale when `BarChartConfig.bars.bandPadding` is unset. */
export const DEFAULT_BAND_PADDING = 0.2
-type D3YScale = d3.ScaleLinear<number, number> | d3.ScaleLogarithmic<number, number>
+type D3YScale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>
export interface ScaleSet {
- x: d3.ScalePoint<string>
+ x: ScalePoint<string>
y: D3YScale
/** Per-axis d3 scales keyed by axis id. Only populated when multiple axes are present. */
yAxes?: Record<string, { scale: D3YScale; position: 'left' | 'right' }>
@@ -106,9 +116,8 @@ export function niceLogDomain(minPositive: number, max: number): [number, number
return [niceMin, niceMax]
}
-export function createXScale(labels: string[], dimensions: ChartDimensions): d3.ScalePoint<string> {
- return d3
- .scalePoint<string>()
+export function createXScale(labels: string[], dimensions: ChartDimensions): ScalePoint<string> {
+ return scalePoint<string>()
.domain(labels)
.range([dimensions.plotLeft, dimensions.plotLeft + dimensions.plotWidth])
.padding(0)
@@ -127,21 +136,19 @@ export function createYScale(
/** Fixed `[min, max]` or `{ include }` extra values the domain must cover. */
valueDomain?: ValueDomain
} = {}
-): d3.ScaleLinear<number, number> | d3.ScaleLogarithmic<number, number> {
+): ScaleLinear<number, number> | ScaleLogarithmic<number, number> {
const { scaleType = 'linear', percentStack = false, valueDomain } = options
const { fixed, include } = resolveValueDomain(valueDomain)
const tickCount = yTickCountForHeight(dimensions.plotHeight)
if (fixed) {
- return d3
- .scaleLinear()
+ return scaleLinear()
.domain([fixed[0], fixed[1]])
.range([dimensions.plotTop + dimensions.plotHeight, dimensions.plotTop])
}
if (percentStack) {
- return d3
- .scaleLinear()
+ return scaleLinear()
.domain([0, 1])
.nice(tickCount)
.range([dimensions.plotTop + dimensions.plotHeight, dimensions.plotTop])
@@ -151,8 +158,7 @@ export function createYScale(
const range = include?.length ? extendValueRange(dataRange, include) : dataRange
if (range.count === 0) {
- return d3
- .scaleLinear()
+ return scaleLinear()
.domain([0, 1])
.range([dimensions.plotTop + dimensions.plotHeight, dimensions.plotTop])
}
@@ -161,14 +167,12 @@ export function createYScale(
if (scaleType === 'log') {
if (!isFinite(range.minPositive)) {
- return d3
- .scaleLinear()
+ return scaleLinear()
.domain([min, max])
.nice(tickCount)
.range([dimensions.plotTop + dimensions.plotHeight, dimensions.plotTop])
}
- return d3
- .scaleLog()
+ return scaleLog()
.domain(niceLogDomain(range.minPositive, max))
.range([dimensions.plotTop + dimensions.plotHeight, dimensions.plotTop])
.clamp(true)
@@ -195,8 +199,7 @@ export function createYScale(
max = Math.max(0, max, min + 1)
}
- return d3
- .scaleLinear()
+ return scaleLinear()
.domain([min, max])
.nice(tickCount)
.range([dimensions.plotTop + dimensions.plotHeight, dimensions.plotTop])
@@ -259,7 +262,7 @@ export interface StackedBand {
function buildStackData(
series: Series[],
labels: string[],
- options: { offset?: typeof d3.stackOffsetNone; allowNegative?: boolean } = {}
+ options: { offset?: typeof stackOffsetNone; allowNegative?: boolean } = {}
): Map<string, StackedBand> {
const { offset, allowNegative = false } = options
const visibleSeries = series.filter((s) => !s.visibility?.excluded && !s.fill?.lowerData && !s.overlay)
@@ -290,14 +293,14 @@ function buildStackData(
return row
})
- const stack = d3.stack<Record<string, number>>().keys(axisSeries.map((s) => s.key))
+ const stack = stackGen<Record<string, number>>().keys(axisSeries.map((s) => s.key))
if (offset) {
stack.offset(offset)
}
const stacked = stack(tableData)
for (const layer of stacked) {
- // d3.stackOffsetExpand emits NaN for all-zero columns; flatten so consumers don't have to guard.
+ // stackOffsetExpand emits NaN for all-zero columns; flatten so consumers don't have to guard.
result.set(layer.key, {
top: layer.map((d) => (Number.isFinite(d[1]) ? d[1] : 0)),
bottom: layer.map((d) => (Number.isFinite(d[0]) ? d[0] : 0)),
@@ -313,14 +316,14 @@ export function computeStackData(series: Series[], labels: string[]): Map<string
}
export function computePercentStackData(series: Series[], labels: string[]): Map<string, StackedBand> {
- return buildStackData(series, labels, { offset: d3.stackOffsetExpand })
+ return buildStackData(series, labels, { offset: stackOffsetExpand })
}
/** Stack that preserves negative segments — positives accumulate upward from 0, negatives
- * downward from 0 (d3.stackOffsetDiverging). Used by Lifecycle, where `dormant` is emitted
+ * downward from 0 (stackOffsetDiverging). Used by Lifecycle, where `dormant` is emitted
* as a negative series so it renders below the zero baseline. */
export function computeDivergingStackData(series: Series[], labels: string[]): Map<string, StackedBand> {
- return buildStackData(series, labels, { offset: d3.stackOffsetDiverging, allowNegative: true })
+ return buildStackData(series, labels, { offset: stackOffsetDiverging, allowNegative: true })
}
/** Returns the stacked top of each series so the tooltip anchor and value-label position
@@ -368,10 +371,10 @@ export function buildSegmentResolveValue(
}
export interface BarScaleSet {
- band: d3.ScaleBand<string>
+ band: ScaleBand<string>
value: D3YScale
/** Sub-band for grouped layout — maps a series key to its offset inside a band. */
- group?: d3.ScaleBand<string>
+ group?: ScaleBand<string>
}
export function createBarScales(
@@ -415,7 +418,6 @@ export function createBarScales(
const bandAxisStart = isHorizontal ? dimensions.plotTop : dimensions.plotLeft
const bandAxisExtent = isHorizontal ? dimensions.plotHeight : dimensions.plotWidth
const cappedExtent = maxBandRange != null ? Math.min(bandAxisExtent, maxBandRange) : bandAxisExtent
-
// Fit-to-height: only keep the rows that fit at `minBandSize`. Labels arrive value-sorted, so
// slicing keeps the leading rows. Bars/labels/grid all resolve through `band(label)`, so a
// dropped label resolves to `undefined` and is skipped everywhere — no extra plumbing needed.
@@ -426,17 +428,16 @@ export function createBarScales(
domainLabels = labels.slice(0, maxBands)
}
}
- const band = d3
- .scaleBand<string>()
+ const band = scaleBand<string>()
.domain(domainLabels)
.range([bandAxisStart, bandAxisStart + cappedExtent])
.paddingInner(bandPadding)
.paddingOuter(bandPadding / 2)
- let group: d3.ScaleBand<string> | undefined
+ let group: ScaleBand<string> | undefined
if (barLayout === 'grouped') {
const visibleKeys = series.filter((s) => !s.visibility?.excluded).map((s) => s.key)
- group = d3.scaleBand<string>().domain(visibleKeys).range([0, band.bandwidth()]).padding(groupPadding)
+ group = scaleBand<string>().domain(visibleKeys).range([0, band.bandwidth()]).padding(groupPadding)
}
const valueRange: [number, number] = isHorizontal
@@ -461,27 +462,27 @@ function buildBarValueScale(
): D3YScale {
const { fixed, include } = resolveValueDomain(valueDomain)
if (fixed) {
- return d3.scaleLinear().domain([fixed[0], fixed[1]]).range(valueRange)
+ return scaleLinear().domain([fixed[0], fixed[1]]).range(valueRange)
}
if (barLayout === 'percent') {
- return d3.scaleLinear().domain([0, 1]).nice(tickCount).range(valueRange)
+ return scaleLinear().domain([0, 1]).nice(tickCount).range(valueRange)
}
const range = include?.length
? extendValueRange(seriesValueRange(stackedSeries ?? series), include)
: seriesValueRange(stackedSeries ?? series)
if (range.count === 0) {
- return d3.scaleLinear().domain([0, 1]).range(valueRange)
+ return scaleLinear().domain([0, 1]).range(valueRange)
}
const min = range.min > 0 ? 0 : range.min
let max = range.max < 0 ? 0 : range.max
if (scaleType === 'log' && isFinite(range.minPositive)) {
- return d3.scaleLog().domain(niceLogDomain(range.minPositive, max)).range(valueRange).clamp(true)
+ return scaleLog().domain(niceLogDomain(range.minPositive, max)).range(valueRange).clamp(true)
}
// Guard the degenerate single-point domain (e.g. empty data with a single goal value at 0).
if (min === max) {
max = min + 1
}
- return d3.scaleLinear().domain([min, max]).nice(tickCount).range(valueRange)
+ return scaleLinear().domain([min, max]).nice(tickCount).range(valueRange)
}
export function autoFormatYTick(value: number, domainMax: number): string {
diff --git a/frontend/src/lib/hog-charts/core/types.ts b/packages/quill/packages/charts/src/core/types.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/core/types.ts
rename to packages/quill/packages/charts/src/core/types.ts
diff --git a/frontend/src/lib/hog-charts/docs/CONTRIBUTING.md b/packages/quill/packages/charts/src/docs/CONTRIBUTING.md
similarity index 100%
rename from frontend/src/lib/hog-charts/docs/CONTRIBUTING.md
rename to packages/quill/packages/charts/src/docs/CONTRIBUTING.md
diff --git a/frontend/src/lib/hog-charts/docs/TESTING.md b/packages/quill/packages/charts/src/docs/TESTING.md
similarity index 99%
rename from frontend/src/lib/hog-charts/docs/TESTING.md
rename to packages/quill/packages/charts/src/docs/TESTING.md
index bf77ee3e6c99..206552fbec1c 100644
--- a/frontend/src/lib/hog-charts/docs/TESTING.md
+++ b/packages/quill/packages/charts/src/docs/TESTING.md
@@ -13,7 +13,7 @@ You've rendered a tree that contains a chart somewhere — a dashboard, an insig
```tsx
import { render } from '@testing-library/react'
-import { ensureJsdom, getHogChart, hoverAtIndex, waitForHogChartTooltip } from 'lib/hog-charts/testing'
+import { ensureJsdom, getHogChart, hoverAtIndex, waitForHogChartTooltip } from '@posthog/quill-charts/testing'
ensureJsdom()
diff --git a/frontend/src/lib/hog-charts/index.ts b/packages/quill/packages/charts/src/index.ts
similarity index 96%
rename from frontend/src/lib/hog-charts/index.ts
rename to packages/quill/packages/charts/src/index.ts
index 18848fb91b60..c531c413f824 100644
--- a/frontend/src/lib/hog-charts/index.ts
+++ b/packages/quill/packages/charts/src/index.ts
@@ -16,12 +16,11 @@ export { TimeSeriesBarChart } from './charts/TimeSeriesBarChart/TimeSeriesBarCha
export type { TimeSeriesBarChartConfig, TimeSeriesBarChartProps } from './charts/TimeSeriesBarChart/TimeSeriesBarChart'
export { Sparkline } from './charts/Sparkline/Sparkline'
export type { SparklineProps } from './charts/Sparkline/Sparkline'
-export { Metric } from './blocks/Metric/Metric'
-export type { ChangeColor, MetricChange, MetricProps } from './blocks/Metric/Metric'
// Base chart (for building new chart types)
export { Chart } from './core/Chart'
export type { ChartProps } from './core/Chart'
+export { ChartErrorBoundary } from './core/ChartErrorBoundary'
export { RadialChart, RADIAL_MARGINS } from './core/RadialChart'
export type { RadialChartProps, RadialLayoutBuilder } from './core/RadialChart'
export { DEFAULT_MARGINS } from './core/hooks/useChartMargins'
@@ -111,9 +110,12 @@ export { createXAxisTickCallback, parseDateForAxis } from './utils/dates'
export type { TimeInterval } from './utils/dates'
export { buildYTickFormatter } from './utils/y-formatters'
export type { YAxisFormat, YFormatterConfig } from './utils/y-formatters'
+export { percentage } from './utils/format'
export type { XAxisConfig, YAxisConfig } from './utils/use-axis-formatters'
export { buildGoalLineReferenceLines, computeSeriesNonZeroMax } from './utils/goal-lines'
export type { GoalLineConfig } from './utils/goal-lines'
+export { normalizeAxisLabel } from './utils/axis-labels'
+export { MAX_CATEGORY_LABEL_WIDTH } from './utils/text-measure'
// Statistics helpers (used by trend-line / moving-average / confidence-interval features)
export { ciRanges, linearRegression, movingAverage, trendLine } from './utils/statistics'
diff --git a/frontend/src/lib/hog-charts/overlays/AnomalyPointsLayer.tsx b/packages/quill/packages/charts/src/overlays/AnomalyPointsLayer.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/AnomalyPointsLayer.tsx
rename to packages/quill/packages/charts/src/overlays/AnomalyPointsLayer.tsx
diff --git a/frontend/src/lib/hog-charts/overlays/AxisLabels.test.ts b/packages/quill/packages/charts/src/overlays/AxisLabels.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/AxisLabels.test.ts
rename to packages/quill/packages/charts/src/overlays/AxisLabels.test.ts
diff --git a/frontend/src/lib/hog-charts/overlays/AxisLabels.tsx b/packages/quill/packages/charts/src/overlays/AxisLabels.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/AxisLabels.tsx
rename to packages/quill/packages/charts/src/overlays/AxisLabels.tsx
diff --git a/frontend/src/lib/hog-charts/overlays/AxisTitles.tsx b/packages/quill/packages/charts/src/overlays/AxisTitles.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/AxisTitles.tsx
rename to packages/quill/packages/charts/src/overlays/AxisTitles.tsx
diff --git a/frontend/src/lib/hog-charts/overlays/DefaultTooltip.tsx b/packages/quill/packages/charts/src/overlays/DefaultTooltip.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/DefaultTooltip.tsx
rename to packages/quill/packages/charts/src/overlays/DefaultTooltip.tsx
diff --git a/frontend/src/lib/hog-charts/overlays/ReferenceLine.stories.tsx b/packages/quill/packages/charts/src/overlays/ReferenceLine.stories.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/ReferenceLine.stories.tsx
rename to packages/quill/packages/charts/src/overlays/ReferenceLine.stories.tsx
diff --git a/frontend/src/lib/hog-charts/overlays/ReferenceLine.test.tsx b/packages/quill/packages/charts/src/overlays/ReferenceLine.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/ReferenceLine.test.tsx
rename to packages/quill/packages/charts/src/overlays/ReferenceLine.test.tsx
diff --git a/frontend/src/lib/hog-charts/overlays/ReferenceLine.tsx b/packages/quill/packages/charts/src/overlays/ReferenceLine.tsx
similarity index 95%
rename from frontend/src/lib/hog-charts/overlays/ReferenceLine.tsx
rename to packages/quill/packages/charts/src/overlays/ReferenceLine.tsx
index 5d773623731f..0cf70ab48b70 100644
--- a/frontend/src/lib/hog-charts/overlays/ReferenceLine.tsx
+++ b/packages/quill/packages/charts/src/overlays/ReferenceLine.tsx
@@ -65,6 +65,11 @@ const LABEL_HEIGHT = 20
/** Padding between the label and the plot edge. */
const LABEL_PADDING = 4
+// Match the chart tooltip look (see DefaultTooltip) so the label bubble reads as part of the
+// chart's own theming rather than depending on the host app's CSS variables.
+const DEFAULT_TOOLTIP_BG = '#1d2330'
+const DEFAULT_TOOLTIP_COLOR = '#ffffff'
+
function resolveStyle(variant: ReferenceLineVariant, style: ReferenceLineStyle | undefined): ResolvedStyle {
const defaults = VARIANT_DEFAULTS[variant]
return {
@@ -301,6 +306,12 @@ function ReferenceLineView({
label: string | undefined
labelStyle: React.CSSProperties
}): React.ReactElement {
+ const { theme } = useChartLayout()
+ const resolvedLabelStyle: React.CSSProperties = {
+ ...labelStyle,
+ backgroundColor: theme.tooltipBackground ?? DEFAULT_TOOLTIP_BG,
+ color: theme.tooltipColor ?? DEFAULT_TOOLTIP_COLOR,
+ }
return (
<>
{fillRect && (
@@ -313,8 +324,8 @@ function ReferenceLineView({
{label && (
<div
data-attr="hog-chart-reference-line-label"
- className="absolute pointer-events-none whitespace-nowrap font-medium text-[11px] rounded px-1 py-0.5 bg-[var(--tooltip-bg)] text-white"
- style={labelStyle}
+ className="absolute pointer-events-none whitespace-nowrap font-medium text-[11px] rounded px-1 py-0.5"
+ style={resolvedLabelStyle}
>
{label}
</div>
diff --git a/frontend/src/lib/hog-charts/overlays/Tooltip.tsx b/packages/quill/packages/charts/src/overlays/Tooltip.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/Tooltip.tsx
rename to packages/quill/packages/charts/src/overlays/Tooltip.tsx
diff --git a/frontend/src/lib/hog-charts/overlays/ValueLabels.stories.tsx b/packages/quill/packages/charts/src/overlays/ValueLabels.stories.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/ValueLabels.stories.tsx
rename to packages/quill/packages/charts/src/overlays/ValueLabels.stories.tsx
diff --git a/frontend/src/lib/hog-charts/overlays/ValueLabels.test.tsx b/packages/quill/packages/charts/src/overlays/ValueLabels.test.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/ValueLabels.test.tsx
rename to packages/quill/packages/charts/src/overlays/ValueLabels.test.tsx
diff --git a/frontend/src/lib/hog-charts/overlays/ValueLabels.tsx b/packages/quill/packages/charts/src/overlays/ValueLabels.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/overlays/ValueLabels.tsx
rename to packages/quill/packages/charts/src/overlays/ValueLabels.tsx
diff --git a/frontend/src/lib/hog-charts/story-helpers.tsx b/packages/quill/packages/charts/src/story-helpers.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/story-helpers.tsx
rename to packages/quill/packages/charts/src/story-helpers.tsx
diff --git a/frontend/src/lib/hog-charts/testing/accessor.ts b/packages/quill/packages/charts/src/testing/accessor.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/testing/accessor.ts
rename to packages/quill/packages/charts/src/testing/accessor.ts
diff --git a/frontend/src/lib/hog-charts/testing/index.ts b/packages/quill/packages/charts/src/testing/index.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/testing/index.ts
rename to packages/quill/packages/charts/src/testing/index.ts
diff --git a/frontend/src/lib/hog-charts/testing/interactions.ts b/packages/quill/packages/charts/src/testing/interactions.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/testing/interactions.ts
rename to packages/quill/packages/charts/src/testing/interactions.ts
diff --git a/frontend/src/lib/hog-charts/testing/jsdom.ts b/packages/quill/packages/charts/src/testing/jsdom.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/testing/jsdom.ts
rename to packages/quill/packages/charts/src/testing/jsdom.ts
diff --git a/frontend/src/lib/hog-charts/testing/overlay.tsx b/packages/quill/packages/charts/src/testing/overlay.tsx
similarity index 100%
rename from frontend/src/lib/hog-charts/testing/overlay.tsx
rename to packages/quill/packages/charts/src/testing/overlay.tsx
diff --git a/frontend/src/lib/hog-charts/testing/render.ts b/packages/quill/packages/charts/src/testing/render.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/testing/render.ts
rename to packages/quill/packages/charts/src/testing/render.ts
diff --git a/frontend/src/lib/hog-charts/testing/tooltip.ts b/packages/quill/packages/charts/src/testing/tooltip.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/testing/tooltip.ts
rename to packages/quill/packages/charts/src/testing/tooltip.ts
diff --git a/frontend/src/lib/hog-charts/utils/axis-labels.ts b/packages/quill/packages/charts/src/utils/axis-labels.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/axis-labels.ts
rename to packages/quill/packages/charts/src/utils/axis-labels.ts
diff --git a/frontend/src/lib/hog-charts/utils/comparison-dimming.test.ts b/packages/quill/packages/charts/src/utils/comparison-dimming.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/comparison-dimming.test.ts
rename to packages/quill/packages/charts/src/utils/comparison-dimming.test.ts
diff --git a/frontend/src/lib/hog-charts/utils/comparison-dimming.ts b/packages/quill/packages/charts/src/utils/comparison-dimming.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/comparison-dimming.ts
rename to packages/quill/packages/charts/src/utils/comparison-dimming.ts
diff --git a/frontend/src/lib/hog-charts/utils/dates.test.ts b/packages/quill/packages/charts/src/utils/dates.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/dates.test.ts
rename to packages/quill/packages/charts/src/utils/dates.test.ts
diff --git a/frontend/src/lib/hog-charts/utils/dates.ts b/packages/quill/packages/charts/src/utils/dates.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/dates.ts
rename to packages/quill/packages/charts/src/utils/dates.ts
diff --git a/frontend/src/lib/hog-charts/utils/dayjs.test.ts b/packages/quill/packages/charts/src/utils/dayjs.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/dayjs.test.ts
rename to packages/quill/packages/charts/src/utils/dayjs.test.ts
diff --git a/frontend/src/lib/hog-charts/utils/dayjs.ts b/packages/quill/packages/charts/src/utils/dayjs.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/dayjs.ts
rename to packages/quill/packages/charts/src/utils/dayjs.ts
diff --git a/frontend/src/lib/hog-charts/utils/format.test.ts b/packages/quill/packages/charts/src/utils/format.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/format.test.ts
rename to packages/quill/packages/charts/src/utils/format.test.ts
diff --git a/frontend/src/lib/hog-charts/utils/format.ts b/packages/quill/packages/charts/src/utils/format.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/format.ts
rename to packages/quill/packages/charts/src/utils/format.ts
diff --git a/frontend/src/lib/hog-charts/utils/goal-lines.test.ts b/packages/quill/packages/charts/src/utils/goal-lines.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/goal-lines.test.ts
rename to packages/quill/packages/charts/src/utils/goal-lines.test.ts
diff --git a/frontend/src/lib/hog-charts/utils/goal-lines.ts b/packages/quill/packages/charts/src/utils/goal-lines.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/goal-lines.ts
rename to packages/quill/packages/charts/src/utils/goal-lines.ts
diff --git a/frontend/src/lib/hog-charts/utils/statistics.test.ts b/packages/quill/packages/charts/src/utils/statistics.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/statistics.test.ts
rename to packages/quill/packages/charts/src/utils/statistics.test.ts
diff --git a/frontend/src/lib/hog-charts/utils/statistics.ts b/packages/quill/packages/charts/src/utils/statistics.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/statistics.ts
rename to packages/quill/packages/charts/src/utils/statistics.ts
diff --git a/frontend/src/lib/hog-charts/utils/text-measure.test.ts b/packages/quill/packages/charts/src/utils/text-measure.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/text-measure.test.ts
rename to packages/quill/packages/charts/src/utils/text-measure.test.ts
diff --git a/frontend/src/lib/hog-charts/utils/text-measure.ts b/packages/quill/packages/charts/src/utils/text-measure.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/text-measure.ts
rename to packages/quill/packages/charts/src/utils/text-measure.ts
diff --git a/frontend/src/lib/hog-charts/utils/use-axis-formatters.ts b/packages/quill/packages/charts/src/utils/use-axis-formatters.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/use-axis-formatters.ts
rename to packages/quill/packages/charts/src/utils/use-axis-formatters.ts
diff --git a/frontend/src/lib/hog-charts/utils/y-formatters.test.ts b/packages/quill/packages/charts/src/utils/y-formatters.test.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/y-formatters.test.ts
rename to packages/quill/packages/charts/src/utils/y-formatters.test.ts
diff --git a/frontend/src/lib/hog-charts/utils/y-formatters.ts b/packages/quill/packages/charts/src/utils/y-formatters.ts
similarity index 100%
rename from frontend/src/lib/hog-charts/utils/y-formatters.ts
rename to packages/quill/packages/charts/src/utils/y-formatters.ts
diff --git a/packages/quill/packages/charts/tsconfig.json b/packages/quill/packages/charts/tsconfig.json
new file mode 100644
index 000000000000..5472760e8b30
--- /dev/null
+++ b/packages/quill/packages/charts/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "target": "es2022",
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "esModuleInterop": true,
+ "strict": true,
+ "skipLibCheck": true,
+ "noEmit": true,
+ "jsx": "react-jsx"
+ },
+ "include": ["src"]
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e54dd780f217..285c7166aa3f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -744,6 +744,9 @@ importers:
'@posthog/quill':
specifier: workspace:*
version: link:../packages/quill/packages/quill
+ '@posthog/quill-charts':
+ specifier: workspace:*
+ version: link:../packages/quill/packages/charts
'@posthog/react':
specifier: 'catalog:'
@@ -1881,6 +1884,70 @@ importers:
specifier: ^4.5.4
+ packages/quill/packages/charts:
+ dependencies:
+ '@floating-ui/react':
+ specifier: ^0.27.19
+ d3-array:
+ specifier: ^3.2.4
+ version: 3.2.4
+ d3-color:
+ specifier: ^3.1.0
+ version: 3.1.0
+ d3-scale:
+ specifier: ^4.0.2
+ version: 4.0.2
+ d3-shape:
+ specifier: ^3.2.0
+ version: 3.2.0
+ dayjs:
+ specifier: 1.11.11
+ version: 1.11.11(patch_hash=2e3e09d22bbc20d8961e0392c318f12ffada0babb6422f03b5538af8b2707852)
+ react:
+ specifier: 18.3.1
+ version: 18.3.1
+ react-dom:
+ specifier: 18.3.1
+ version: 18.3.1([email protected])
+ simple-statistics:
+ specifier: ^7.8.3
+ version: 7.8.8
+ devDependencies:
+ '@storybook/react':
+ specifier: 'catalog:'
+ '@testing-library/dom':
+ specifier: '>=9.3.4'
+ version: 9.3.4
+ '@testing-library/react':
+ specifier: ^14.3.1
+ '@types/d3-array':
+ specifier: ^3.2.1
+ version: 3.2.2
+ '@types/d3-color':
+ specifier: ^3.1.3
+ version: 3.1.3
+ '@types/d3-scale':
+ specifier: ^4.0.8
+ version: 4.0.9
+ '@types/d3-shape':
+ specifier: ^3.1.6
+ version: 3.1.8
+ '@types/jest':
+ specifier: 'catalog:'
+ version: 29.5.14
+ '@types/react':
+ specifier: 18.3.27
+ version: 18.3.27
+ '@types/react-dom':
+ specifier: 18.3.7
+ version: 18.3.7(@types/[email protected])
+ jest:
+ specifier: ^29.7.0
+
packages/quill/packages/components:
dependencies:
'@posthog/quill-primitives':
@@ -3192,6 +3259,9 @@ importers:
'@posthog/icons':
specifier: '*'
+ '@posthog/quill-charts':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/charts
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -3261,6 +3331,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
+ '@posthog/quill-charts':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/charts
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -11648,6 +11721,9 @@ packages:
resolution: {integrity: sha512-Reoy+pKnvsksN0lQUlcH6dOGjRZ/3WRwXR//m+/8lt1BXeI4xyaUZoqULNjyXXRuh0Mj4LNpkCvhUpQlY3X5xQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==}
+
resolution: {integrity: sha512-zji/iIbdd49g9WN0aIsGcwcTBUkgLsCSwB+uH+LPVDAiKWENMtI3cJEWt+7/YYwelMoZmbBfzA3qCdrZ2XFNnw==}
@@ -11663,6 +11739,9 @@ packages:
resolution: {integrity: sha512-HKuicPHJuvPgCD+np6Se9MQvS6OCbJmOjGvylzMJRlDwUXjKTTXs6Pwgk79O09Vj/ho3u1ofXnhFOaEWWPrlwA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==}
+
resolution: {integrity: sha512-C3zfBrhHZvrpAAK3YXqLWVAGo87A4SvJ83Q/zVJ8rFWJdKejUnDYaWZPkA8K84kb2vDA/g90LTQAz7etXcgoQQ==}
@@ -11726,6 +11805,9 @@ packages:
resolution: {integrity: sha512-Yk4htunhPAwN0XGlIwArRomOjdoBFXC3+kCxK2Ubg7I9shQlVSJy/pG/Ht5ASN+gdMIalpk8TJ5xV74jFsetLA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==}
+
resolution: {integrity: sha512-71BorcY0yXl12S7lvb01JdaN9TpeUHBDb4RRhSq8U8BEkX/nIk5p7Byho+ZRTsx5nYLMpAbY3qt5EhqFzfGJlw==}
@@ -11738,6 +11820,9 @@ packages:
resolution: {integrity: sha512-jYIYxFFA9vrJ8Hd4Se83YI6XF+gzDL1aC5DCsldai4XYYiVNdhtpGbA/GM6iyQ8ayhSp3a148LY34hy7A4TxZA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-lae0iWfcDeR7qt7rA88BNiqdvPS5pFVPpo5OfjElwNaT2yyekbM0C9vK+yqBqEmHr6lDkRnYNoTBYlAgJa7a4w==}
+
resolution: {integrity: sha512-yjfBUe6DJBsDin2BMIulhSHmr5qNR5Pxs17+oW4DoVPyVIXZ+m6bs7j1UVKP08Emv6jRmYrYqxYzO63mQxy1rw==}
@@ -33377,6 +33462,8 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]': {}
+
dependencies:
'@types/d3-selection': 3.0.3
@@ -33391,9 +33478,11 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]': {}
+
dependencies:
- '@types/d3-array': 3.0.3
+ '@types/d3-array': 3.2.2
'@types/geojson': 7946.0.12
'@types/[email protected]': {}
@@ -33436,7 +33525,7 @@ snapshots:
dependencies:
- '@types/d3-color': 3.1.0
+ '@types/d3-color': 3.1.3
'@types/[email protected]': {}
@@ -33452,6 +33541,10 @@ snapshots:
dependencies:
'@types/d3-time': 3.0.0
+ '@types/[email protected]':
+ dependencies:
+ '@types/d3-time': 3.0.0
+
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -33462,6 +33555,10 @@ snapshots:
dependencies:
'@types/d3-path': 3.0.0
+ '@types/[email protected]':
+ dependencies:
+ '@types/d3-path': 3.0.0
+
'@types/[email protected]': {}
'@types/[email protected]': {}
diff --git a/products/mcp_analytics/frontend/MCPAnalyticsDashboardOverview.tsx b/products/mcp_analytics/frontend/MCPAnalyticsDashboardOverview.tsx
index 2b141284be02..e8eea38caea7 100644
--- a/products/mcp_analytics/frontend/MCPAnalyticsDashboardOverview.tsx
+++ b/products/mcp_analytics/frontend/MCPAnalyticsDashboardOverview.tsx
@@ -3,9 +3,10 @@ import { useMemo } from 'react'
import { IconBolt } from '@posthog/icons'
import { LemonSkeleton, Link } from '@posthog/lemon-ui'
+import { type ChartTheme } from '@posthog/quill-charts'
import { buildTheme } from 'lib/charts/utils/theme'
-import { type ChartTheme, Metric } from 'lib/hog-charts'
+import { Metric } from 'lib/hog-charts/blocks/Metric/Metric'
import { humanFriendlyDuration, humanFriendlyLargeNumber } from 'lib/utils'
import { urls } from 'scenes/urls'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/FunnelBarHorizontalChart.tsx b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/FunnelBarHorizontalChart.tsx
index 1b26f3ad037e..c57a86231615 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/FunnelBarHorizontalChart.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/FunnelBarHorizontalChart.tsx
@@ -2,8 +2,9 @@ import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { type ErrorInfo, useMemo } from 'react'
+import { type ChartTheme, type TooltipContext } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { type ChartTheme, type TooltipContext } from 'lib/hog-charts'
import { funnelDataLogic } from 'scenes/funnels/funnelDataLogic'
import { funnelPersonsModalLogic } from 'scenes/funnels/funnelPersonsModalLogic'
import { insightLogic } from 'scenes/insights/insightLogic'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/FunnelBarHorizontalTooltip.tsx b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/FunnelBarHorizontalTooltip.tsx
index eb749538f2e0..1a0429a36194 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/FunnelBarHorizontalTooltip.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/FunnelBarHorizontalTooltip.tsx
@@ -1,4 +1,5 @@
-import type { TooltipContext } from 'lib/hog-charts'
+import type { TooltipContext } from '@posthog/quill-charts'
+
import { FunnelTooltip } from 'scenes/funnels/FunnelTooltip'
import type { BreakdownFilter } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/SingleStepBar.tsx b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/SingleStepBar.tsx
index 959eec63c6f2..043065d00d76 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/SingleStepBar.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/SingleStepBar.tsx
@@ -6,7 +6,7 @@ import {
type ChartTheme,
type PointClickData,
type TooltipContext,
-} from 'lib/hog-charts'
+} from '@posthog/quill-charts'
import {
FUNNEL_BAR_HORIZONTAL_VALUE_DOMAIN,
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/funnelBarHorizontalTransforms.ts b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/funnelBarHorizontalTransforms.ts
index c73ccacdc339..3cc97534217a 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/funnelBarHorizontalTransforms.ts
+++ b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/funnelBarHorizontalTransforms.ts
@@ -1,4 +1,5 @@
-import type { Series } from 'lib/hog-charts'
+import type { Series } from '@posthog/quill-charts'
+
import { getReferenceStep, getStepBreakdownSeries } from 'scenes/funnels/funnelUtils'
import type { BreakdownFilter } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/FunnelHistogramChart.tsx b/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/FunnelHistogramChart.tsx
index 5fd3d8f91943..07ce3276aa4c 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/FunnelHistogramChart.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/FunnelHistogramChart.tsx
@@ -2,9 +2,10 @@ import { useValues } from 'kea'
import posthog from 'posthog-js'
import { useMemo, type ErrorInfo } from 'react'
+import { BarChart, ValueLabels } from '@posthog/quill-charts'
+import type { BarChartConfig } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { BarChart, ValueLabels } from 'lib/hog-charts'
-import type { BarChartConfig } from 'lib/hog-charts'
import { humanFriendlyNumber } from 'lib/utils'
import { funnelDataLogic } from 'scenes/funnels/funnelDataLogic'
import { insightLogic } from 'scenes/insights/insightLogic'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/funnelHistogramTransforms.ts b/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/funnelHistogramTransforms.ts
index 8341c22144de..ba1b79f1339a 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/funnelHistogramTransforms.ts
+++ b/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/funnelHistogramTransforms.ts
@@ -1,4 +1,5 @@
-import type { Series } from 'lib/hog-charts'
+import type { Series } from '@posthog/quill-charts'
+
import { humanFriendlyDuration } from 'lib/utils'
import type { HistogramGraphDatum } from '~/types'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx
index 2f2ce790b939..08b497d193a1 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx
@@ -2,8 +2,9 @@ import '@testing-library/jest-dom'
import { cleanup, configure, screen, waitFor } from '@testing-library/react'
+import { ensureJsdom, waitForHogChartTooltip } from '@posthog/quill-charts/testing'
+
import { FEATURE_FLAGS } from 'lib/constants'
-import { ensureJsdom, waitForHogChartTooltip } from 'lib/hog-charts/testing'
import { buildFunnelsQuery, chart, getHogChart, personsModal, renderInsight } from '~/test/insight-testing'
import { buildAnnotation } from '~/test/insight-testing/test-data'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx
index 0b87e7ac3ff0..2b4a8b43573b 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx
@@ -2,9 +2,10 @@ import { useValues } from 'kea'
import posthog from 'posthog-js'
import { useMemo, type ErrorInfo } from 'react'
+import { TimeSeriesLineChart } from '@posthog/quill-charts'
+import type { PointClickData, TimeSeriesLineChartConfig, TooltipConfig, TooltipContext } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { TimeSeriesLineChart } from 'lib/hog-charts'
-import type { PointClickData, TimeSeriesLineChartConfig, TooltipConfig, TooltipContext } from 'lib/hog-charts'
import { funnelDataLogic } from 'scenes/funnels/funnelDataLogic'
import { funnelPersonsModalLogic } from 'scenes/funnels/funnelPersonsModalLogic'
import { insightLogic } from 'scenes/insights/insightLogic'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineTooltip.tsx b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineTooltip.tsx
index 1dabc2db6dba..7adf12069946 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineTooltip.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineTooltip.tsx
@@ -1,6 +1,7 @@
import { useCallback, useMemo } from 'react'
-import type { TooltipContext } from 'lib/hog-charts'
+import type { TooltipContext } from '@posthog/quill-charts'
+
import { hasBreakdown } from 'scenes/funnels/funnelUtils'
import { InsightTooltip } from 'scenes/insights/InsightTooltip/InsightTooltip'
import { getDatumTitle, type SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/funnelChartTransforms.ts b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/funnelChartTransforms.ts
index e6b1a75ca98d..9532949bb1f3 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/funnelChartTransforms.ts
+++ b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/funnelChartTransforms.ts
@@ -1,4 +1,5 @@
-import type { Series, TimeSeriesLineChartConfig, TooltipConfig } from 'lib/hog-charts'
+import type { Series, TimeSeriesLineChartConfig, TooltipConfig } from '@posthog/quill-charts'
+
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
import type { GoalLine as SchemaGoalLine, TrendsFilter } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.tsx b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.tsx
index ddb12a976654..c9e8b78584fb 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.tsx
@@ -2,9 +2,10 @@ import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { useCallback, useMemo, type ErrorInfo } from 'react'
+import { BarChart, DEFAULT_MARGINS } from '@posthog/quill-charts'
+import type { BarChartConfig, PointClickData, TooltipContext } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { BarChart, DEFAULT_MARGINS } from 'lib/hog-charts'
-import type { BarChartConfig, PointClickData, TooltipContext } from 'lib/hog-charts'
import { StepLegend } from 'scenes/funnels/FunnelBarVertical/StepLegend'
import { funnelDataLogic } from 'scenes/funnels/funnelDataLogic'
import { funnelPersonsModalLogic } from 'scenes/funnels/funnelPersonsModalLogic'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarTooltip.tsx b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarTooltip.tsx
index dd7281212c51..0b085ce6949d 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarTooltip.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarTooltip.tsx
@@ -1,4 +1,5 @@
-import type { TooltipContext } from 'lib/hog-charts'
+import type { TooltipContext } from '@posthog/quill-charts'
+
import { FunnelTooltip } from 'scenes/funnels/FunnelTooltip'
import type { BreakdownFilter } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/funnelStepsBarTransforms.ts b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/funnelStepsBarTransforms.ts
index c54384b86689..be9e57b24635 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/funnelStepsBarTransforms.ts
+++ b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/funnelStepsBarTransforms.ts
@@ -1,4 +1,4 @@
-import type { Series } from 'lib/hog-charts'
+import type { Series } from '@posthog/quill-charts'
import type { FunnelStepWithConversionMetrics } from '~/types'
diff --git a/products/product_analytics/frontend/insights/retention/RetentionBarChart/RetentionBarChart.tsx b/products/product_analytics/frontend/insights/retention/RetentionBarChart/RetentionBarChart.tsx
index 790cc748caf1..74399853021b 100644
--- a/products/product_analytics/frontend/insights/retention/RetentionBarChart/RetentionBarChart.tsx
+++ b/products/product_analytics/frontend/insights/retention/RetentionBarChart/RetentionBarChart.tsx
@@ -2,9 +2,10 @@ import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { useCallback, useMemo, type ErrorInfo } from 'react'
+import { TimeSeriesBarChart } from '@posthog/quill-charts'
+import type { PointClickData, TooltipConfig, TooltipContext } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { TimeSeriesBarChart } from 'lib/hog-charts'
-import type { PointClickData, TooltipConfig, TooltipContext } from 'lib/hog-charts'
import { insightLogic } from 'scenes/insights/insightLogic'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
import { retentionGraphLogic } from 'scenes/retention/retentionGraphLogic'
diff --git a/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx b/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx
index 7f2ac9ad189d..e6abe9459e89 100644
--- a/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx
+++ b/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx
@@ -2,9 +2,10 @@ import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { useCallback, useMemo, type ErrorInfo } from 'react'
+import { TimeSeriesLineChart } from '@posthog/quill-charts'
+import type { PointClickData, TooltipConfig, TooltipContext } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { TimeSeriesLineChart } from 'lib/hog-charts'
-import type { PointClickData, TooltipConfig, TooltipContext } from 'lib/hog-charts'
import { insightLogic } from 'scenes/insights/insightLogic'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
import { retentionGraphLogic } from 'scenes/retention/retentionGraphLogic'
diff --git a/products/product_analytics/frontend/insights/retention/shared/RetentionTooltip.tsx b/products/product_analytics/frontend/insights/retention/shared/RetentionTooltip.tsx
index d7725cb8591d..e694c97acf21 100644
--- a/products/product_analytics/frontend/insights/retention/shared/RetentionTooltip.tsx
+++ b/products/product_analytics/frontend/insights/retention/shared/RetentionTooltip.tsx
@@ -1,6 +1,7 @@
import { useCallback, useMemo } from 'react'
-import type { TooltipContext } from 'lib/hog-charts'
+import type { TooltipContext } from '@posthog/quill-charts'
+
import { roundToDecimal } from 'lib/utils'
import { InsightTooltip } from 'scenes/insights/InsightTooltip/InsightTooltip'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
diff --git a/products/product_analytics/frontend/insights/retention/shared/retentionChartTransforms.test.ts b/products/product_analytics/frontend/insights/retention/shared/retentionChartTransforms.test.ts
index 27e5e62fff05..fd64071ce37c 100644
--- a/products/product_analytics/frontend/insights/retention/shared/retentionChartTransforms.test.ts
+++ b/products/product_analytics/frontend/insights/retention/shared/retentionChartTransforms.test.ts
@@ -1,4 +1,4 @@
-import type { Series, TooltipConfig } from 'lib/hog-charts'
+import type { Series, TooltipConfig } from '@posthog/quill-charts'
import type { GoalLine as SchemaGoalLine } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/retention/shared/retentionChartTransforms.ts b/products/product_analytics/frontend/insights/retention/shared/retentionChartTransforms.ts
index 25382a6648dd..5523f6059db2 100644
--- a/products/product_analytics/frontend/insights/retention/shared/retentionChartTransforms.ts
+++ b/products/product_analytics/frontend/insights/retention/shared/retentionChartTransforms.ts
@@ -5,7 +5,8 @@ import type {
TimeSeriesLineChartConfig,
TooltipConfig,
TrendLineConfig,
-} from 'lib/hog-charts'
+} from '@posthog/quill-charts'
+
import type { RetentionTrendPayload } from 'scenes/retention/types'
import type { GoalLine as SchemaGoalLine } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.test.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.test.tsx
index 9b68d87633e6..b13e1fae5a7e 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.test.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.test.tsx
@@ -2,8 +2,9 @@ import '@testing-library/jest-dom'
import { cleanup, configure, screen, waitFor } from '@testing-library/react'
+import { setupJsdom, setupSyncRaf } from '@posthog/quill-charts/testing'
+
import { FEATURE_FLAGS } from 'lib/constants'
-import { setupJsdom, setupSyncRaf } from 'lib/hog-charts/testing'
import { NodeKind } from '~/queries/schema/schema-general'
import { buildStickinessQuery, chart, getHogChart, personsModal, renderInsight } from '~/test/insight-testing'
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx
index 2c9e5801364a..2e51b42d3d94 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx
@@ -1,9 +1,10 @@
import { useValues } from 'kea'
import { useCallback, useMemo } from 'react'
+import { TimeSeriesBarChart } from '@posthog/quill-charts'
+import type { PointClickData, Series, TimeSeriesBarChartConfig, TooltipContext } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { TimeSeriesBarChart } from 'lib/hog-charts'
-import type { PointClickData, Series, TimeSeriesBarChartConfig, TooltipContext } from 'lib/hog-charts'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
import { insightLogic } from 'scenes/insights/insightLogic'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/stickinessBarChartTransforms.test.ts b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/stickinessBarChartTransforms.test.ts
index fc34c94b793b..ec63257ffa36 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/stickinessBarChartTransforms.test.ts
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/stickinessBarChartTransforms.test.ts
@@ -1,4 +1,4 @@
-import type { TooltipConfig } from 'lib/hog-charts'
+import type { TooltipConfig } from '@posthog/quill-charts'
import { buildStickinessBarTimeSeriesConfig } from './stickinessBarChartTransforms'
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/stickinessBarChartTransforms.ts b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/stickinessBarChartTransforms.ts
index 0bdbd0d0c88d..824f7bab2136 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/stickinessBarChartTransforms.ts
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/stickinessBarChartTransforms.ts
@@ -1,4 +1,4 @@
-import type { TimeSeriesBarChartConfig, TooltipConfig } from 'lib/hog-charts'
+import type { TimeSeriesBarChartConfig, TooltipConfig } from '@posthog/quill-charts'
import {
buildStickinessSeries,
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx
index 320632e264cf..cd0e08050c70 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx
@@ -2,8 +2,9 @@ import '@testing-library/jest-dom'
import { cleanup, configure, screen, waitFor } from '@testing-library/react'
+import { setupJsdom, setupSyncRaf } from '@posthog/quill-charts/testing'
+
import { FEATURE_FLAGS } from 'lib/constants'
-import { setupJsdom, setupSyncRaf } from 'lib/hog-charts/testing'
import { NodeKind } from '~/queries/schema/schema-general'
import { buildStickinessQuery, chart, getHogChart, personsModal, renderInsight } from '~/test/insight-testing'
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx
index cbfa555d6e70..d304927252d6 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx
@@ -1,9 +1,10 @@
import { useValues } from 'kea'
import { useCallback, useMemo } from 'react'
+import { TimeSeriesLineChart } from '@posthog/quill-charts'
+import type { PointClickData, Series, TimeSeriesLineChartConfig, TooltipContext } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { TimeSeriesLineChart } from 'lib/hog-charts'
-import type { PointClickData, Series, TimeSeriesLineChartConfig, TooltipContext } from 'lib/hog-charts'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
import { insightLogic } from 'scenes/insights/insightLogic'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/stickinessChartTransforms.test.ts b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/stickinessChartTransforms.test.ts
index f38eaf52b53c..182594e036e2 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/stickinessChartTransforms.test.ts
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/stickinessChartTransforms.test.ts
@@ -1,5 +1,5 @@
-import { DEFAULT_Y_AXIS_ID } from 'lib/hog-charts'
-import type { TooltipConfig } from 'lib/hog-charts'
+import { DEFAULT_Y_AXIS_ID } from '@posthog/quill-charts'
+import type { TooltipConfig } from '@posthog/quill-charts'
import { ChartDisplayType } from '~/types'
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/stickinessChartTransforms.ts b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/stickinessChartTransforms.ts
index 9039bc1de31c..180284b554ed 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/stickinessChartTransforms.ts
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/stickinessChartTransforms.ts
@@ -1,5 +1,6 @@
-import { DEFAULT_Y_AXIS_ID } from 'lib/hog-charts'
-import type { Series, TimeSeriesLineChartConfig, TooltipConfig, YAxisConfig } from 'lib/hog-charts'
+import { DEFAULT_Y_AXIS_ID } from '@posthog/quill-charts'
+import type { Series, TimeSeriesLineChartConfig, TooltipConfig, YAxisConfig } from '@posthog/quill-charts'
+
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
import { ChartDisplayType } from '~/types'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.test.tsx b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.test.tsx
index 0ba509fabec7..a09f52cfb48b 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.test.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.test.tsx
@@ -2,8 +2,9 @@ import '@testing-library/jest-dom'
import { cleanup, fireEvent, screen, waitFor } from '@testing-library/react'
+import { dimensions, setupJsdom, setupSyncRaf } from '@posthog/quill-charts/testing'
+
import { FEATURE_FLAGS } from 'lib/constants'
-import { dimensions, setupJsdom, setupSyncRaf } from 'lib/hog-charts/testing'
import { NodeKind } from '~/queries/schema/schema-general'
import { buildTrendsQuery, chart, getHogChart, personsModal, renderInsight } from '~/test/insight-testing'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx
index 880cd43ca077..cefdbee97b8e 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx
@@ -1,17 +1,18 @@
import { useValues } from 'kea'
import { useCallback, useMemo } from 'react'
-import { buildTheme } from 'lib/charts/utils/theme'
import {
BarChart,
buildYTickFormatter,
DEFAULT_Y_AXIS_ID,
+ MAX_CATEGORY_LABEL_WIDTH,
ReferenceLines,
TimeSeriesBarChart,
ValueLabels,
-} from 'lib/hog-charts'
-import type { BarChartConfig, PointClickData, TimeSeriesBarChartConfig, TooltipContext } from 'lib/hog-charts'
-import { MAX_CATEGORY_LABEL_WIDTH } from 'lib/hog-charts/utils/text-measure'
+} from '@posthog/quill-charts'
+import type { BarChartConfig, PointClickData, TimeSeriesBarChartConfig, TooltipContext } from '@posthog/quill-charts'
+
+import { buildTheme } from 'lib/charts/utils/theme'
import { percentage } from 'lib/utils'
import { formatAggregationAxisValue } from 'scenes/insights/aggregationAxisFormat'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/trendsBarChartTransforms.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/trendsBarChartTransforms.ts
index 94ce97748582..299867eca248 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/trendsBarChartTransforms.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/trendsBarChartTransforms.ts
@@ -1,5 +1,6 @@
-import type { Series, TimeSeriesBarChartConfig } from 'lib/hog-charts'
-import { normalizeAxisLabel } from 'lib/hog-charts/utils/axis-labels'
+import { normalizeAxisLabel } from '@posthog/quill-charts'
+import type { Series, TimeSeriesBarChartConfig } from '@posthog/quill-charts'
+
import { hexToRGBA } from 'lib/utils'
import { COMPARE_PREVIOUS_DIM_OPACITY } from 'scenes/trends/viz/trendsAdapterConstants'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.test.tsx b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.test.tsx
index 1afdd1efcef9..4285081e7a54 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.test.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.test.tsx
@@ -2,8 +2,9 @@ import '@testing-library/jest-dom'
import { cleanup, screen, waitFor } from '@testing-library/react'
+import { setupJsdom, setupSyncRaf } from '@posthog/quill-charts/testing'
+
import { FEATURE_FLAGS } from 'lib/constants'
-import { setupJsdom, setupSyncRaf } from 'lib/hog-charts/testing'
import { LifecycleQuery, LifecycleQueryResponse, NodeKind } from '~/queries/schema/schema-general'
import { chart, type InsightQuery, type MockResponse, personsModal, renderInsight } from '~/test/insight-testing'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx
index 36175d139cfa..3aa8c457d9ee 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx
@@ -1,9 +1,10 @@
import { useValues } from 'kea'
import { useCallback, useMemo } from 'react'
+import { ChartLegend, TimeSeriesBarChart, legendItemsFromSeries } from '@posthog/quill-charts'
+import type { PointClickData, TimeSeriesBarChartConfig, TooltipContext } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { ChartLegend, TimeSeriesBarChart, legendItemsFromSeries } from 'lib/hog-charts'
-import type { PointClickData, TimeSeriesBarChartConfig, TooltipContext } from 'lib/hog-charts'
import { formatAggregationAxisValue } from 'scenes/insights/aggregationAxisFormat'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
import { insightLogic } from 'scenes/insights/insightLogic'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/trendsLifecycleChartTransforms.ts b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/trendsLifecycleChartTransforms.ts
index c18062525fb1..c28f125c23b8 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/trendsLifecycleChartTransforms.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/trendsLifecycleChartTransforms.ts
@@ -1,5 +1,6 @@
+import type { Series, TimeSeriesBarChartConfig } from '@posthog/quill-charts'
+
import { getBarColorFromStatus } from 'lib/colors'
-import type { Series, TimeSeriesBarChartConfig } from 'lib/hog-charts'
import { capitalizeFirstLetter } from 'lib/utils'
import type { CurrencyCode, TrendsFilter } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
index fc1a14a46bbc..2ec12fdcfe68 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
@@ -2,8 +2,9 @@ import '@testing-library/jest-dom'
import { cleanup, configure, fireEvent, screen, waitFor } from '@testing-library/react'
+import { setupJsdom, setupSyncRaf } from '@posthog/quill-charts/testing'
+
import { FEATURE_FLAGS } from 'lib/constants'
-import { setupJsdom, setupSyncRaf } from 'lib/hog-charts/testing'
import { NodeKind } from '~/queries/schema/schema-general'
import {
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx
index 3861f2ac8e05..de5e1493278a 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx
@@ -1,9 +1,16 @@
import { useValues } from 'kea'
import { useCallback, useMemo } from 'react'
+import { DEFAULT_Y_AXIS_ID, TimeSeriesLineChart } from '@posthog/quill-charts'
+import type {
+ PointClickData,
+ Series,
+ TimeSeriesLineChartConfig,
+ TooltipConfig,
+ TooltipContext,
+} from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { DEFAULT_Y_AXIS_ID, TimeSeriesLineChart } from 'lib/hog-charts'
-import type { PointClickData, Series, TimeSeriesLineChartConfig, TooltipConfig, TooltipContext } from 'lib/hog-charts'
import { percentage } from 'lib/utils'
import { formatAggregationAxisValue } from 'scenes/insights/aggregationAxisFormat'
import { InsightEmptyState } from 'scenes/insights/EmptyStates'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.test.ts b/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.test.ts
index b8e2d987ef13..ae2ef7319d07 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.test.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.test.ts
@@ -1,5 +1,5 @@
-import { DEFAULT_Y_AXIS_ID } from 'lib/hog-charts'
-import type { TooltipConfig } from 'lib/hog-charts'
+import { DEFAULT_Y_AXIS_ID } from '@posthog/quill-charts'
+import type { TooltipConfig } from '@posthog/quill-charts'
import type { GoalLine as SchemaGoalLine } from '~/queries/schema/schema-general'
import { ChartDisplayType } from '~/types'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.ts b/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.ts
index 20732c1bccba..02749e76e31a 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.ts
@@ -1,4 +1,4 @@
-import { DEFAULT_Y_AXIS_ID, movingAverageKey } from 'lib/hog-charts'
+import { DEFAULT_Y_AXIS_ID, movingAverageKey, normalizeAxisLabel } from '@posthog/quill-charts'
import type {
ConfidenceIntervalConfig,
MovingAverageConfig,
@@ -6,8 +6,8 @@ import type {
TimeSeriesLineChartConfig,
TooltipConfig,
TrendLineConfig,
-} from 'lib/hog-charts'
-import { normalizeAxisLabel } from 'lib/hog-charts/utils/axis-labels'
+} from '@posthog/quill-charts'
+
import { ciRanges } from 'lib/statistics'
import type { CurrencyCode, GoalLine as SchemaGoalLine, TrendsFilter } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx
index 27666f50ad5f..40a0b53fb2e4 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx
@@ -2,9 +2,10 @@ import { useValues } from 'kea'
import posthog from 'posthog-js'
import { useCallback, useMemo, type ErrorInfo } from 'react'
+import { PieChart } from '@posthog/quill-charts'
+import type { PieChartConfig, RadialSlicePayload, Series, TooltipContext } from '@posthog/quill-charts'
+
import { buildTheme } from 'lib/charts/utils/theme'
-import { PieChart } from 'lib/hog-charts'
-import type { PieChartConfig, RadialSlicePayload, Series, TooltipContext } from 'lib/hog-charts'
import {
formatAggregationAxisValue,
formatAggregationAxisValueWithShareOfTotal,
diff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.ts b/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.ts
index f3eba6d35ada..a521f716b34e 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.ts
@@ -1,4 +1,5 @@
-import type { Series } from 'lib/hog-charts'
+import type { Series } from '@posthog/quill-charts'
+
import type { IndexedTrendResult } from 'scenes/trends/types'
import type { TrendsSeriesMeta } from '../shared/trendsSeriesMeta'
diff --git a/products/product_analytics/frontend/insights/trends/shared/AnnotationsLayer.tsx b/products/product_analytics/frontend/insights/trends/shared/AnnotationsLayer.tsx
index 6a9541b6b611..178a6852717f 100644
--- a/products/product_analytics/frontend/insights/trends/shared/AnnotationsLayer.tsx
+++ b/products/product_analytics/frontend/insights/trends/shared/AnnotationsLayer.tsx
@@ -1,8 +1,9 @@
import React, { useMemo } from 'react'
+import { computeVisibleXLabels, useChartLayout } from '@posthog/quill-charts'
+
import { Chart } from 'lib/Chart'
import { AnnotationsOverlay } from 'lib/components/AnnotationsOverlay'
-import { computeVisibleXLabels, useChartLayout } from 'lib/hog-charts'
interface AnnotationsLayerProps {
/** Numeric insight id used by the annotations logic. Pass `'new'` for unsaved insights. */
diff --git a/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx b/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx
index 285ba9fbf6eb..bb5ab5e9ab75 100644
--- a/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx
+++ b/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx
@@ -1,8 +1,9 @@
import { useValues } from 'kea'
import React, { useMemo } from 'react'
+import { AnomalyPointsLayer, ReferenceLines } from '@posthog/quill-charts'
+
import { insightAlertsLogic } from 'lib/components/Alerts/insightAlertsLogic'
-import { AnomalyPointsLayer, ReferenceLines } from 'lib/hog-charts'
import type { IndexedTrendResult } from 'scenes/trends/types'
import type { InsightLogicProps } from '~/types'
diff --git a/products/product_analytics/frontend/insights/trends/shared/TrendsTooltip.tsx b/products/product_analytics/frontend/insights/trends/shared/TrendsTooltip.tsx
index 81019d11c8ab..cdef5196edd4 100644
--- a/products/product_analytics/frontend/insights/trends/shared/TrendsTooltip.tsx
+++ b/products/product_analytics/frontend/insights/trends/shared/TrendsTooltip.tsx
@@ -1,7 +1,8 @@
import { useCallback, useMemo } from 'react'
+import type { TooltipContext } from '@posthog/quill-charts'
+
import { SeriesLetter } from 'lib/components/SeriesGlyph'
-import type { TooltipContext } from 'lib/hog-charts'
import { percentage } from 'lib/utils'
import { formatAggregationAxisValue } from 'scenes/insights/aggregationAxisFormat'
import { InsightTooltip } from 'scenes/insights/InsightTooltip/InsightTooltip'
diff --git a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts
index 6f532328e667..875dabf2a10d 100644
--- a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts
+++ b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts
@@ -1,5 +1,6 @@
+import type { AnomalyMarker as BaseAnomalyMarker } from '@posthog/quill-charts'
+
import type { AnomalyPoint } from 'lib/components/Alerts/types'
-import type { AnomalyMarker as BaseAnomalyMarker } from 'lib/hog-charts'
import type { IndexedTrendResult } from 'scenes/trends/types'
export interface AnomalyMarker extends BaseAnomalyMarker {
diff --git a/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.test.ts b/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.test.ts
index 7a7e93aff4af..9a9f46ee1f3a 100644
--- a/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.test.ts
+++ b/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.test.ts
@@ -1,5 +1,5 @@
-import { computeSeriesNonZeroMax } from 'lib/hog-charts'
-import type { Series } from 'lib/hog-charts'
+import { computeSeriesNonZeroMax } from '@posthog/quill-charts'
+import type { Series } from '@posthog/quill-charts'
import type { GoalLine as SchemaGoalLine } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.ts b/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.ts
index 116be2e7529a..e0480e892bcf 100644
--- a/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.ts
+++ b/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.ts
@@ -1,5 +1,5 @@
-import { buildGoalLineReferenceLines } from 'lib/hog-charts'
-import type { GoalLineConfig, ReferenceLineProps, Series } from 'lib/hog-charts'
+import { buildGoalLineReferenceLines } from '@posthog/quill-charts'
+import type { GoalLineConfig, ReferenceLineProps, Series } from '@posthog/quill-charts'
import type { GoalLine as SchemaGoalLine } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.test.ts b/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.test.ts
index 87b83b0641b5..498afdc7c2ea 100644
--- a/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.test.ts
+++ b/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.test.ts
@@ -1,4 +1,5 @@
-import { buildYTickFormatter } from 'lib/hog-charts'
+import { buildYTickFormatter } from '@posthog/quill-charts'
+
import { AggregationAxisFormat } from 'scenes/insights/aggregationAxisFormat'
import { CurrencyCode, TrendsFilter } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.ts b/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.ts
index f4088c0b4cb3..626d302aa834 100644
--- a/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.ts
+++ b/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.ts
@@ -1,4 +1,4 @@
-import type { YAxisConfig, YFormatterConfig } from 'lib/hog-charts'
+import type { YAxisConfig, YFormatterConfig } from '@posthog/quill-charts'
import { CurrencyCode, TrendsFilter } from '~/queries/schema/schema-general'
diff --git a/products/product_analytics/package.json b/products/product_analytics/package.json
index 1e2611521bc6..d82a3af0e6d3 100644
--- a/products/product_analytics/package.json
+++ b/products/product_analytics/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
"kea-router": "catalog:",
diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx
index 6f11908a978e..337c146557c5 100644
--- a/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx
@@ -2,9 +2,9 @@ import { useValues } from 'kea'
import { useMemo } from 'react'
import { LemonTag } from '@posthog/lemon-ui'
+import { BarChart } from '@posthog/quill-charts'
import { buildTheme } from 'lib/charts/utils/theme'
-import { BarChart } from 'lib/hog-charts'
import { LemonProgress } from 'lib/lemon-ui/LemonProgress'
import { replayScannerLogic } from '../replayScannerLogic'
diff --git a/products/replay_vision/package.json b/products/replay_vision/package.json
index b899031bc1e6..5b735d041c58 100644
--- a/products/replay_vision/package.json
+++ b/products/replay_vision/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/tests -v --tb=short"
},
"dependencies": {
+ "@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/tsconfig.json b/tsconfig.json
index fc84beafc233..a5ca2e71f189 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -16,6 +16,8 @@
"@posthog/mcp-ui/*": ["./services/mcp/src/ui-apps/lib/*"],
"@posthog/replay-shared": ["./common/replay-shared/src/index.ts"],
"@posthog/replay-shared/*": ["./common/replay-shared/src/*"],
+ "@posthog/quill-charts": ["./packages/quill/packages/charts/src/index.ts"],
+ "@posthog/quill-charts/*": ["./packages/quill/packages/charts/src/*"],
// Needed to access the subpath since torph didn't set up types properly
"torph/react": ["./frontend/node_modules/torph/dist/react/index"],
// [email protected] only exposes types under `node`/`browser` conditions,
@@ -58,7 +60,8 @@
"common/esbuilder/*",
"common/replay-shared/src/**/*",
"common/storybook/*",
- "docs/onboarding/**/*"
+ "docs/onboarding/**/*",
+ "packages/quill/packages/charts/src/**/*"
],
"exclude": ["frontend/dist/**/*", "**/*.mdx"],
"ts-node": {