# Kibana7 Average aggregation line graph bug

**URL:** <https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551>\
**Category:** Kibana\
**Created:** [February 17, 2022, 10:37pm UTC](https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551 "2022-02-17T22:37:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimC](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timc/32/101968_2.png) [@TimC](https://discuss.elastic.co/u/TimC)\
**Post date:** [February 17, 2022, 10:37pm UTC](https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551/1 "2022-02-17T22:37:20Z")

</div>

I am migrating visualizations and dashboards from kibana 5 to 7

In Kibana7 line graphs aggregating Average with an X-Axis of Terms sorted by Sum (in our case we have a metric that is about time/power it took for this task to complete), the lines break if X-axis does not have a data point resulting in poor display. In Kibana5 lines connect skipping missing points and join to the next available data point making a cohesive usable linegraph.

I can reproduce with a line graph swapping in many different fields (or line on a bar graph):

- Metrics \> Y-axis \> Aggregate 'Average' \> Field (anything)
- Buckets \> X-axis \> Aggregate 'Terms' \> Field (anything) \> Order: Custom Metric \> (Sum of a field) \> Size: (large enough to give enough results for X)

Seems to only be an issue for aggregating by average.

This is causing issues in multiple user visualizations and dashboards. Any ideas to solve it? Maybe a hidden toggle to make it act like kibana 5?

Here is an example with kibana 5 at the top, 7 at the bottom

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/5/2514d4bd523b8ac54c5724054090ac3c2390d383.jpeg)

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

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [February 23, 2022, 9:07am UTC](https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551/2 "2022-02-23T09:07:36Z")

</div>

Hi @TimC,

what version of Kibana 7 are you using?

I've checked on a 7.16 instance and the line has an automatic fit with a dashed representation:

 ![Screenshot 2022-02-23 at 10.06.04](https://us1.discourse-cdn.com/elastic/original/3X/9/b/9b1d3f0f28d1cb6e1b2f13b4a8e22bd62ffbfe88.png)

---

<div class="post-metadata">

**Author:** ![TimC](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timc/32/101968_2.png) [@TimC](https://discuss.elastic.co/u/TimC)\
**Post date:** [February 23, 2022, 9:47pm UTC](https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551/3 "2022-02-23T21:47:47Z")

</div>

It looks like we are currently on Version 7.10.1  
Hopefully it is just a bug that has been patched then if it is working for you in 7.16. Is there any way you could roll that test back to 7.10.1? I am unsure if we can update quite yet, but it would be great to have confirmation that I'm not crazy 🙂

Thanks for the response!

---

<div class="post-metadata">

**Author:** ![TimC](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timc/32/101968_2.png) [@TimC](https://discuss.elastic.co/u/TimC)\
**Post date:** [February 24, 2022, 3:19am UTC](https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551/4 "2022-02-24T03:19:02Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/e/4/e46a354063552490b9f4d8dd42c456a747c66348.jpeg)

Actually, we were able to upgrade the test environment to 7.17. Yes this solves the issue! With the strange caveat that I have to rebuild the whole visualization, for some reason the existing viz adds those weird pointy downwards lines and no connecting dots still.

Top pic is problem viz reopened under 7.17, bottom is viz rebuilt under 7.17.

No problem though, it's still a solution!

Thank you for the help!

---

<div class="post-metadata">

**Author:** ![TimC](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timc/32/101968_2.png) [@TimC](https://discuss.elastic.co/u/TimC)\
**Post date:** [February 28, 2022, 9:43pm UTC](https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551/5 "2022-02-28T21:43:08Z")

</div>

Hi again Marco,

Flagging that this bug persists when selecting to make a visualization under type "bar" (which is how these were originally made in kibana5) and using a line view for an aggregation. It does however work if I rebuild the same graph under the "line" type visualization.

Top example is bar graph, bottom example is line graph. Same data and aggregations.

I will rebuild all these graphs under the "line" type, but I just wanted to flag the bug.  
Thanks!

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/d/4d31b28ec8f29c1caab1a145b21f22bc4d79c2be.jpeg)

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [March 1, 2022, 2:33pm UTC](https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551/6 "2022-03-01T14:33:48Z")

</div>

Hi @TimC

I've managed to reproduce the issue and logged it here: [[Visualize] Line fitting function does not work if Line is not the first metric defined · Issue #126598 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/126598)

I've found a workaround for it which can prevent you to duplicate all the charts: if you reorder the metrics putting the line chart as first metric then the fitting function will work fine. Hope it helps.

---

<div class="post-metadata">

**Author:** ![TimC](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timc/32/101968_2.png) [@TimC](https://discuss.elastic.co/u/TimC)\
**Post date:** [March 1, 2022, 5:07pm UTC](https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551/7 "2022-03-01T17:07:30Z")

</div>

Oh excellent, thanks for your help!

The confusion was because the comparison tests I created were done using line option, and the bug was present for 7.10 but fixed in 7.14 update. I did not realise the graphs I was migrating had used the bar option. It's a hard to tell what type is being used once inside the vis, aside from the icon in the listing page.

---

<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:** [March 29, 2022, 5:08pm UTC](https://discuss.elastic.co/t/kibana7-average-aggregation-line-graph-bug/297551/8 "2022-03-29T17:08:09Z")

</div>

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