Public
Edited
Apr 3, 2024
1 star
Insert cell
Insert cell
Insert cell
{
const chart = new G2.Chart({
paddingLeft: 60,
paddingRight: 60,
width: 1000,
height: 700
});

chart
.point()
.data(getHeartPoints())
.encode("x", "x")
.encode("y", "y")
.encode("shape", "point")
.encode("color", HEART_COLOR)
.encode("size", 1)
.transform({ type: Jitter })
.axis(false);

await chart.render();

return chart.getContainer();
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
direction = () => (Math.random() > 0.5 ? 1 : -1)
Insert cell
random = d3.randomExponential(5, [0, 1])
Insert cell
Insert cell
d3 = require("https://unpkg.com/d3")
Insert cell
G2 = require("https://unpkg.com/@antv/g2")
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