# How to Remove Gaps between graphs, once hour filter is applied

**URL:** <https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530>\
**Category:** Kibana\
**Created:** [June 21, 2023, 5:08am UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530 "2023-06-21T05:08:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [June 21, 2023, 5:08am UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/1 "2023-06-21T05:08:08Z")

</div>

Hello Team,  
I have been trying to put filter of hour on my graphical dashboard, which I did by putting a scripted field of Hour, and the same I have added as filter on my graphical dashboard

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/3/637ce0d0c2f3cc1a01dd4c1a4630305c22f533e0.png)

However, their are gaps visible on graphs, when putting filter to hour as visible in above given snapshot. Is their any solution, where I can avoid the gaps.  
For Eg.  
If I am putting filter from 07 to 2300 Hour filter, there should not be blanks for 00:00 hours to 06:00 hours (as shown in given graphs)

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [June 22, 2023, 3:36pm UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/2 "2023-06-22T15:36:59Z")

</div>

Is this Lens? If so you could modify your chart setting 'missing values' and 'show as dotted line'. here's an example:

 ![Screenshot 2023-06-22 at 17.34.38](https://us1.discourse-cdn.com/elastic/original/3X/a/1/a157ba51116093a4eb6a6aaf906d97a80af37462.jpeg)  
 ![Screenshot 2023-06-22 at 17.34.29](https://us1.discourse-cdn.com/elastic/original/3X/1/f/1ff9eda8212244575c1452fc4c169da4e26f678e.jpeg)  
 ![Screenshot 2023-06-22 at 17.37.17](https://us1.discourse-cdn.com/elastic/original/3X/0/d/0d1f7256c0c72a95749b17e74da3be381a4ca6dc.jpeg)

---

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [June 22, 2023, 4:10pm UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/3 "2023-06-22T16:10:58Z")

</div>

Hello, @Marta_Bondyra.  
Thank you for your response. However, I specifically require a solution using TSVB (Time Series Visual Builder).

Note - The solution you provided is not suitable for a bar chart since it only supports line charts. Please provide solution for Bar chart also.

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [June 22, 2023, 4:49pm UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/4 "2023-06-22T16:49:55Z")

</div>

Unfortunately, we don't plan to extend this issue to TSVB, here's the issue with the explanation: [TSVB Time Series Visualization - Handle "Missing" values · Issue #60802 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/60802)  
In regards to bar chart, what exactly do you mean? How would you like them to appear? As there's no value in the buckets where they are missing, nothing can be printed. For line charts it's different because of their continuous character – because we can connect two points, but it's difficult to visualize for bar charts so we don't provide that.

---

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [June 23, 2023, 5:19am UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/5 "2023-06-23T05:19:49Z")

</div>

Thanks @Marta_Bondyra  
One last query - instead of showing dot lines in Line chart for blank period. Is there any way to ignore the time period, for which filter is applied.

For example, If I am putting filter for 0800 to 1200 hour. So no 1300 hour is visible on axis. Any way to exclude Hours ?

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [June 23, 2023, 6:56am UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/6 "2023-06-23T06:56:49Z")

</div>

Do you mean that you want to have a date histogram chart but the chart is skipping some time of the day? Unfortunately this is not possible, but there is a workaround that can serve you but only for one day at the time. You could set up a runtime field `hour_of_day`:

 ![Screenshot 2023-06-23 at 08.52.43](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1aa44763dd5a563cff12c2405770199ee9cf65fc.jpeg)

and then, instead of date histogram (which has a continuous character and unfortunately we cannot skip some periods) you could do filters visualization. Bear in mind that this can be performance heavy, so make sure it's not straining your Kibana too much. You can add labels to your vis to make it look more like a date histogram. This, as I mentioned before will work only across one day because otherwise the values will be summed.

 ![Screenshot 2023-06-23 at 08.55.02](https://us1.discourse-cdn.com/elastic/original/3X/2/d/2d4db8026e0181d4a0096cb559bad15064d61f16.jpeg)

 ![Screenshot 2023-06-23 at 08.55.27](https://us1.discourse-cdn.com/elastic/original/3X/1/4/14df76e799e6d55396dbd694f6c44946f18db78a.png)

---

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [June 23, 2023, 9:56am UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/7 "2023-06-23T09:56:07Z")

</div>

Hello Marta,

Unfortunately, I am getting this error when creating scripted field as given by you

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/c/2cff6c98a869cb0f959edb829f6a7bee6367f1fe.png) or  
after giving semicolon too  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/9/89778899bd41de117296acc7491c7f85ddcf733c.png)

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [June 23, 2023, 10:02am UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/8 "2023-06-23T10:02:59Z")

</div>

Try correcting it to `getHour()` (capitalized 'H')

---

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [June 23, 2023, 10:23am UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/9 "2023-06-23T10:23:47Z")

</div>

Thanks @Marta_Bondyra  
I am able to draw graph now  
However I would like to ask one more query -  
When I am selecting two days, its summing up values, instead I want date wise hour from 07 to 23 hours. Dates are not getting reflected on axis...

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

Case - I need last 7 days data, which are having only Hours from 07:00 to 23:00 hours each day, without gaps

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [June 23, 2023, 12:17pm UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/10 "2023-06-23T12:17:20Z")

</div>

Yeah, I mentioned that in the workaround, unfortunately theres no way to do it for more than one day at the time ☹

> [@Marta\_Bondyra](#):
>
> Unfortunately this is not possible, but there is a workaround that can serve you but only for one day at the time.

---

<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:** [July 21, 2023, 12:18pm UTC](https://discuss.elastic.co/t/how-to-remove-gaps-between-graphs-once-hour-filter-is-applied/336530/11 "2023-07-21T12:18:14Z")

</div>

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