Platform
Resources
Pricing
Sign in
Get started
Martien van Steenbergen
Wise Fool. Visioneer.
Workspace
Fork
Public
JavaScript
By
Martien van Steenbergen
Edited
May 5, 2023
1 fork
1 star
1
Insert cell
Insert cell
Insert cell
Insert cell
viewof
controls1
=
Inputs
.
form
(
{
curve
:
Inputs
.
radio
(
Object
.
keys
(
curves1
)
,
{
label
:
"Curve"
,
value
:
"linear"
}
)
,
radius
:
Inputs
.
range
(
[
0
,
288
]
,
{
label
:
"Corner Radius"
,
value
:
18
,
step
:
1
}
)
,
}
)
Insert cell
curves1
=
(
{
linear
:
d3
.
curveLinear
,
basis
:
d3
.
curveBasis
,
natural
:
d3
.
curveNatural
,
rounded
:
roundedCorners
.
radius
(
controls1
.
radius
)
,
}
)
Insert cell
Insert cell
viewof
controls2
=
Inputs
.
form
(
{
curve
:
Inputs
.
radio
(
Object
.
keys
(
curves2
)
,
{
label
:
"Curve"
,
value
:
"linear"
}
)
,
radius
:
Inputs
.
range
(
[
0
,
288
]
,
{
label
:
"Corner Radius"
,
value
:
18
,
step
:
1
}
)
,
}
)
Insert cell
curves2
=
(
{
linear
:
d3
.
curveLinear
,
basis
:
d3
.
curveBasis
,
natural
:
d3
.
curveNatural
,
rounded
:
roundedCorners
,
}
)
Insert cell
settings
=
{
const
curver
=
curves2
[
controls2
.
curve
]
;
// pick the proper curve function
return
(
{
// only if curver has a radius function, use it to set its radius
curver
:
curver
.
radius
&&
curver
.
radius
(
controls2
.
radius
)
||
curver
,
...
controls2
,
}
)
}
Insert cell
roundedCorners
=
require
(
"d3-curve-circlecorners"
)
// roundedCorners = import('https://cdn.skypack.dev/d3-curve-circlecorners?min')
Insert cell
r
=
require
(
"d3-curve-circlecorners"
)
Insert cell
r
.
radius
(
3
)
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
jsCircularReference_1
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
controls1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
curves1
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
controls2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
curves2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
settings
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
roundedCorners
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
r
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML