# Label alignment with two layers (7.15.0)

**URL:** <https://discuss.elastic.co/t/label-alignment-with-two-layers-7-15-0/285334>\
**Category:** Kibana\
**Tags:** lens\
**Created:** [September 28, 2021, 10:01am UTC](https://discuss.elastic.co/t/label-alignment-with-two-layers-7-15-0/285334 "2021-09-28T10:01:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomhe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomhe/32/120065_2.png) [@tomhe](https://discuss.elastic.co/u/tomhe)\
**Post date:** [September 28, 2021, 10:01am UTC](https://discuss.elastic.co/t/label-alignment-with-two-layers-7-15-0/285334/1 "2021-09-28T10:01:03Z")

</div>

I have a lens visualization (in version 7.15.0) where I want bar chart showing "Closed" vs "Not closed" where I color "Closed" with green and "Not closed" with red. To be able to set different colors for the bars I use two layers, but the thickness of the bars is halved causing the alignment of the labels to look weird.

Is this a bug or am I doing something wrong?

 ![kibana alignement](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7ebc68b87d41224070eec2d87ff5c4befe5b528d.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:** [September 28, 2021, 1:01pm UTC](https://discuss.elastic.co/t/label-alignment-with-two-layers-7-15-0/285334/2 "2021-09-28T13:01:55Z")

</div>

Hi @tomhe ,

welcome to the Kibana community.

I think you can achieve what you want with a single layer in Lens, with filtered metrics. Here I've used the `extension.keyword` with `"css"/"deb"` instead of your `Closed/Not closed` categories, but the same result applies.

 ![Screenshot 2021-09-28 at 14.58.26](https://us1.discourse-cdn.com/elastic/original/3X/4/0/40a18f3c7fd4a0899e41031874037e50f701d171.png)

On the "Horizontal axis" you can filter a metric as shown here (click `Add advanced options`):

 ![Screenshot 2021-09-28 at 14.58.44](https://us1.discourse-cdn.com/elastic/original/3X/c/7/c718e3449f504400253166fd8fa69c87b22adbb9.png)

Is this what you were looking for?

---

<div class="post-metadata">

**Author:** ![tomhe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomhe/32/120065_2.png) [@tomhe](https://discuss.elastic.co/u/tomhe)\
**Post date:** [September 28, 2021, 1:57pm UTC](https://discuss.elastic.co/t/label-alignment-with-two-layers-7-15-0/285334/3 "2021-09-28T13:57:46Z")

</div>

Yes, that's what I'm looking for. You're right in that I don't need two layers for this.

The alignment is actually correct and the empty space refers to a bar with zero hits.

The trick is to switch to stacked bars.

Bar horizontal:

 ![closed4](https://us1.discourse-cdn.com/elastic/original/3X/b/1/b142bce7fa345f348d2023c3ec9e521f5130cd59.png)

Bar horizontal stacked:

 ![closed3](https://us1.discourse-cdn.com/elastic/original/3X/7/f/7f1778abd8352100e47d368f840a1974f1660e6b.png)

Going with stacked bars moves the "empty" bar to the end (or beginning) of the bars.

Thank you!

---

<div class="post-metadata">

**Author:** ![tomhe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomhe/32/120065_2.png) [@tomhe](https://discuss.elastic.co/u/tomhe)\
**Post date:** [September 28, 2021, 2:18pm UTC](https://discuss.elastic.co/t/label-alignment-with-two-layers-7-15-0/285334/4 "2021-09-28T14:18:02Z")

</div>

My only problem now is that I prefer to have the number inside the bars like this:

![closed5](https://us1.discourse-cdn.com/elastic/original/3X/e/d/ed5a25c669b987165d64d803827fe3cce64479e6.png)

But showing the numbers inside the bars like that is not possible for stacked bars:

![closed6](https://us1.discourse-cdn.com/elastic/original/3X/2/e/2e031ec2a4ce508d2398bf26826ace200a93c51d.png)

So either I can have my color coding or I can have the numbers.

Well, well.

---

<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:** [September 28, 2021, 2:34pm UTC](https://discuss.elastic.co/t/label-alignment-with-two-layers-7-15-0/285334/5 "2021-09-28T14:34:19Z")

</div>

Oh right.  
There's an issue for stacked bar you can track for value labels: [[Lens] Display total value on top of each bar in the vertical bar chart · Issue #55262 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/55262)

---

<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:** [October 26, 2021, 2:34pm UTC](https://discuss.elastic.co/t/label-alignment-with-two-layers-7-15-0/285334/6 "2021-10-26T14:34:27Z")

</div>

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