# How to create : Stacked bar chart with negative values

**URL:** https://discuss.elastic.co/t/how-to-create-stacked-bar-chart-with-negative-values/280169
**Category:** Kibana
**Created:** [August 2, 2021, 1:44am UTC](https://discuss.elastic.co/t/how-to-create-stacked-bar-chart-with-negative-values/280169 "2021-08-02T01:44:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![HuongCV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/huongcv/32/83849_2.png) [@HuongCV](https://discuss.elastic.co/u/HuongCV)
#### Post date: [August 2, 2021, 1:44am UTC](https://discuss.elastic.co/t/how-to-create-stacked-bar-chart-with-negative-values/280169/1 "2021-08-02T01:44:29Z")

</div>

I want to create a visualization : Stacked bar chart with negative values.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/7/476c2c19801373f19a3e7aab065779fa3b33adff.png)  
Let me know if kibana supports this chart.  
Thanks

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 2, 2021, 4:01am UTC](https://discuss.elastic.co/t/how-to-create-stacked-bar-chart-with-negative-values/280169/2 "2021-08-02T04:01:22Z")

</div>

Hi @HuongCV

I am checking on this... This does work "Non Stacked" In Lens.

Here is what it looks like Non Stacked

 ![Screen Shot 2021-08-01 at 8.51.33 PM](https://us1.discourse-cdn.com/elastic/original/3X/3/5/35dea387549082d3d94f48caa7ff48f9b7bb7dbb.png)

However, Stacked does not look correct (I would expect Same Line +/-) but it does not look correct so I am checking to see if there is an issue / bug,

You can use Vega but that is much more complex than Lens

Here is the data I used for this ... it does require +/- data

```auto
DELETE discuss-pos-neg

PUT discuss-pos-neg/
{
  "mappings": {
    "properties": {
      "category" : {"type": "keyword"},
      "value" : {"type": "float"}
    }
  }
}

POST discuss-pos-neg/_doc
{
      "category" : "10-20",
      "value" : 32
}

POST discuss-pos-neg/_doc
{
      "category" : "10-20",
      "value" : -45
}

POST discuss-pos-neg/_doc
{
      "category" : "20-30",
      "value" : 64
}

POST discuss-pos-neg/_doc
{
      "category" : "20-30",
      "value" : -23
}

POST discuss-pos-neg/_doc
{
      "category" : "30-40",
      "value" : 57
}

POST discuss-pos-neg/_doc
{
      "category" : "30-40",
      "value" : -33
}

GET discuss-pos-neg/_search

```

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 2, 2021, 1:14pm UTC](https://discuss.elastic.co/t/how-to-create-stacked-bar-chart-with-negative-values/280169/3 "2021-08-02T13:14:40Z")

</div>

UPDATE : Yes there is a bug currently in the Rendering of this in Lens  
[Here](https://github.com/elastic/elastic-charts/issues/1280) is the opened github, unfortunately I do not have an ETA on this.

So it seems that if you need that exact Viz today you will need to use Vega, unfortunately I am not a Vega Expert.

---

<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 30, 2021, 1:15pm UTC](https://discuss.elastic.co/t/how-to-create-stacked-bar-chart-with-negative-values/280169/4 "2021-08-30T13:15:35Z")

</div>

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