fix: add 0% baseline axis to scroll depth radar for pentagon shape

This commit is contained in:
Usman Baig
2026-03-11 22:30:19 +01:00
parent 0f5d5338f3
commit b30619e6b4

View File

@@ -22,10 +22,13 @@ export default function ScrollDepth({ goalCounts, totalPageviews }: ScrollDepthP
const hasData = scrollCounts.size > 0 && totalPageviews > 0
const chartData = THRESHOLDS.map((threshold) => ({
label: `${threshold}%`,
value: totalPageviews > 0 ? Math.round(((scrollCounts.get(threshold) ?? 0) / totalPageviews) * 100) : 0,
}))
const chartData = [
{ label: '0%', value: 100 },
...THRESHOLDS.map((threshold) => ({
label: `${threshold}%`,
value: totalPageviews > 0 ? Math.round(((scrollCounts.get(threshold) ?? 0) / totalPageviews) * 100) : 0,
})),
]
return (
<div className="bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-2xl p-6 h-full flex flex-col">