A simple scatterplot
npm install @dbvis/vd-scatterplottypescript
const data: DataItem[] = [
{
id: '0',
x: 0,
y: 0,
},
{
id: '1',
x: 1,
y: 1,
}];
const cluster: ClusterItem[] = [
{
id: '1',
relatedItems: [data[0]]
},
{
id: '2',
relatedItems: [data[1]]
}
]
const scatterplot: VdScatterplot = new VdScatterplot(document.getElementById('scatterplot') as HTMLElement, { voronoiCells: true})
scatterplot.setData(data)
scatterplot.setCluster(cluster);
scatterplot.setOptions({axis: true, clusterHulls: true, voronoieCells: false, width: 500, height:500});
scatterplot.observeHoverBrush().subscribe((evt: VdScatterplotEvent) => {
if(evt.dataItems.length > 0) {
console.log("observing the hovering of ", evt.dataItems);
}
})
``