Platform
Resources
Pricing
Sign in
Get started
Michael Cooper
Developer @Observable
Workspace
Fork
Public
By
Michael Cooper
Edited
Jan 26, 2023
2 forks
17 stars
Insert cell
Insert cell
data
=
Array
.
from
(
{
length
:
100
}
,
d3
.
randomInt
(
50
,
100
)
)
Insert cell
Insert cell
<
div
style
=
"display: flex; flex-wrap: wrap; gap: 5px"
>
${data.map(width => htl.html`
<
div
style
=
"display: inline-block; width: ${width}px; height: 20px; background: steelblue"
>
</
div
>
`)}
</
div
>
Insert cell
Insert cell
4
<
div
style
=
"display: grid; gap: 5px; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr))"
>
${data.map(width => htl.html`
<
div
style
=
"display: inline-block; width: ${width}px; height: 20px; background: steelblue"
>
</
div
>
`)}
</
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Show 4 comments
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML