diff --git a/components/dashboard/DottedMap.tsx b/components/dashboard/DottedMap.tsx index 94197b3..f2c9bea 100644 --- a/components/dashboard/DottedMap.tsx +++ b/components/dashboard/DottedMap.tsx @@ -77,6 +77,21 @@ export default function DottedMap({ data, className }: DottedMapProps) { return { xStep: step || 1, yToRowIndex: rowMap } }, [points]) + // Batch all 8000 base dots into a single instead of 8000 elements + const dotsPath = useMemo(() => { + const r = dotRadius + const d = r * 2 + const parts: string[] = [] + for (const point of points) { + const rowIndex = yToRowIndex.get(point.y) ?? 0 + const offsetX = rowIndex % 2 === 1 ? xStep / 2 : 0 + const cx = point.x + offsetX + const cy = point.y + parts.push(`M${cx - r},${cy}a${r},${r} 0 1,0 ${d},0a${r},${r} 0 1,0 ${-d},0`) + } + return parts.join('') + }, [points, dotRadius, xStep, yToRowIndex]) + return (
- {points.map((point, index) => { - const rowIndex = yToRowIndex.get(point.y) ?? 0 - const offsetX = rowIndex % 2 === 1 ? xStep / 2 : 0 - return ( - - ) - })} + {processedMarkers.map((marker, index) => { const rowIndex = yToRowIndex.get(marker.y) ?? 0 const offsetX = rowIndex % 2 === 1 ? xStep / 2 : 0