Published
Edited
Apr 7, 2021
1 fork
Importers
1 star
Insert cell
Insert cell
{
let c = DOM.canvas(width, width / 2.4);
new Chart(c.getContext("2d"), {
type: 'scatter',
data: {
datasets: [{
label: 'Set 1',
backgroundColor: 'green',
data: [{
x: -9.95,
y: 5
}],
borderWidth: 1,
pointHitRadius: 25
},{
label: 'Set 2',
backgroundColor: 'blue',
data: [{
x: 0,
y: 10
}],
borderWidth: 1,
pointHitRadius: 25
},{
label: 'Set 3',
backgroundColor: 'red',
data: [{
x: 10,
y: 5
}],
borderWidth: 1,
pointHitRadius: 25
},
]
},
options: {
scales: {
y: {
min: 0,
max: 20
},
x: {
min: - 15,
max: 15
}
},
plugins: {
datalabels: {
align: 'top',
formatter: function(value, context) {
return context.dataset.label;
}
}
}
}
})
return c
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more