The BeeswarmChart component renders a beeswarm plot with built-in support for timeseries.
import BeeswarmChart from "@ds-kit/beeswarm-chart"
By default the BeeswarmChart component will render a beeswarm plot with dummy data and a slider. Use this basic setup for quick prototyping.
0100200019002000<BeeswarmChart />
It is possible to pass a custom component to render customised labels.
BadGood0100200019002000<BeeswarmChart labels={["Bad", "Good"]} labelComponent={(text, i) => ( <Div px="0.5rem" mx="0.5rem" borderRadius="15px" color="white" bg={i ? "green.500" : "orange.500"} > {text} </Div> )} />
It is also possible to render custom components for the scale ticks.
020406080100200019002000<BeeswarmChart tickValues="on" tickComponent={(tick, i) => <Div color="orange.500">{i % 2 ? "" : tick}</Div>} />
It is possible to use custom components to render custom symbols.
0100200019002000<BeeswarmChart symbol={d => ( <Div width={24} height={24} borderRadius="50%" color="white" bg="green.500" textAlign="center" > {d.id} </Div> )} />
Symbols can have tooltips. The content of the tooltip can be customised using the tooltipFormat
prop.
0100200019002000<BeeswarmChart tooltipFormat={d => d.id + " – " + d.value} />
It is also possible render a simple beeswarm plot without a slider.
0100<BeeswarmChart slider={false} />
data
object
{
byTime: {
"1900": [
{ id: "A", value: 25 },
{ id: "B", value: 27 },
{ id: "C", value: 75 },
],
"2000": [
{ id: "A", value: 50 },
{ id: "B", value: 27 },
{ id: "C", value: 25 },
],
},
domain: [0, 100],
}
width
number
height
number
200
time
number
symbol
func
symbolSize
number
30
tooltipFormat
func
tooltipOffset
array
labels
arrayOf
labelComponent
func
domain
arrayOf
slider
bool
true
sliderProps
object
{}
radius
number
side
"negative"
"positive"
"symetric"
"symetric"
selected
arrayOf
[]
keyValue
string
"value"
tickValues
"auto"
"on"
"off"
"auto"
tickComponent
func