Add Wordcloud Component #26
|
@ -0,0 +1,19 @@
|
|||
.word:hover {
|
||||
text-shadow: var(--primary-accent) 0 0 20px;
|
||||
text-anchor: "middle";
|
||||
}
|
||||
|
||||
#tooltip {
|
||||
font-family: 'Inconsolata', monospace;
|
||||
font-weight: bold;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
color: var(--navy);
|
||||
box-shadow: rgb(33 33 33 / 20%) 0px 1px 2px;
|
||||
pointer-events: none;
|
||||
padding: 10px;
|
||||
font-size: 17px;
|
||||
border-radius: 9px;
|
||||
}
|
|
@ -1,61 +1,139 @@
|
|||
import { localPoint } from "@visx/event";
|
||||
import { Point } from "@visx/point";
|
||||
import { scaleLog } from "@visx/scale";
|
||||
import { Text } from "@visx/text";
|
||||
import { TooltipWithBounds, useTooltip, withTooltip } from "@visx/tooltip";
|
||||
import { Wordcloud as VisxWordcloud } from "@visx/Wordcloud";
|
||||
import { mockCategoricalData } from "data/mocks";
|
||||
import React, { useState } from "react";
|
||||
import React from "react";
|
||||
import { Color } from "utils/Color";
|
||||
|
||||
interface ExampleProps {
|
||||
width: number;
|
||||
height: number;
|
||||
showControls?: boolean;
|
||||
import styles from "./WordCloud.module.css";
|
||||
|
||||
interface WordCloudProps {
|
||||
data: Array<WordData>;
|
||||
width?: number;
|
||||
height?: number;
|
||||
wordPadding?: number;
|
||||
fontWeight?: number;
|
||||
minFontSize?: number;
|
||||
maxFontSize?: number;
|
||||
}
|
||||
|
||||
export interface WordData {
|
||||
interface WordData {
|
||||
text: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
const colors = [
|
||||
Color.primaryAccent,
|
||||
Color.primaryAccentLight,
|
||||
// Color.primaryAccentLighter,
|
||||
];
|
||||
|
||||
function getWords(): WordData[] {
|
||||
return mockCategoricalData.map((word) => ({
|
||||
text: word.key,
|
||||
value: word.value,
|
||||
}));
|
||||
}
|
||||
|
||||
const words = [...getWords(), ...getWords()];
|
||||
|
||||
const fontScale = scaleLog({
|
||||
domain: [
|
||||
Math.min(...words.map((w) => w.value)),
|
||||
Math.max(...words.map((w) => w.value)),
|
||||
],
|
||||
range: [30, 100],
|
||||
});
|
||||
const fontSizeSetter = (datum: WordData) => fontScale(datum.value);
|
||||
|
||||
const wordColors = [Color.primaryAccent, Color.primaryAccentLight];
|
||||
const fixedValueGenerator = () => 0.5;
|
||||
const TOOLTIP_HORIZONTAL_SHIFT_SCALER = 12.0;
|
||||
|
||||
export default function Wordcloud({
|
||||
export const WordCloud = withTooltip(
|
||||
({
|
||||
width = 1000,
|
||||
height = 500,
|
||||
data,
|
||||
wordPadding = 30,
|
||||
fontWeight = 500,
|
||||
minFontSize = 20,
|
||||
maxFontSize = 150,
|
||||
}: WordCloudProps) => {
|
||||
const {
|
||||
tooltipData,
|
||||
tooltipLeft,
|
||||
tooltipTop,
|
||||
tooltipOpen,
|
||||
showTooltip,
|
||||
hideTooltip,
|
||||
} = useTooltip<WordData>();
|
||||
|
||||
return (
|
||||
<>
|
||||
<WordCloudWordsMemoized
|
||||
width={width}
|
||||
height={height}
|
||||
data={data}
|
||||
wordPadding={wordPadding}
|
||||
fontWeight={fontWeight}
|
||||
minFontSize={minFontSize}
|
||||
maxFontSize={maxFontSize}
|
||||
showTooltip={(data, left, top) => {
|
||||
showTooltip({
|
||||
tooltipData: data,
|
||||
tooltipLeft: left,
|
||||
tooltipTop: top,
|
||||
});
|
||||
}}
|
||||
hideTooltip={hideTooltip}
|
||||
tooltipLeft={tooltipLeft}
|
||||
tooltipTop={tooltipTop}
|
||||
/>
|
||||
|
||||
{tooltipOpen && tooltipData ? (
|
||||
<TooltipWithBounds
|
||||
// set this to random so it correctly updates with parent bounds
|
||||
key={Math.random()}
|
||||
top={tooltipTop}
|
||||
left={tooltipLeft}
|
||||
unstyled
|
||||
applyPositionStyle
|
||||
id={styles.tooltip}
|
||||
>
|
||||
{tooltipData.text} ({tooltipData.value})
|
||||
</TooltipWithBounds>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
type WordCloudWordsProps = WordCloudProps & {
|
||||
data: Array<WordData>;
|
||||
width: number;
|
||||
height: number;
|
||||
wordPadding: number;
|
||||
fontWeight: number;
|
||||
minFontSize: number;
|
||||
maxFontSize: number;
|
||||
showTooltip: (
|
||||
data: WordData,
|
||||
tooltipLeft: number,
|
||||
tooltipTop: number
|
||||
) => void;
|
||||
hideTooltip: () => void;
|
||||
// These next props are just used to stop the component from updating when it doesnt need to,
|
||||
// but they are not needed to render the component
|
||||
tooltipLeft?: number;
|
||||
tooltipTop?: number;
|
||||
};
|
||||
const WordCloudWords: React.FC<WordCloudWordsProps> = ({
|
||||
width,
|
||||
height,
|
||||
showControls,
|
||||
}: ExampleProps) {
|
||||
data,
|
||||
wordPadding = 30,
|
||||
fontWeight = 400,
|
||||
minFontSize = 20,
|
||||
maxFontSize = 100,
|
||||
showTooltip,
|
||||
hideTooltip,
|
||||
}) => {
|
||||
const fontScale = scaleLog({
|
||||
domain: [
|
||||
Math.min(...data.map((w) => w.value)),
|
||||
Math.max(...data.map((w) => w.value)),
|
||||
],
|
||||
range: [minFontSize, maxFontSize],
|
||||
});
|
||||
const fontSizeSetter = (datum: WordData) => fontScale(datum.value);
|
||||
return (
|
||||
<div className="wordcloud">
|
||||
<>
|
||||
<VisxWordcloud
|
||||
words={words}
|
||||
words={data}
|
||||
width={width}
|
||||
height={height}
|
||||
fontSize={fontSizeSetter}
|
||||
font="Inconsolata, monospace"
|
||||
padding={30}
|
||||
padding={wordPadding}
|
||||
spiral={"rectangular"}
|
||||
rotate={0}
|
||||
random={fixedValueGenerator}
|
||||
|
@ -65,12 +143,35 @@ export default function Wordcloud({
|
|||
return (
|
||||
<Text
|
||||
key={w.text}
|
||||
fill={colors[i % colors.length]}
|
||||
textAnchor={"middle"}
|
||||
fill={wordColors[i % wordColors.length]}
|
||||
transform={`translate(${w.x ?? 0}, ${w.y ?? 0})`}
|
||||
fontSize={w.size}
|
||||
fontFamily={w.font}
|
||||
fontWeight={300}
|
||||
fontWeight={fontWeight}
|
||||
className={styles.word}
|
||||
textAnchor="middle"
|
||||
onMouseMove={
|
||||
((e: React.MouseEvent<SVGTextElement, MouseEvent>) => {
|
||||
const eventSvgCoords = localPoint(
|
||||
// ownerSVGElement is given by visx docs but not recognized by typescript
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
e.target.ownerSVGElement as Element,
|
||||
e
|
||||
) as Point;
|
||||
|
||||
if (w.text) {
|
||||
showTooltip(
|
||||
{ text: w.text, value: data[i].value },
|
||||
eventSvgCoords.x -
|
||||
w.text.length * TOOLTIP_HORIZONTAL_SHIFT_SCALER,
|
||||
eventSvgCoords.y
|
||||
);
|
||||
}
|
||||
console.log(e, eventSvgCoords);
|
||||
}) as React.MouseEventHandler<SVGTextElement>
|
||||
}
|
||||
onMouseLeave={(_) => hideTooltip()}
|
||||
>
|
||||
{w.text}
|
||||
</Text>
|
||||
|
@ -78,27 +179,23 @@ export default function Wordcloud({
|
|||
})
|
||||
}
|
||||
</VisxWordcloud>
|
||||
{/* <style jsx>{`
|
||||
.wordcloud {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
user-select: none;
|
||||
}
|
||||
.wordcloud svg {
|
||||
margin: 1rem 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wordcloud label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.wordcloud textarea {
|
||||
min-height: 100px;
|
||||
}
|
||||
`}</style> */}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const shouldNotRerender = (
|
||||
prevProps: WordCloudWordsProps,
|
||||
nextProps: WordCloudWordsProps
|
||||
) => {
|
||||
if (
|
||||
prevProps.tooltipLeft !== nextProps.tooltipLeft ||
|
||||
prevProps.tooltipTop !== nextProps.tooltipTop ||
|
||||
nextProps.tooltipLeft === undefined ||
|
||||
nextProps.tooltipTop === undefined
|
||||
) {
|
||||
return true; // do not re-render
|
||||
}
|
||||
return false; // will re-render
|
||||
};
|
||||
|
||||
const WordCloudWordsMemoized = React.memo(WordCloudWords, shouldNotRerender);
|
||||
|
|
|
@ -35,3 +35,27 @@ export const mockCategoricalData = [
|
|||
value: 29,
|
||||
},
|
||||
];
|
||||
|
||||
export const moreMockCategoricalData = [
|
||||
{ key: "Python", value: 29.53 },
|
||||
{ key: "Java", value: 17.06 },
|
||||
{ key: "JavaScript", value: 8.56 },
|
||||
{ key: "C", value: 6.49 },
|
||||
{ key: "Assembly", value: 6.31 },
|
||||
{ key: "R", value: 5.83 },
|
||||
{ key: "Objective C", value: 3.43 },
|
||||
{ key: "Swift", value: 2.89 },
|
||||
{ key: "PHP", value: 2.85 },
|
||||
{ key: "Rust", value: 2.33 },
|
||||
{ key: "Ruby", value: 2.25 },
|
||||
{ key: "Matlab", value: 2.06 },
|
||||
{ key: "TypeScript", value: 1.98 },
|
||||
{ key: "Go", value: 1.85 },
|
||||
{ key: "VBA", value: 1.11 },
|
||||
{ key: "Scala", value: 0.79 },
|
||||
{ key: "Lua", value: 0.79 },
|
||||
{ key: "Julia", value: 0.77 },
|
||||
{ key: "Kotlin", value: 0.7 },
|
||||
{ key: "Perl", value: 0.41 },
|
||||
{ key: "Groovy", value: 0.4 },
|
||||
];
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@visx/axis": "^2.10.0",
|
||||
"@visx/event": "^2.6.0",
|
||||
"@visx/grid": "^2.10.0",
|
||||
"@visx/shape": "^2.10.0",
|
||||
"@visx/tooltip": "^2.10.0",
|
||||
"@visx/wordcloud": "^2.10.0",
|
||||
"next": "12.1.6",
|
||||
"react": "18.1.0",
|
||||
|
@ -666,7 +668,6 @@
|
|||
"version": "18.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.5.tgz",
|
||||
"integrity": "sha512-OWPWTUrY/NIrjsAPkAk1wW9LZeIjSvkXRhclsFO8CZcZGCOg2G0YZy4ft+rOyYxy8B7ui5iZzi9OkDebZ7/QSA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/react": "*"
|
||||
}
|
||||
|
@ -900,6 +901,20 @@
|
|||
"react": "^16.3.0-0 || ^17.0.0-0 || ^18.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@visx/bounds": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/bounds/-/bounds-2.10.0.tgz",
|
||||
"integrity": "sha512-rY7WFTIjQaXA8tFL45O2qbtSRkyF4yF75HiWz06F7BVmJ9UjF2qlomB3Y1z6gk6ZiFhwQ4zxABjOVjAQPLn7nQ==",
|
||||
"dependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"prop-types": "^15.5.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.0.0-0 || ^17.0.0-0 || ^18.0.0-0",
|
||||
"react-dom": "^16.0.0-0 || ^17.0.0-0 || ^18.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@visx/curve": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/curve/-/curve-2.1.0.tgz",
|
||||
|
@ -909,6 +924,15 @@
|
|||
"d3-shape": "^1.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@visx/event": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/event/-/event-2.6.0.tgz",
|
||||
"integrity": "sha512-WGp91g82s727g3NAnENF1ppC3ZAlvWg+Y+GG0WFg34NmmOZbvPI/PTOqTqZE3x6B8EUn8NJiMxRjxIMbi+IvRw==",
|
||||
"dependencies": {
|
||||
"@types/react": "*",
|
||||
"@visx/point": "2.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@visx/grid": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/grid/-/grid-2.10.0.tgz",
|
||||
|
@ -996,6 +1020,22 @@
|
|||
"react": "^16.3.0-0 || ^17.0.0-0 || ^18.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@visx/tooltip": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/tooltip/-/tooltip-2.10.0.tgz",
|
||||
"integrity": "sha512-6Zrd79MIEfyuLBcZ1ypSeAkpQc8oLRNB7FQnegzl3Lje4LK5lJtuf5ST0mwK6G2Uv+GlOW9REJ6VK4gfAGkq9A==",
|
||||
"dependencies": {
|
||||
"@types/react": "*",
|
||||
"@visx/bounds": "2.10.0",
|
||||
"classnames": "^2.3.1",
|
||||
"prop-types": "^15.5.10",
|
||||
"react-use-measure": "^2.0.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0-0 || ^17.0.0-0 || ^18.0.0-0",
|
||||
"react-dom": "^16.8.0-0 || ^17.0.0-0 || ^18.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@visx/wordcloud": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/wordcloud/-/wordcloud-2.10.0.tgz",
|
||||
|
@ -1534,6 +1574,11 @@
|
|||
"integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/debounce": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz",
|
||||
"integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug=="
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
|
@ -3902,6 +3947,18 @@
|
|||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||
},
|
||||
"node_modules/react-use-measure": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/react-use-measure/-/react-use-measure-2.1.1.tgz",
|
||||
"integrity": "sha512-nocZhN26cproIiIduswYpV5y5lQpSQS1y/4KuvUCjSKmw7ZWIS/+g3aFnX3WdBkyuGUtTLif3UTqnLLhbDoQig==",
|
||||
"dependencies": {
|
||||
"debounce": "^1.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.13",
|
||||
"react-dom": ">=16.13"
|
||||
}
|
||||
},
|
||||
"node_modules/reduce-css-calc": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz",
|
||||
|
@ -4793,7 +4850,6 @@
|
|||
"version": "18.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.5.tgz",
|
||||
"integrity": "sha512-OWPWTUrY/NIrjsAPkAk1wW9LZeIjSvkXRhclsFO8CZcZGCOg2G0YZy4ft+rOyYxy8B7ui5iZzi9OkDebZ7/QSA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/react": "*"
|
||||
}
|
||||
|
@ -4931,6 +4987,16 @@
|
|||
"prop-types": "^15.6.0"
|
||||
}
|
||||
},
|
||||
"@visx/bounds": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/bounds/-/bounds-2.10.0.tgz",
|
||||
"integrity": "sha512-rY7WFTIjQaXA8tFL45O2qbtSRkyF4yF75HiWz06F7BVmJ9UjF2qlomB3Y1z6gk6ZiFhwQ4zxABjOVjAQPLn7nQ==",
|
||||
"requires": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"prop-types": "^15.5.10"
|
||||
}
|
||||
},
|
||||
"@visx/curve": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/curve/-/curve-2.1.0.tgz",
|
||||
|
@ -4940,6 +5006,15 @@
|
|||
"d3-shape": "^1.0.6"
|
||||
}
|
||||
},
|
||||
"@visx/event": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/event/-/event-2.6.0.tgz",
|
||||
"integrity": "sha512-WGp91g82s727g3NAnENF1ppC3ZAlvWg+Y+GG0WFg34NmmOZbvPI/PTOqTqZE3x6B8EUn8NJiMxRjxIMbi+IvRw==",
|
||||
"requires": {
|
||||
"@types/react": "*",
|
||||
"@visx/point": "2.6.0"
|
||||
}
|
||||
},
|
||||
"@visx/grid": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/grid/-/grid-2.10.0.tgz",
|
||||
|
@ -5015,6 +5090,18 @@
|
|||
"reduce-css-calc": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"@visx/tooltip": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/tooltip/-/tooltip-2.10.0.tgz",
|
||||
"integrity": "sha512-6Zrd79MIEfyuLBcZ1ypSeAkpQc8oLRNB7FQnegzl3Lje4LK5lJtuf5ST0mwK6G2Uv+GlOW9REJ6VK4gfAGkq9A==",
|
||||
"requires": {
|
||||
"@types/react": "*",
|
||||
"@visx/bounds": "2.10.0",
|
||||
"classnames": "^2.3.1",
|
||||
"prop-types": "^15.5.10",
|
||||
"react-use-measure": "^2.0.4"
|
||||
}
|
||||
},
|
||||
"@visx/wordcloud": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@visx/wordcloud/-/wordcloud-2.10.0.tgz",
|
||||
|
@ -5395,6 +5482,11 @@
|
|||
"integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==",
|
||||
"dev": true
|
||||
},
|
||||
"debounce": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz",
|
||||
"integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
|
@ -7071,6 +7163,14 @@
|
|||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||
},
|
||||
"react-use-measure": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/react-use-measure/-/react-use-measure-2.1.1.tgz",
|
||||
"integrity": "sha512-nocZhN26cproIiIduswYpV5y5lQpSQS1y/4KuvUCjSKmw7ZWIS/+g3aFnX3WdBkyuGUtTLif3UTqnLLhbDoQig==",
|
||||
"requires": {
|
||||
"debounce": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"reduce-css-calc": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz",
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@visx/axis": "^2.10.0",
|
||||
"@visx/event": "^2.6.0",
|
||||
"@visx/grid": "^2.10.0",
|
||||
"@visx/shape": "^2.10.0",
|
||||
"@visx/tooltip": "^2.10.0",
|
||||
"@visx/wordcloud": "^2.10.0",
|
||||
"next": "12.1.6",
|
||||
"react": "18.1.0",
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { moreMockCategoricalData } from "data/mocks";
|
||||
import React from "react";
|
||||
import { Color } from "utils/Color";
|
||||
|
||||
import Wordcloud from "@/components/Wordcloud";
|
||||
import { WordCloud } from "@/components/WordCloud";
|
||||
|
||||
import { ColorPalette } from "../components/ColorPalette";
|
||||
|
||||
|
@ -10,7 +12,18 @@ export default function Home() {
|
|||
<h1>Playground</h1>
|
||||
<p>Show off your components here!</p>
|
||||
<ColorPalette />
|
||||
<Wordcloud width={2000} height={1000} showControls />
|
||||
|
||||
<h2>
|
||||
<code>{"<WordCloud />"}</code>
|
||||
</h2>
|
||||
<WordCloud
|
||||
// width={1000}
|
||||
// height={500}
|
||||
data={moreMockCategoricalData.map((word) => ({
|
||||
text: word.key,
|
||||
value: word.value,
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue