Platform
Resources
Pricing
Sign in
Get started
Brendan Ratter
Workspace
Fork
Public
By
Brendan Ratter
Edited
Aug 7, 2023
Insert cell
Insert cell
viewof
companiesRaw
=
Inputs
.
file
(
{
label
:
"Companies list"
,
accept
:
".csv"
,
required
:
true
}
)
Insert cell
viewof
metricsRaw
=
Inputs
.
file
(
{
label
:
"Metrics Data"
,
accept
:
".csv"
,
required
:
true
}
)
Insert cell
Insert cell
metrics
=
metricsRaw
.
csv
(
{
typed
:
true
}
)
Insert cell
data
=
// Join the labels into the data, this is useful to get the categories on the data
metrics
.
map
(
d
=>
{
const
labels
=
companies
.
get
(
d
.
ciqId
)
;
return
{
...
d
,
...
labels
,
year
:
2023
-
d
.
timing
}
;
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Plot
.
plot
(
{
marginBottom
:
110
,
marginLeft
:
50
,
x
:
{
tickRotate
:
90
}
,
y
:
{
grid
:
true
,
domain
:
[
-
0.2
,
0.5
]
,
ticks
:
5
}
,
marks
:
[
Plot
.
boxY
(
dataNot10
,
{
fx
:
"timing"
,
x
:
"category1"
,
y
:
"roic"
}
)
]
}
)
Insert cell
Plot
.
plot
(
{
marginBottom
:
50
,
marginLeft
:
50
,
marginRight
:
100
,
x
:
{
tickRotate
:
90
}
,
y
:
{
grid
:
true
}
,
marks
:
[
Plot
.
line
(
data
,
{
...
grouped
,
strokeWidth
:
3
}
)
,
Plot
.
text
(
data
,
Plot
.
selectLast
(
{
...
grouped
,
stroke
:
"none"
,
textAnchor
:
"start"
,
dx
:
5
}
)
)
]
}
)
Insert cell
normalized
=
Plot
.
map
(
{
y
:
Plot
.
normalize
(
"last"
)
}
,
{
x
:
"year"
,
y
:
"revenue"
,
z
:
"ticker"
}
)
Insert cell
grouped
=
Plot
.
groupX
(
{
x
:
"first"
,
y
:
"mean"
,
stroke
:
"first"
,
text
:
"first"
}
,
{
...
normalized
,
z
:
"category2"
,
stroke
:
"category2"
,
text
:
"category2"
}
)
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
companiesRaw
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
metricsRaw
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
companies
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
metrics
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
dataNot10
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
nameRegex
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
normalized
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
grouped
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML