Platform
Resources
Pricing
Sign in
Get started
D3
Bring your data to life.
Workspace
Fork
Published unlisted
d3-axis
By
Fil
Edited
Apr 6, 2022
1 fork
1
Insert cell
Insert cell
d3Axis
=
FileAttachment
(
"d3-axis.js"
)
.
url
(
)
.
then
(
require
)
// built from the dev branch
Insert cell
{
const
svg
=
d3
.
create
(
"svg"
)
.
attr
(
"height"
,
30
)
;
svg
.
append
(
"g"
)
.
call
(
d3Axis
.
axisBottom
(
d3
.
scaleLinear
(
[
0
,
10
]
,
[
20
,
270
]
)
)
.
tickSize
(
(
)
=>
10
)
// 🌶
)
;
return
svg
.
node
(
)
;
}
Insert cell
{
const
svg
=
d3
.
create
(
"svg"
)
.
attr
(
"height"
,
60
)
;
svg
.
append
(
"g"
)
.
call
(
d3Axis
.
axisBottom
(
d3
.
scaleLinear
(
[
0
,
10
]
,
[
20
,
270
]
)
)
.
tickSize
(
(
d
,
i
)
=>
5
*
i
)
.
tickPadding
(
(
d
,
i
)
=>
5
*
i
+
4
)
// not working either 🌶
)
;
return
svg
.
node
(
)
;
}
Insert cell
{
const
svg
=
d3
.
create
(
"svg"
)
.
attr
(
"height"
,
30
)
;
svg
.
append
(
"g"
)
.
call
(
d3Axis
.
axisBottom
(
d3
.
scaleLinear
(
[
0
,
10
]
,
[
20
,
270
]
)
)
.
tickSize
(
10
)
)
;
return
svg
.
node
(
)
;
}
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
d3Axis
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML