Platform
Resources
Pricing
Sign in
Get started
Maya Gao
Professional pretender. Copy-paste specialist.
Workspace
Fork
Published
By
Maya Gao
Edited
May 22, 2019
7 stars
Insert cell
Insert cell
Insert cell
getFontSize
=
(
base
,
ratio
,
size
)
=>
{
let
fontSize
=
base
*
Math
.
pow
(
ratio
,
size
)
return
Math
.
round
(
fontSize
)
}
Insert cell
Insert cell
getFontSize
(
16
,
1.313
,
4
)
Insert cell
Insert cell
getLineHeight
=
(
base
,
ratio
,
size
,
gridSize
)
=>
{
let
lineHeight
=
Math
.
round
(
base
*
Math
.
pow
(
ratio
,
size
)
)
return
(
lineHeight
%
gridSize
===
0
)
?
lineHeight
:
lineHeight
+
(
lineHeight
%
gridSize
)
}
Insert cell
Insert cell
getLineHeight
(
24
,
1.212
,
4
,
4
)
Insert cell
Insert cell
Insert cell
Insert cell
exampleTypeScale
=
generateTypeScale
(
16
,
1.313
,
20
,
1.24
,
4
)
Insert cell
Insert cell
Insert cell
Insert cell
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getFontSize
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
getLineHeight
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
generateTypeScale
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
exampleTypeScale
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
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