Platform
Resources
Pricing
Sign in
Get started
1907040108
hello everybody
Workspace
Fork
Published
By
1907040108
Edited
Nov 17, 2021
Fork of
Interval Transform / Observable Plot
1
Insert cell
Insert cell
Insert cell
aapl
=
(
await
FileAttachment
(
"aapl.csv"
)
.
csv
(
{
typed
:
true
}
)
)
.
slice
(
-
40
)
Insert cell
Plot
.
plot
(
{
marginBottom
:
80
,
x
:
{
tickRotate
:
-
90
,
label
:
null
}
,
y
:
{
grid
:
true
,
transform
:
d
=>
d
/
1e6
,
label
:
"↑ Daily trade volume (millions)"
}
,
marks
:
[
Plot
.
barY
(
aapl
,
{
x
:
"Date"
,
y
:
"Volume"
}
)
,
Plot
.
ruleY
(
[
0
]
)
]
}
)
Insert cell
Insert cell
Plot
.
plot
(
{
y
:
{
grid
:
true
,
transform
:
d
=>
d
/
1e6
,
label
:
"↑ Daily trade volume (millions)"
}
,
marks
:
[
Plot
.
rectY
(
aapl
,
{
x
:
"Date"
,
interval
:
d3
.
utcDay
,
y
:
"Volume"
}
)
,
Plot
.
ruleY
(
[
0
]
)
]
}
)
Insert cell
Insert cell
customInterval
=
d3
.
utcDay
.
filter
(
d
=>
d
.
getUTCDay
(
)
!==
0
&&
d
.
getUTCDay
(
)
!==
6
)
Insert cell
value
=
new
Date
Insert cell
interval
=
[
customInterval
.
floor
(
value
)
,
// start
customInterval
.
offset
(
customInterval
.
floor
(
value
)
)
// stop
]
Insert cell
Plot
.
plot
(
{
y
:
{
grid
:
true
,
transform
:
d
=>
d
/
1e6
,
label
:
"↑ Daily trade volume (millions)"
}
,
marks
:
[
Plot
.
rectY
(
aapl
,
{
x
:
"Date"
,
interval
:
customInterval
,
y
:
"Volume"
}
)
,
Plot
.
ruleY
(
[
0
]
)
]
}
)
Insert cell
Insert cell
Plot
.
plot
(
{
marginBottom
:
80
,
x
:
{
tickRotate
:
-
90
,
label
:
null
}
,
y
:
{
grid
:
true
,
transform
:
d
=>
d
/
1e6
,
label
:
"↑ Daily trade volume (millions)"
}
,
marks
:
[
Plot
.
barY
(
aapl
,
{
x
:
"Date"
,
y
:
"Volume"
,
interval
:
1e7
}
)
,
Plot
.
ruleY
(
[
0
]
)
]
}
)
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
Compare fork
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
aapl
Add comment
Copy import
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
customInterval
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
value
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
interval
Add comment
Copy import
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
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