Public
Edited
Feb 2, 2023
Insert cell
<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg">
 <!-- 最后使用 Z 闭合命令简化 path 元素 -->
 <path d="M10,10 H 90 V 90 H 10 Z" fill="transparent" stroke="black"/>
</svg>
Insert cell
<script>
const dataset = [
{name: 'Ben', number: 4},
{name: 'Tom', number: 8},
{name: 'Jack', number: 15},
];


d3.selectAll('div')
.data(dataset, function(d) {
// key 函数返回数据的 d.name 作为标识,如果节点没有被绑定数据就返回节点的 id 属性作为标识
return d ? d.name : this.id;
})
.text(function(d) { return d.number; });
</script>
Insert cell
<div id="Ben"></div>
<div id="Tom"></div>
<div id="Jack"></div>
<div id="shouldBeDeletedNode"></div>


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