Different Shapes of Beeswarm
import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
autoFit: true,
});
const data = Array.from({ length: 400 }, (_, i) => {
return {
x: `G${(i % 6) + 1}`,
y: 40 + Math.random() * 220,
};
});
chart.options({
type: 'beeswarm',
data,
encode: {
x: 'x',
y: 'y',
size: 'y',
color: 'x',
shape: 'x', // 'point'
},
scale: {
y: {
nice: true,
domainMin: 0,
},
size: {
range: [2, 6],
},
},
legend: {
size: false,
},
axis: {
x: { title: false },
y: { title: false },
},
});
chart.render();