Platform
Solutions
Resources
Pricing
Sign in
Sign up
Alex Kraieski
R and JavaScript developer. Open to collaborations!
Workspace
Fork
Public
By
Alex Kraieski
Edited
Apr 2, 2023
Fork of
Input + Chart
1
Insert cell
Insert cell
Insert cell
Insert cell
viewof
bins
=
Inputs
.
range
(
[
3
,
20
]
,
{
step
:
1
,
label
:
"Bins"
}
)
Insert cell
Plot
.
plot
(
{
marks
:
[
Plot
.
ruleY
(
[
0
]
)
,
Plot
.
rectY
(
data
,
Plot
.
binX
(
{
y
:
"count"
}
,
{
x
:
"Distance"
,
thresholds
:
bins
,
fill
:
"#ff2800"
}
)
)
// forza ferrari fill ha
]
}
)
Insert cell
Insert cell
Insert cell
Plot
.
plot
(
{
x
:
{
tickFormat
:
"d"
}
,
marks
:
[
//Plot.dot(data, {x: "Year", y: "Distance"}),
Plot
.
line
(
data
,
{
x
:
"Year"
,
y
:
"Distance"
,
title
:
(
d
)
=>
// tooltip, see imports at bottom
`${
d
.
Car
} #${
d
[
"Car #"
]
} \n Year: ${
d
.
Year
} \n Team: ${
d
.
Team
} \n Distance: ${
d
.
Distance
} mi.`
}
)
]
}
)
Insert cell
Insert cell
viewof
regression_start_year
=
Inputs
.
range
(
[
1966
,
2015
]
,
{
value
:
2004
,
step
:
1
,
label
:
"Starting year:"
}
)
Insert cell
regressionPlot
=
Plot
.
plot
(
{
x
:
{
tickFormat
:
"d"
}
,
y
:
{
label
:
"Distance (mi.)"
}
,
marks
:
[
//Plot.dot(data, {x: "Year", y: "Distance"}),
Plot
.
line
(
lmdata
,
{
x
:
"Year"
,
y
:
"Distance"
}
)
,
Plot
.
linearRegressionY
(
lmdata
,
{
x
:
"Year"
,
y
:
"Distance"
,
stroke
:
"steelblue"
,
ci
:
0.95
}
)
]
}
)
Insert cell
Insert cell
lmdata
=
data
.
filter
(
d
=>
d
.
Year
>=
regression_start_year
)
Insert cell
Insert cell
// Import Plot with additional tooltip functionality from this notebook
import
{
Plot
}
from
"@mkfreeman/plot-tooltip"
Insert cell
Insert cell
Insert cell
data
=
FileAttachment
(
"daytona_24_overall_winners.csv"
)
.
csv
(
{
typed
:
true
}
)
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
bins
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
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
regression_start_year
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
regressionPlot
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
lmdata
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
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
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML