# Date histogram "auto" interval

**URL:** <https://discuss.elastic.co/t/date-histogram-auto-interval/92815>\
**Category:** Kibana\
**Created:** [July 12, 2017, 1:37pm UTC](https://discuss.elastic.co/t/date-histogram-auto-interval/92815 "2017-07-12T13:37:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheTannerRyan](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@TheTannerRyan](https://discuss.elastic.co/u/TheTannerRyan)\
**Post date:** [July 12, 2017, 1:37pm UTC](https://discuss.elastic.co/t/date-histogram-auto-interval/92815/1 "2017-07-12T13:37:45Z")

</div>

Hello everyone,

I was looking through the source files on GitHub, trying to find the function that determines the automatic time interval though I could not find it.

I am working on a project, and I would like to have dynamic time intervals (e.g. large range =\> lower resolution, small range =\> higher resolution).

Does anyone know where I would be able to locate this function?

Thanks,

Tanner

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [July 12, 2017, 11:58pm UTC](https://discuss.elastic.co/t/date-histogram-auto-interval/92815/2 "2017-07-12T23:58:55Z")

</div>

Ultimately, auto interval calculation happens here: [https://github.com/elastic/kibana/blob/master/src/ui/public/time\_buckets/calc\_auto\_interval.js](https://github.com/elastic/kibana/blob/master/src/ui/public/time_buckets/calc_auto_interval.js)

That module is used by the `TimeBuckets` class: [https://github.com/elastic/kibana/blob/master/src/ui/public/time\_buckets/time\_buckets.js](https://github.com/elastic/kibana/blob/master/src/ui/public/time_buckets/time_buckets.js)

And the `TimeBuckets` class is instanciated for each date\_histogram bucket aggregation here: [https://github.com/elastic/kibana/blob/master/src/ui/public/agg\_types/buckets/date\_histogram.js#L56](https://github.com/elastic/kibana/blob/master/src/ui/public/agg_types/buckets/date_histogram.js#L56)

Hope that helps a little

---

<div class="post-metadata">

**Author:** ![TheTannerRyan](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@TheTannerRyan](https://discuss.elastic.co/u/TheTannerRyan)\
**Post date:** [July 13, 2017, 12:10am UTC](https://discuss.elastic.co/t/date-histogram-auto-interval/92815/3 "2017-07-13T00:10:43Z")

</div>

This is exactly what I was looking for.

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 10, 2017, 12:10am UTC](https://discuss.elastic.co/t/date-histogram-auto-interval/92815/4 "2017-08-10T00:10:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
