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

Extracting nice time intervals? #36

Closed
curran opened this issue Dec 18, 2015 · 3 comments
Closed

Extracting nice time intervals? #36

curran opened this issue Dec 18, 2015 · 3 comments

Comments

@curran
Copy link
Contributor

curran commented Dec 18, 2015

In the case of aggregation over temporal bins, it would be great to have some way of extracting the interval from time.nice([count]). Given an approximate number of bins, I'd like to determine which time interval would yield closest to that number of bins. This is for creating a histogram with time as the X axis.

Perhaps there is already a way to do this, but I'm not seeing it. It's clear that the interval is computed internally (it looks like in tickInterval), but I don't see any way of extracting it through the API exposed.

Also looking at datalib's dl.bins.date, which seems to provide something similar.

@mbostock
Copy link
Member

This is for creating a histogram with time as the X axis.

The recommended way of doing this is to pass the result of time.ticks to histogram.thresholds. That said, it’d make sense to expose ticks and tickStep (or perhaps tickInterval) methods in d3-time, just like the methods I recently added to d3-array.

@curran
Copy link
Contributor Author

curran commented Dec 18, 2015

Thank you for considering this, I really appreciate it.

Passing the result into histogram.thresholds makes sense. But also, I'd like to use this functionality to drive a Crossfilter group, possibly "multidimensional histograms" using datalib, and maybe one day even server-side technology like Druid. I think for these cases it makes sense to be able to output the interval itself, such that it can be passed around between different technologies.

@mbostock
Copy link
Member

mbostock commented Apr 6, 2016

Closing in favor of d3/d3-time#8.

@mbostock mbostock closed this as completed Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants