# Kibana line chart for interval 1 day and time last 7 days gives 8 data points

**URL:** https://discuss.elastic.co/t/kibana-line-chart-for-interval-1-day-and-time-last-7-days-gives-8-data-points/116126
**Category:** Kibana
**Created:** [January 18, 2018, 7:47pm UTC](https://discuss.elastic.co/t/kibana-line-chart-for-interval-1-day-and-time-last-7-days-gives-8-data-points/116126 "2018-01-18T19:47:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![RohanKumbhar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohankumbhar/32/23649_2.png) [@RohanKumbhar](https://discuss.elastic.co/u/RohanKumbhar)
#### Post date: [January 18, 2018, 7:47pm UTC](https://discuss.elastic.co/t/kibana-line-chart-for-interval-1-day-and-time-last-7-days-gives-8-data-points/116126/1 "2018-01-18T19:47:13Z")

</div>

Hi ,

i'm creating line graph for last 7 days of data with interval =1day but it gives me 8 data points (or buckets)  
for example, today is thursday 18-jan-2018 then it gives me data from last thursday 11-jan-2018  
so ideally it should give me 7 data points only but it gives 8 points

Is there any specific reason for this?

Thanks,  
ROhan

---

<div class="post-metadata">

### Author: ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)
#### Post date: [January 18, 2018, 9:07pm UTC](https://discuss.elastic.co/t/kibana-line-chart-for-interval-1-day-and-time-last-7-days-gives-8-data-points/116126/2 "2018-01-18T21:07:18Z")

</div>

It may seem confusing but this is the desired behavior. Here are the data points:

January 11 (7 days ago)  
January 12 (6 days ago)  
January 13 (5 days ago)  
January 14 (4 days ago)  
January 15 (3 days ago)  
January 16 (2 days ago)  
January 17 (1 days ago)  
January 18 (0 days ago)

If you're not rounding to the nearest day, both January 11 and January 18 will be partial buckets, which is why they're shaded in the graph.

Which data point are you expecting not to show up in the graph? If you're wanting exactly 7 data points, perhaps you should select a relative time range from 7 days ago (rounded to the nearest day) to 1 day ago (rounded to the nearest day). This will cause all of the buckets to be complete, but you'll also not see any data for today.

---

<div class="post-metadata">

### Author: ![RohanKumbhar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohankumbhar/32/23649_2.png) [@RohanKumbhar](https://discuss.elastic.co/u/RohanKumbhar)
#### Post date: [January 19, 2018, 8:27am UTC](https://discuss.elastic.co/t/kibana-line-chart-for-interval-1-day-and-time-last-7-days-gives-8-data-points/116126/3 "2018-01-19T08:27:55Z")

</div>

Thanks @lukas !

I want to skip the last thursdays data and its fine if this thursdays data is shown partial.

Thanks,  
Rohan

---

<div class="post-metadata">

### Author: ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)
#### Post date: [January 19, 2018, 8:22pm UTC](https://discuss.elastic.co/t/kibana-line-chart-for-interval-1-day-and-time-last-7-days-gives-8-data-points/116126/4 "2018-01-19T20:22:18Z")

</div>

Okay, then you should choose a relative time interval from 6 days ago (rounded to nearest day) to now.

---

<div class="post-metadata">

### Author: ![RohanKumbhar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohankumbhar/32/23649_2.png) [@RohanKumbhar](https://discuss.elastic.co/u/RohanKumbhar)
#### Post date: [January 22, 2018, 7:06am UTC](https://discuss.elastic.co/t/kibana-line-chart-for-interval-1-day-and-time-last-7-days-gives-8-data-points/116126/5 "2018-01-22T07:06:32Z")

</div>

Hi @lukas,

Is there any way to display the buckets /key\_as\_string value in hours as well when i select the interval 1 day.

for example :  
i'm using the range filter query with date histogram aggregation with interval =1day  
{  
"range": {  
"my\_date": {  
"gte": "now-6d/d",  
"lte": "now/d" \<----2018-01-16 at 06:00 AM  
}  
}  
}

So i'm expecting the bucket values as per the the hour with interval 1day as shown below  
"buckets": [  
{  
"key\_as\_string": "2018-01-16T06:00:00.000Z",  
},  
{  
"key\_as\_string": "2018-01-15T06:00:00.000Z",  
},  
{  
"key\_as\_string": "2018-01-14T06:00:00.000Z",  
},  
{  
"key\_as\_string": "2018-01-13T06:00:00.000Z",  
},  
{  
"key\_as\_string": "2018-01-12T06:00:00.000Z",  
},  
{  
"key\_as\_string": "2018-01-11T06:00:00.000Z",  
},  
{  
"key\_as\_string": "2018-01-10T06:00:00.000Z",  
}  
]

But the values of bucket are gettting rounded off to 00 hours like shown below  
"key\_as\_string": "2018-01-16T00:00:00.000Z",  
"key\_as\_string": "2018-01-15T00:00:00.000Z",  
"key\_as\_string": "2018-01-13T00:00:00.000Z",  
"key\_as\_string": "2018-01-12T00:00:00.000Z",  
"key\_as\_string": "2018-01-11T00:00:00.000Z",  
"key\_as\_string": "2018-01-10T00:00:00.000Z",

Is there any way to get exact bucket values as per the time of filter applied with the interval =1d?

Thanks,  
Rohan

---

<div class="post-metadata">

### Author: ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)
#### Post date: [January 29, 2018, 6:15pm UTC](https://discuss.elastic.co/t/kibana-line-chart-for-interval-1-day-and-time-last-7-days-gives-8-data-points/116126/6 "2018-01-29T18:15:35Z")

</div>

I think what will accomplish what you're asking is to open up the "advanced" section and enter `{"offset": "+6h"}`:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/c/acc63c1579d4c7ba3866555af7ddcb887bbeb591.png)

---

<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: [February 26, 2018, 6:21pm UTC](https://discuss.elastic.co/t/kibana-line-chart-for-interval-1-day-and-time-last-7-days-gives-8-data-points/116126/7 "2018-02-26T18:21:45Z")

</div>

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