Platform
Solutions
Resources
Pricing
Sign in
Sign up
Christopher Pietsch
Visualization, Prototypes, ML, Data wrangling and Art.
Workspace
Fork
Public
By
Christopher Pietsch
Edited
Mar 27, 2023
Fork of
Hello, @thi.ng/grid-iterators
Insert cell
Insert cell
gi
=
import
(
"https://cdn.skypack.dev/@thi.ng/grid-iterators?min"
)
Insert cell
viewof
iterator
=
Inputs
.
select
(
new
Map
(
[
"hilbert2d"
,
"diagonal2d"
,
"interleaveColumns2d"
,
"interleaveRows2d"
,
"random2d"
,
"spiral2d"
,
"zcurve2d"
,
"zigzagColumns2d"
,
"zigzagDiagonal2d"
,
"zigzagRows2d"
]
.
map
(
d
=>
[
d
,
gi
[
d
]
]
)
)
,
{
label
:
"Grid Iterator"
}
)
Insert cell
Insert cell
Insert cell
hilbert
=
{
replay
;
const
pts
=
[
]
;
for
(
const
p
of
iterator
(
{
cols
:
32
,
rows
:
32
,
tx
:
(
)
=>
(
x
,
y
)
=>
(
{
x
,
y
}
)
// optional, this transform changes [0,1] into {x: 0, y: 1}
}
)
)
{
pts
.
push
(
p
)
;
yield
pts
;
}
}
Insert cell
Plot
.
rect
(
iterator
(
{
slope
:
4
,
cols
:
80
,
rows
:
23
}
)
,
{
x
:
"0"
,
y
:
"1"
,
interval
:
1
,
fill
:
(
d
,
i
)
=>
i
}
)
.
plot
(
{
aspectRatio
:
1
}
)
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
gi
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
iterator
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
replay
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
hilbert
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML