Platform
Resources
Pricing
Sign in
Get started
Guillaume Levrier
Workspace
Fork
Published
By
Guillaume Levrier
Edited
Aug 28, 2020
1 star
Insert cell
Insert cell
buildDataTime
(
)
Insert cell
parseTime
=
d3
.
timeParse
(
"%d/%m/%Y"
)
;
Insert cell
2
function
buildDataTime
(
)
{
let
dataTime
=
[
]
data
.
forEach
(
d
=>
{
dataTime
.
push
(
{
"name"
:
d
.
name
,
"amount"
:
d
.
amount
,
"date"
:
parseTime
(
d
.
date
)
}
)
}
)
return
d3
.
group
(
dataTime
,
d
=>
d
.
date
)
}
Insert cell
data
=
[
{
name
:
"jim"
,
amount
:
"34.0"
,
date
:
"11/12/2015"
}
,
{
name
:
"carl"
,
amount
:
"120.11"
,
date
:
"11/12/2015"
}
,
{
name
:
"stacy"
,
amount
:
"12.01"
,
date
:
"01/04/2016"
}
,
{
name
:
"stacy"
,
amount
:
"34.05"
,
date
:
"01/04/2016"
}
]
Insert cell
d3
=
require
(
"d3@6"
)
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
parseTime
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
buildDataTime
Show 2 comments
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
d3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML