Platform
Solutions
Resources
Pricing
Sign in
Sign up
Rebecca Sutton Koeser
Lead Research Software Engineer @Princeton-CDH. Previously software engineer at @emory-libraries and contributor to @ecds, @emory-lits-labs
Workspace
Fork
Public
By
Rebecca Sutton Koeser
Edited
Jan 23, 2023
3 forks
Insert cell
Insert cell
height
=
100
Insert cell
viewof
maxLeafHeight
=
Inputs
.
range
(
[
50
,
100
]
,
{
value
:
80
,
step
:
1
,
label
:
"maximum leaf height"
}
)
Insert cell
viewof
maxLeafWidth
=
Inputs
.
range
(
[
35
,
100
]
,
{
value
:
45
,
step
:
1
,
label
:
"maximum leaf width"
}
)
Insert cell
chart
=
{
const
svg
=
d3
.
create
(
"svg"
)
.
attr
(
"width"
,
width
)
.
attr
(
"height"
,
height
)
;
// get initial sizes from inputs
let
x
=
30
;
while
(
x
<
(
width
+
maxLeafWidth
)
)
{
drawLeaf
(
x
,
svg
)
;
x
+=
maxLeafWidth
*
1.5
;
}
return
svg
.
node
(
)
;
}
Insert cell
Insert cell
Insert cell
chartPoints
=
{
const
svg
=
d3
.
create
(
"svg"
)
.
attr
(
"width"
,
width
)
.
attr
(
"height"
,
height
+
10
)
;
drawLeaf
(
30
,
svg
,
true
)
;
return
svg
.
node
(
)
}
Insert cell
Insert cell
chartRotate
=
{
const
svg
=
d3
.
create
(
"svg"
)
.
attr
(
"width"
,
width
)
.
attr
(
"height"
,
height
)
;
// get initial sizes from inputs
let
x
=
30
;
while
(
x
<
(
width
+
maxLeafWidth
)
)
{
drawLeaf
(
x
,
svg
,
false
,
true
)
;
// don't show points, do rotate
x
+=
maxLeafWidth
*
1.5
;
}
return
svg
.
node
(
)
;
}
Insert cell
Insert cell
leafSkew
=
{
const
svg
=
d3
.
create
(
"svg"
)
.
attr
(
"width"
,
width
*
2
)
.
attr
(
"height"
,
height
*
4
)
;
// needs more height somehow because of skewing
// get initial sizes from inputs
let
x
=
30
;
while
(
x
<
(
width
+
maxLeafWidth
)
)
{
drawLeaf
(
x
,
svg
,
false
,
false
,
true
)
;
// don't show points, don't rotate, do skew
x
+=
maxLeafWidth
*
1.5
;
}
return
svg
.
node
(
)
;
}
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
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
maxLeafHeight
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
maxLeafWidth
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
drawLeaf
Edit
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
chartPoints
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
chartRotate
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
leafSkew
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML