Skip to content

d3.bin with date/time values #134

@Fil

Description

@Fil

This is a bit of an open question rather than a specific issue, but, wouldn't it be useful to have a specific mode for dates?

Currently, to get meaningful bins of datetime data points, I believe one has to compute the thresholds outside, and do something like e.g.:

const ticks = d3.scaleTime().domain(d3.extent(data, d => d.date)).ticks(20);
bins = d3.bin().thresholds(ticks)(data)

and then, convert each bin’s x0 and x1 to Date objects.

See https://observablehq.com/d/8ab770342a94e839 for an example.

(maybe linked to #77)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions