Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time-based binning? #287

Closed
mbostock opened this issue Mar 30, 2021 · 2 comments · Fixed by #308
Closed

Time-based binning? #287

mbostock opened this issue Mar 30, 2021 · 2 comments · Fixed by #308
Labels
enhancement New feature or request

Comments

@mbostock
Copy link
Member

Related d3/d3-time#8.

@mbostock mbostock added the enhancement New feature or request label Mar 30, 2021
@Fil
Copy link
Contributor

Fil commented Mar 31, 2021

@mbostock
Copy link
Member Author

mbostock commented Apr 6, 2021

This works pretty well:

Plot.plot({
  marks: [
    Plot.rectY(selection, Plot.binX({y: "count"}, {
      x: "publish_time",
      thresholds: data => d3.utcDays(...d3.extent(data))
    }))
  ]
})

The bin transform could detect when the binned dimension is temporal (type inference). We could also support some shorthand for explicit time-based bins, e.g. “day” for days, or maybe passing in a d3 time interval?

@mbostock mbostock mentioned this issue Apr 9, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants