react-code-dataset / nivo /packages /swarmplot /src /SwarmPlotAnnotations.tsx
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
599 Bytes
import { Annotation } from '@nivo/annotations'
import { ComputedDatum, SwarmPlotSvgProps } from './types'
import { useSwarmPlotAnnotations } from './hooks'
export const SwarmPlotAnnotations = <RawDatum,>({
nodes,
annotations,
}: {
nodes: ComputedDatum<RawDatum>[]
annotations: SwarmPlotSvgProps<RawDatum>['annotations']
}) => {
const boundAnnotations = useSwarmPlotAnnotations<RawDatum>(nodes, annotations)
return (
<>
{boundAnnotations.map((annotation, i) => (
<Annotation key={i} {...annotation} />
))}
</>
)
}