More pr comment
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
d2f9946fcc
commit
8f2c390dbd
|
@ -150,11 +150,11 @@ const WordCloudWords: React.FC<WordCloudWordsProps> = ({
|
|||
random={fixedValueGenerator}
|
||||
>
|
||||
{(cloudWords) =>
|
||||
cloudWords.map((word, i) => {
|
||||
cloudWords.map((word, index) => {
|
||||
return (
|
||||
<Text
|
||||
key={`wordcloud-word-${word.text ?? ""}`}
|
||||
fill={wordColors[i % wordColors.length]}
|
||||
key={`wordcloud-word-${word.text ?? ""}-${index}`}
|
||||
fill={wordColors[index % wordColors.length]}
|
||||
transform={`translate(${word.x ?? 0}, ${word.y ?? 0})`}
|
||||
fontSize={word.size}
|
||||
fontFamily={word.font}
|
||||
|
@ -173,13 +173,12 @@ const WordCloudWords: React.FC<WordCloudWordsProps> = ({
|
|||
|
||||
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<SVGTextElement>
|
||||
}
|
||||
onMouseLeave={(_) => hideTooltip()}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"private": true,
|
||||
"engines": {
|
||||
"node": "^16",
|
||||
"npm": ">=7"
|
||||
"npm": "^8.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
|
|
@ -49,6 +49,16 @@ export default function Home() {
|
|||
right: 20,
|
||||
}}
|
||||
/>
|
||||
|
||||
<h2>
|
||||
<code>{"<WordCloud />"}</code>
|
||||
</h2>
|
||||
<WordCloud
|
||||
data={moreMockCategoricalData.map((word) => ({
|
||||
text: word.key,
|
||||
value: word.value,
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue