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.

fix(quill-charts): chart defaults that read well without tuning (#120494)

Sam Pennington50ba67725d7e
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index c921cfc9bc4f..956b0104f35b 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -192,6 +192,10 @@ snapshots:
hash: v1.k794b7964.753de81720b4496f631f3947e7b1df6e5fdc75d819a5d564a1bd03b304e886f8.u9drGvsNdBGawHS3L5p2aJwOGsBOqWLHEa3itmFFwqM
ai-observability-scorers--offline-disabled--light:
hash: v1.k794b7964.61fbfcd2fefffbd0fce01f693e9463fc690e4f0f69bd9308eafc06de07591cfe.-isZUttu_1l77UgFFJOZVuz96QiwJ-vUlgsyPWzmk5s
+ charts-heatmap--activity-by-day-and-hour--dark:
+ hash: v1.k794b7964.cb3a745c072482c2b24a91879fea9a6f72d195ac683a38efc3f222d944828b9e.jlohG3R6gpgos058qmytizuCZtVRjXramep8NJDaIQE
+ charts-heatmap--activity-by-day-and-hour--light:
+ hash: v1.k794b7964.f5929cb9b961c3c51a7e53079cc885c06f82755f5c3203943602170194159ef3.qMaDD1BP81iZNbZHdeedj2XwMYpGIxvfqyFCXglMjoI
charts-heatmap--cell-labels--dark:
hash: v1.k794b7964.19b11a43aa9280e0b85498c1e87397d128cb1a1c9f1451419ab32de324783441.xEjoCIC6MhETYkz5iStffBD3Oc77sUugobUIKzq3EME
charts-heatmap--cell-labels--light:
@@ -1205,7 +1209,7 @@ snapshots:
components-hogcharts-legend--vertical--light:
hash: v1.k794b7964.2a05ac06ff596da5774c5e6ec7bb6029d634db4ecaf315628600c60819787c28.u8q-wm5x1b_jgTZO6XvOCYOZqyG18Gc5u3U8OkXo8EA
components-hogcharts-linechart--combined-overlays--dark:
- hash: v1.k794b7964.ff9d4456effb4eebdd9d60878b060633ae58ed58b558b5d0d5e405241c28606b.RTMz-PJjROcV40uqo2C8tcFS8Bti8amLf9T0vZtYUDc
+ hash: v1.k794b7964.0386a9e76a449e81d66bcc6b77c19b1458f60a30b0d74c8bf70dcbc960e180e5.mukcrcAB56AeKFDhrAUyL-xcIKQNNtwiCcE4OY9Ja1w
components-hogcharts-linechart--combined-overlays--light:
hash: v1.k794b7964.0a00a06868199a28a3b61e75893cfa7847638084dae28fc246d55f584a041eb1.Q7DjiihtV5rDjY5m-Mv6lLWFEki5oZXiEA6PTB0ifeY
components-hogcharts-linechart--confidence-band-below-zero--dark:
@@ -1305,9 +1309,9 @@ snapshots:
components-hogcharts-metriccard--resting-summary--light:
hash: v1.k794b7964.58f0cbd9ef14a9118fa901cbeaa4740fe05e924711f3330fab90b119249fcd22.deCV_bqNEdk9lNkBTqHHyBrKqG-nhIheRHLBz-0iiEE
components-hogcharts-piechart--donut--dark:
- hash: v1.k794b7964.8a38011ff6bb29dc84ce0d4c91deca6f68c76f61610576d3b5d10c19db017f5b.4uN_EDhdfT9wgqV1DE3TaQiBh6T5tlzKKrkTDrmolwk
+ hash: v1.k794b7964.2260392123476646b81a9fc7de71c0ef351797ee389c4111a08a36a86f5b441f.b2RKzR6Ss820XshiC4FpMg4aI4CODwPzws6EjxrWypA
components-hogcharts-piechart--donut--light:
- hash: v1.k794b7964.6a26918a450a19a33cd618599f696e187f474d72ff3334579fa976d4fa4b26d2.TfbPXMOKZBM6Qklg0qPur8LVTE2aCURZlhjBG8Z2CEs
+ hash: v1.k794b7964.ff72943780e259b38034e20da87864ff903b24f645cc2d7dff3325a33bfb08c4.l0P3jUXXGD9KpVZ5ZScV_C1N8m2erkQ5kFwHSdPA2iA
components-hogcharts-piechart--labels-toward-rim--dark:
hash: v1.k794b7964.e9c90cb2ba3eb12f4d38f23f4b1993d58e80e6ac9ef3b1592127be34b7b468f1.wq5lwfS8cAVj0UHQZDTJ5DziOQ_w8XvNGXzEYpfRkwk
components-hogcharts-piechart--labels-toward-rim--light:
@@ -1365,7 +1369,7 @@ snapshots:
components-hogcharts-referenceline--horizontal-goal--light:
hash: v1.k794b7964.e373c110db9e4b427cf77b6892fe4a85fa9191882ea0e7e985fe819b6338f26b.TcKFdU2WCO_uxvffF3CkkAegU13ZXZTGAj9aQt2g0FE
components-hogcharts-referenceline--horizontal-variants--dark:
- hash: v1.k794b7964.6a014310bc094e4613fa96b0be2111aa396c1299d2e97b1782f4d2b37fed568a.uuVFab4_D6mifN-1eKZ4reRnnhlHUbzpifw7y8z7hxA
+ hash: v1.k794b7964.83b15b3eaf6a3f17b0e1322f9a80b4d5b9603d4afdd329f6a9fb03d9d59d6ab7.5G0UeaHWwWam05N-rvG5vqXzlQ7slO2I9JIEnbsxl_c
components-hogcharts-referenceline--horizontal-variants--light:
hash: v1.k794b7964.a9a0445443c8e947c726655e69e74971194d62b1b399918a75fc18bf67758df4.FlA8Shp0BR5D62LvBiCSpc9Ww7AqvooyV9lLcF5NiW8
components-hogcharts-referenceline--label-start-vs-end--dark:
@@ -1373,7 +1377,7 @@ snapshots:
components-hogcharts-referenceline--label-start-vs-end--light:
hash: v1.k794b7964.551359c1cc60520de36398d4e2b11f96938e762c996fc4e8c4f1483011e84eb2.kcuCnRwpO6GAeCj4Je93i7xUIICAFJvksdfvfNy0UV4
components-hogcharts-referenceline--vertical-reference-lines--dark:
- hash: v1.k794b7964.90f41505842c3268601f173b9d85028dab712fa122031b051841415a8a7d7e08.FAGdDCDa0tUWt1MfFndb3AQLXC-HYdvjswqdMjsScg4
+ hash: v1.k794b7964.cdd53cc0a95603d50ce17c217d5527c61eb2f83038fecc22f2dfa736f68dbdf9.2UsEtOvkXDHyx0u13onAtWwvq32MHNBaKkDdmMLt4Dw
components-hogcharts-referenceline--vertical-reference-lines--light:
hash: v1.k794b7964.8c1fc71a5ffcbaa12a7791e7ad87dcea89c0457e2857f843b79783da11007914.2p-22fgdNU0AwZkOXoLfjcTu9RHVrQQU5m9dnao2Tms
components-hogcharts-slopechart--colliding-labels--dark:
diff --git a/packages/quill/packages/charts/src/charts/Heatmap/Heatmap.stories.tsx b/packages/quill/packages/charts/src/charts/Heatmap/Heatmap.stories.tsx
index f16172080fec..77c1445f2ad2 100644
--- a/packages/quill/packages/charts/src/charts/Heatmap/Heatmap.stories.tsx
+++ b/packages/quill/packages/charts/src/charts/Heatmap/Heatmap.stories.tsx
@@ -60,6 +60,31 @@ export const LatencyOverTime: Story = {
},
}
+const WEEKDAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+const HOURS = Array.from({ length: 24 }, (_, h) => `${String(h).padStart(2, '0')}:00`)
+const ACTIVITY = WEEKDAYS.map((_, day) =>
+ HOURS.map((_, hour) =>
+ Math.round(80 + 140 * Math.max(0, Math.sin(((hour - 6) / 24) * Math.PI * 2)) + (day < 5 ? 60 : 0))
+ )
+)
+
+export const ActivityByDayAndHour: Story = {
+ render: function Render() {
+ const theme = useReactiveTheme()
+ return (
+ <Stage width={720} height={260}>
+ <Heatmap
+ xLabels={HOURS}
+ yLabels={WEEKDAYS}
+ cells={ACTIVITY}
+ theme={theme}
+ config={{ xTickFormatter: (label, i) => (i % 3 === 0 ? label : null) }}
+ />
+ </Stage>
+ )
+ },
+}
+
export const LinearColorScale: Story = {
render: function Render() {
const theme = useReactiveTheme()
diff --git a/packages/quill/packages/charts/src/charts/Heatmap/Heatmap.tsx b/packages/quill/packages/charts/src/charts/Heatmap/Heatmap.tsx
index d78ed07dac0d..83424875e2d6 100644
--- a/packages/quill/packages/charts/src/charts/Heatmap/Heatmap.tsx
+++ b/packages/quill/packages/charts/src/charts/Heatmap/Heatmap.tsx
@@ -26,10 +26,12 @@ import {
createCellColorRamp,
maxCellValue,
normalizeCount,
+ resolveColorScale,
rowAtY,
rowAtYClamped,
type HeatmapColorScale,
type HeatmapLayout,
+ type ResolvedHeatmapColorScale,
} from './heatmap-layout'
import { HeatmapCellLabels, type HeatmapCellLabelFormatter } from './HeatmapCellLabels'
@@ -53,14 +55,14 @@ interface HeatmapPrivate {
cells: number[][]
accent: string
maxValue: number
- colorScale: HeatmapColorScale
+ colorScale: ResolvedHeatmapColorScale
}
}
export interface HeatmapConfig {
/** Custom x-axis tick label formatter. Return null to skip a tick. Called with (label, index). */
xTickFormatter?: (label: string, index: number) => string | null
- /** How counts map to color intensity. Defaults to 'log' — right for long-tailed count grids. */
+ /** How counts map to color intensity. Defaults to 'auto', which picks 'log' or 'linear' from the data. */
colorScale?: HeatmapColorScale
/** Accent color for the density ramp (hex, rgb, or var(--…)). Defaults to the first theme
* palette color. */
@@ -158,7 +160,7 @@ function HeatmapInner({
dataAttr,
children,
}: Omit<HeatmapProps, 'onError'>): React.ReactElement {
- const { colorScale = 'log' } = config ?? {}
+ const { colorScale: requestedColorScale = 'auto' } = config ?? {}
// Resolve a `var(--…)` accent to a concrete color — canvas `fillStyle` (and `dimColor`'s
// d3 parse) can't handle CSS variables, so an unresolved var would blank out every cell.
// theme.colors are already resolved, so the memo re-runs (and re-resolves the accent against
@@ -180,6 +182,7 @@ function HeatmapInner({
const columnKeys = useMemo<string[]>(() => xLabels.map((_, i) => `${i}`), [xLabels])
const resolveColumnLabel = useCallback((key: string): string => xLabels[Number(key)] ?? key, [xLabels])
const maxValue = useMemo(() => maxCellValue(grid), [grid])
+ const colorScale = useMemo(() => resolveColorScale(grid, requestedColorScale), [grid, requestedColorScale])
// One adapter series per row: `data` is that row's counts (tooltip values), `meta.rowIndex`
// maps back to the grid. All rows share the accent so tooltip swatches stay consistent.
diff --git a/packages/quill/packages/charts/src/charts/Heatmap/HeatmapCellLabels.tsx b/packages/quill/packages/charts/src/charts/Heatmap/HeatmapCellLabels.tsx
index e3555021d3f5..9a0dcedec8f9 100644
--- a/packages/quill/packages/charts/src/charts/Heatmap/HeatmapCellLabels.tsx
+++ b/packages/quill/packages/charts/src/charts/Heatmap/HeatmapCellLabels.tsx
@@ -4,7 +4,13 @@ import { useChartLayout } from '../../core/chart-context'
import { mixColors, perceivedLuminance, toSrgbColor } from '../../core/color-utils'
import { FONT_FAMILY, measureLabelWidth } from '../../utils/text-measure'
import type { HeatmapCellDatum } from './Heatmap'
-import { cellAlpha, cellRect, computeHeatmapLayout, normalizeCount, type HeatmapColorScale } from './heatmap-layout'
+import {
+ cellAlpha,
+ cellRect,
+ computeHeatmapLayout,
+ normalizeCount,
+ type ResolvedHeatmapColorScale,
+} from './heatmap-layout'
/** Returning null or an empty string leaves the cell unlabelled. */
export type HeatmapCellLabelFormatter = (cell: HeatmapCellDatum) => string | null
@@ -46,7 +52,7 @@ export interface HeatmapCellLabelsProps {
cells: number[][]
accent: string
maxValue: number
- colorScale: HeatmapColorScale
+ colorScale: ResolvedHeatmapColorScale
formatter: HeatmapCellLabelFormatter
}
diff --git a/packages/quill/packages/charts/src/charts/Heatmap/heatmap-layout.test.ts b/packages/quill/packages/charts/src/charts/Heatmap/heatmap-layout.test.ts
index ee78b632efd3..ebcacf488b80 100644
--- a/packages/quill/packages/charts/src/charts/Heatmap/heatmap-layout.test.ts
+++ b/packages/quill/packages/charts/src/charts/Heatmap/heatmap-layout.test.ts
@@ -1,5 +1,12 @@
import type { ChartDimensions } from '../../core/types'
-import { cellRect, computeHeatmapLayout, maxCellValue, normalizeCount, rowAtY } from './heatmap-layout'
+import {
+ cellRect,
+ computeHeatmapLayout,
+ maxCellValue,
+ normalizeCount,
+ resolveColorScale,
+ rowAtY,
+} from './heatmap-layout'
const DIMENSIONS: ChartDimensions = {
width: 500,
@@ -33,11 +40,53 @@ describe('heatmap-layout', () => {
expect(normalizeCount(count, max, scale)).toBeCloseTo(expected)
})
+ it.each([
+ [
+ 'auto picks log for a long-tailed grid',
+ [
+ [1, 2, 1, 500],
+ [3, 1, 2, 800],
+ ],
+ 'auto',
+ 'log',
+ ],
+ [
+ 'auto picks linear for an even grid',
+ [
+ [76, 169, 335],
+ [150, 200, 120],
+ ],
+ 'auto',
+ 'linear',
+ ],
+ [
+ 'an explicit scale wins over the data',
+ [
+ [1, 2, 1, 500],
+ [3, 1, 2, 800],
+ ],
+ 'linear',
+ 'linear',
+ ],
+ ] as const)('resolveColorScale: %s', (_name, cells, scale, expected) => {
+ expect(
+ resolveColorScale(
+ cells.map((row) => [...row]),
+ scale
+ )
+ ).toBe(expected)
+ })
+
it('log normalization lifts small counts above linear so the long tail stays visible', () => {
expect(normalizeCount(2, 1000, 'log')).toBeGreaterThan(normalizeCount(2, 1000, 'linear'))
})
it('maxCellValue ignores non-finite values', () => {
- expect(maxCellValue([[1, Number.NaN], [Number.POSITIVE_INFINITY, 7]])).toBe(7)
+ expect(
+ maxCellValue([
+ [1, Number.NaN],
+ [Number.POSITIVE_INFINITY, 7],
+ ])
+ ).toBe(7)
})
})
diff --git a/packages/quill/packages/charts/src/charts/Heatmap/heatmap-layout.ts b/packages/quill/packages/charts/src/charts/Heatmap/heatmap-layout.ts
index 4a31121f3466..d80f2a818dee 100644
--- a/packages/quill/packages/charts/src/charts/Heatmap/heatmap-layout.ts
+++ b/packages/quill/packages/charts/src/charts/Heatmap/heatmap-layout.ts
@@ -1,9 +1,28 @@
import { dimColor } from '../../core/color-utils'
import type { ChartDimensions } from '../../core/types'
-/** How cell counts map to color intensity. `log` (default) uses log1p normalization —
- * latency/count grids are long-tailed, and a linear ramp washes out everything but the mode. */
-export type HeatmapColorScale = 'log' | 'linear'
+/** How cell counts map to color intensity: `log` (log1p) for a long-tailed grid such as latency, `linear` for an
+ * even grid such as activity by day and hour, and `auto` (default) to pick one from the data. */
+export type HeatmapColorScale = 'auto' | 'log' | 'linear'
+export type ResolvedHeatmapColorScale = Exclude<HeatmapColorScale, 'auto'>
+
+// `auto` picks log when the median non-empty cell is under this share of the largest, because a linear ramp would then put most cells in its bottom tenth.
+const LONG_TAIL_MEDIAN_RATIO = 0.1
+
+export function resolveColorScale(cells: number[][], scale: HeatmapColorScale): ResolvedHeatmapColorScale {
+ if (scale !== 'auto') {
+ return scale
+ }
+ const values = cells
+ .flat()
+ .filter((value) => Number.isFinite(value) && value > 0)
+ .sort((a, b) => a - b)
+ if (values.length === 0) {
+ return 'log'
+ }
+ const median = values[Math.floor(values.length / 2)]
+ return median < values[values.length - 1] * LONG_TAIL_MEDIAN_RATIO ? 'log' : 'linear'
+}
/** Uniform grid layout of the heatmap plot area. Rows index bottom-to-top: row 0 is the
* bottom row, matching an ascending value axis (smallest bucket at the bottom). */
@@ -85,7 +104,7 @@ export function maxCellValue(cells: number[][]): number {
/** Normalize a count to [0, 1] against the grid maximum. Zero/absent counts and an
* all-zero grid map to 0 — callers skip drawing those cells entirely. */
-export function normalizeCount(count: number, max: number, scale: HeatmapColorScale): number {
+export function normalizeCount(count: number, max: number, scale: ResolvedHeatmapColorScale): number {
if (!(max > 0) || !(count > 0)) {
return 0
}
diff --git a/packages/quill/packages/charts/src/charts/PieChart/PieChart.test.tsx b/packages/quill/packages/charts/src/charts/PieChart/PieChart.test.tsx
index 34aeba306b63..76ed789762db 100644
--- a/packages/quill/packages/charts/src/charts/PieChart/PieChart.test.tsx
+++ b/packages/quill/packages/charts/src/charts/PieChart/PieChart.test.tsx
@@ -81,11 +81,13 @@ describe('PieChart', () => {
expect(sliceLabels(chart.element).join('|')).toContain('50 (50%)')
})
- it('suppresses on-slice value labels when showValueOnSlice is false', () => {
- const { chart } = renderHogChart(
- <PieChart series={SERIES} theme={THEME} config={{ showValueOnSlice: false }} />
- )
- expect(sliceLabels(chart.element)).toHaveLength(0)
+ it.each([
+ ['hidden when showValueOnSlice is false', { showValueOnSlice: false }, false],
+ ['hidden on a donut by default', { innerRadiusRatio: 0.5 }, false],
+ ['shown on a donut that sets showValueOnSlice', { innerRadiusRatio: 0.5, showValueOnSlice: true }, true],
+ ])('on-slice value labels are %s', (_name, config, shown) => {
+ const { chart } = renderHogChart(<PieChart series={SERIES} theme={THEME} config={config} />)
+ expect(sliceLabels(chart.element).length > 0).toBe(shown)
})
it('renders a center label for a donut', () => {
diff --git a/packages/quill/packages/charts/src/charts/PieChart/PieChart.tsx b/packages/quill/packages/charts/src/charts/PieChart/PieChart.tsx
index 1ac442329278..cd10f99fcbba 100644
--- a/packages/quill/packages/charts/src/charts/PieChart/PieChart.tsx
+++ b/packages/quill/packages/charts/src/charts/PieChart/PieChart.tsx
@@ -25,7 +25,7 @@ import type { SliceValueDisplay } from './SliceLabels'
export interface PieChartConfig<Meta = unknown> {
/** 0 = pie (default), 0.5 = donut. Clamped to [0, 0.95]. */
innerRadiusRatio?: number
- /** Show the slice value above the slice (per Chart.js parity). Default true. */
+ /** Show the slice value above the slice. Default true for a pie, false for a donut, whose `centerLabel` carries the number. */
showValueOnSlice?: boolean
/** Show the breakdown label above the slice. Default false. */
showLabelOnSlice?: boolean
@@ -148,7 +148,7 @@ function PieChartInner<Meta = unknown>({
}: Omit<PieChartProps<Meta>, 'onError'>): React.ReactElement {
const {
innerRadiusRatio = 0,
- showValueOnSlice = true,
+ showValueOnSlice = !(innerRadiusRatio > 0),
showLabelOnSlice = false,
sliceValueDisplay,
isPercent = false,
diff --git a/packages/quill/packages/charts/src/docs/chart-types.md b/packages/quill/packages/charts/src/docs/chart-types.md
index 9ebdbf79c754..79c3fce2d3d2 100644
--- a/packages/quill/packages/charts/src/docs/chart-types.md
+++ b/packages/quill/packages/charts/src/docs/chart-types.md
@@ -56,6 +56,7 @@ One line per series from a left "before" to a right "after"; `data` is `[start,
Part of whole, one value per series (`data[0]`).
- `innerRadiusRatio` makes a donut; `centerLabel` fills the hole.
+- A donut hides on-slice values by default, because `centerLabel` carries its number. Set `showValueOnSlice: true` to show them.
- On-slice labels via `showLabelOnSlice` and `showValueOnSlice`, positioned with `labelRadiusRatio` (0 is the center, 1 the rim) and gated by `minSlicePercentForLabel`.
- `sliceValueDisplay` picks what the numeric line holds: `'value'`, `'percent'`, or `'both'` for `352 (18.4%)`. Defaults to `'percent'` when `isPercent` is set, else `'value'`.
- `config.legend` renders the built-in legend; a toggled-off slice is removed and the rest rescale to the full circle.
@@ -102,7 +103,8 @@ The tooltip receives a `BoxPlotTooltipContext`; `BoxPlotTooltip` is the default.
## Heatmap
A 2D density grid: `xLabels` by `yLabels` (row 0 at the bottom), `cells[row][col]` counts mapped to color intensity on one accent.
-Log ramp by default; `colorScale: 'linear'` to opt out.
+`colorScale: 'auto'` (default) uses a log ramp for a long-tailed grid such as latency, where the median non-empty cell is under a tenth of the largest, and a linear ramp otherwise, so an even grid such as activity by day and hour does not flatten into one shade.
+Pass `'log'` or `'linear'` to fix the ramp.
A single-cell tooltip resolves from the cursor, `onCellClick` reports `{ xIndex, yIndex, value }`, and `onBrush` reports row and column index ranges.
`config.cellLabel` prints a number in each cell, for a grid read as values rather than only as density (a retention table).
It runs for every cell, empty ones included; return null to leave one blank.
diff --git a/packages/quill/packages/charts/src/docs/overlays.md b/packages/quill/packages/charts/src/docs/overlays.md
index e3be01a44e58..d77ee549c71d 100644
--- a/packages/quill/packages/charts/src/docs/overlays.md
+++ b/packages/quill/packages/charts/src/docs/overlays.md
@@ -19,7 +19,7 @@ Prop docs live on each component's props interface under `overlays/`.
### `ReferenceLine` / `ReferenceLines`
-Variants: `goal` (dashed grey), `alert` (dashed red), `marker` (solid thin).
+Variants: `goal` (dashed grey), `alert` (dashed red), `marker` (thin dashed, in the axis label color so it follows light and dark).
A numeric line reveals its value on hover of the line itself (via a wider invisible hit area) or of its label, appended as `label: value` when it has a label and shown alone when it does not.
`showValueOnHover: false` turns that off and removes the hit area, for a line whose caption already states the number or that should not react to the pointer.
A vertical line resolves x through `scales.x(label)`, so it can only sit on a label.
diff --git a/packages/quill/packages/charts/src/overlays/ReferenceLine.test.tsx b/packages/quill/packages/charts/src/overlays/ReferenceLine.test.tsx
index c671beb52633..9e7101ebad24 100644
--- a/packages/quill/packages/charts/src/overlays/ReferenceLine.test.tsx
+++ b/packages/quill/packages/charts/src/overlays/ReferenceLine.test.tsx
@@ -252,7 +252,7 @@ describe('ReferenceLine', () => {
it.each([
['goal (default)', undefined, 'dashed', '2px'],
['alert', 'alert' as const, 'dashed', '2px'],
- ['marker', 'marker' as const, 'solid', '1px'],
+ ['marker', 'marker' as const, 'dashed', '1px'],
])('variant %s renders expected stroke style', (_name, variant, expectedStyle, expectedWidth) => {
const { container } = renderInChart(<ReferenceLine value={50} variant={variant} />)
const line = lineDiv(container, 'top')!
diff --git a/packages/quill/packages/charts/src/overlays/ReferenceLine.tsx b/packages/quill/packages/charts/src/overlays/ReferenceLine.tsx
index 6ae56833c287..8b4cdbfb5b11 100644
--- a/packages/quill/packages/charts/src/overlays/ReferenceLine.tsx
+++ b/packages/quill/packages/charts/src/overlays/ReferenceLine.tsx
@@ -38,7 +38,7 @@ export interface ReferenceLineProps {
style?: ReferenceLineStyle
/** Optional filled half-plane on one side of the line. */
fillSide?: ReferenceLineFillSide
- /** Preset: `goal` (dashed grey), `alert` (dashed red), `marker` (solid thin grey). Defaults to `goal`. */
+ /** Preset: `goal` (dashed grey), `alert` (dashed red), `marker` (thin dashed, axis label color). Defaults to `goal`. */
variant?: ReferenceLineVariant
/** Which y-axis this line references. Only used for horizontal lines. Defaults to the primary axis. */
yAxisId?: string
@@ -62,7 +62,7 @@ interface ResolvedStyle {
const VARIANT_DEFAULTS: Record<ReferenceLineVariant, ResolvedStyle> = {
goal: { color: 'rgba(0, 0, 0, 0.4)', stroke: 'dashed', width: 2 },
alert: { color: '#db3707', stroke: 'dashed', width: 2 },
- marker: { color: 'rgba(0, 0, 0, 0.5)', stroke: 'solid', width: 1 },
+ marker: { color: 'var(--color-graph-axis-label)', stroke: 'dashed', width: 1 },
}
/** Approximate rendered height of the label bubble — used only to keep it inside the plot near