File size: 599 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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} />
))}
</>
)
}
|