Skip to content

Commit 6c00b27

Browse files
committed
a bit better maybe
1 parent ee3fea1 commit 6c00b27

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/summary-table.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,15 @@ function table(data, options = {}) {
6767
</footer>`;
6868
container.appendChild(footer);
6969

70-
requestAnimationFrame(() => summaries.filter(({type}) => type).append(summary));
70+
requestAnimationFrame(() => {
71+
for (const s of summaries.filter(({type}) => type)) summary(s);
72+
});
7173
return container;
7274
}
7375

74-
function summary({name, type, values}) {
75-
const {width: w, height} = this.getBoundingClientRect();
76+
async function summary(div) {
77+
const {name, type, values} = d3.select(div).datum();
78+
const {width: w, height} = div.getBoundingClientRect();
7679
const width = Math.min(200, (w ?? 80));
7780
let chart;
7881

@@ -180,10 +183,10 @@ function summary({name, type, values}) {
180183
]
181184
});
182185
}
183-
return chart ? html`<div style=${type === "Utf8" ? "" : {
186+
div.append(chart ? html`<div style=${type === "Utf8" ? "" : {
184187
position: "absolute",
185188
right: 0
186-
}}>${chart}` : html`<span>Unknown type ${type}`;
189+
}}>${chart}` : html`<span>Unknown type ${type}`);
187190
}
188191
```
189192

0 commit comments

Comments
 (0)