diff --git a/components/WordCloud.tsx b/components/WordCloud.tsx index 1a78ead..894137d 100644 --- a/components/WordCloud.tsx +++ b/components/WordCloud.tsx @@ -150,11 +150,11 @@ const WordCloudWords: React.FC = ({ random={fixedValueGenerator} > {(cloudWords) => - cloudWords.map((word, i) => { + cloudWords.map((word, index) => { return ( = ({ if (word.text) { showTooltip( - { text: word.text, value: data[i].value }, + { text: word.text, value: data[index].value }, eventSvgCoords.x - word.text.length * TOOLTIP_HORIZONTAL_SHIFT_SCALER, eventSvgCoords.y ); } - console.log(e, eventSvgCoords); }) as React.MouseEventHandler } onMouseLeave={(_) => hideTooltip()} diff --git a/package.json b/package.json index 94ceae4..6358840 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "engines": { "node": "^16", - "npm": ">=7" + "npm": "^8.0.0" }, "scripts": { "dev": "next dev", diff --git a/pages/playground.tsx b/pages/playground.tsx index a0abf42..5707edb 100644 --- a/pages/playground.tsx +++ b/pages/playground.tsx @@ -49,6 +49,16 @@ export default function Home() { right: 20, }} /> + +

+ {""} +

+ ({ + text: word.key, + value: word.value, + }))} + /> ); }