# Hide legends in vertical bar chart in Kibana 7.4.2

**URL:** https://discuss.elastic.co/t/hide-legends-in-vertical-bar-chart-in-kibana-7-4-2/227843
**Category:** Kibana
**Created:** [April 14, 2020, 3:22am UTC](https://discuss.elastic.co/t/hide-legends-in-vertical-bar-chart-in-kibana-7-4-2/227843 "2020-04-14T03:22:41Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![RAM\_NATHAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_nathan/32/50393_2.png) [@RAM\_NATHAN](https://discuss.elastic.co/u/RAM_NATHAN)
#### Post date: [April 14, 2020, 3:22am UTC](https://discuss.elastic.co/t/hide-legends-in-vertical-bar-chart-in-kibana-7-4-2/227843/1 "2020-04-14T03:22:41Z")

</div>

I wish to hide the legend in vertical bar chart. It looks odd if number of entries goes beyond 10/15 in x axis

 ![Capture](https://us1.discourse-cdn.com/elastic/original/3X/7/b/7ba035973d787bf1da0c9579aa6cca1791d79b03.png)

Can someone please help

---

<div class="post-metadata">

### Author: ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)
#### Post date: [April 14, 2020, 4:34am UTC](https://discuss.elastic.co/t/hide-legends-in-vertical-bar-chart-in-kibana-7-4-2/227843/2 "2020-04-14T04:34:22Z")

</div>

You can right now you can show/hide the legend by clicking on the arrow next to the legend. Just as a small experiment create your visualization and collapse legend. now save your visualization. (legend state will get saved with it).If you add it to dashboard now legend will be collapsed by default.

Thanks  
Rashmi

---

<div class="post-metadata">

### Author: ![RAM\_NATHAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_nathan/32/50393_2.png) [@RAM\_NATHAN](https://discuss.elastic.co/u/RAM_NATHAN)
#### Post date: [April 15, 2020, 11:26am UTC](https://discuss.elastic.co/t/hide-legends-in-vertical-bar-chart-in-kibana-7-4-2/227843/3 "2020-04-15T11:26:16Z")

</div>

Can I change this through JSON??

---

<div class="post-metadata">

### Author: ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)
#### Post date: [April 15, 2020, 7:47pm UTC](https://discuss.elastic.co/t/hide-legends-in-vertical-bar-chart-in-kibana-7-4-2/227843/4 "2020-04-15T19:47:38Z")

</div>

@flash1293 is this possible ?

Thanks  
Rashmi

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [April 16, 2020, 7:10am UTC](https://discuss.elastic.co/t/hide-legends-in-vertical-bar-chart-in-kibana-7-4-2/227843/5 "2020-04-16T07:10:39Z")

</div>

@RAM_NATHAN

The complete configured state ends up in the JSON some way or the other - the legend toggle can be found in the `visState` under `params.addLegend`:

 ![Screenshot 2020-04-16 at 09.06.05](https://us1.discourse-cdn.com/elastic/original/3X/9/8/984df4b51b39ebfcebd34536dde031acbe33974b.png)

One thing to note here: To simplify the object structure, `visState` is encoded as JSON again. So when working there, you basically have to do the following:

```auto
// doc contains the saved object as parsed json
const visStateJSON = doc.attributes.visState;
// parse the nested visState JSON
const visState = JSON.parse(visStateJSON);
// do your thing with the visState
visState.params.addLegend = false;
// stringify again to put it back
doc.attributes.visState = JSON.stringify(visState);
// save doc through the api

```

---

<div class="post-metadata">

### Author: ![RAM\_NATHAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_nathan/32/50393_2.png) [@RAM\_NATHAN](https://discuss.elastic.co/u/RAM_NATHAN)
#### Post date: [April 16, 2020, 7:54am UTC](https://discuss.elastic.co/t/hide-legends-in-vertical-bar-chart-in-kibana-7-4-2/227843/6 "2020-04-16T07:54:26Z")

</div>

Thanks for the solution.

---

<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: [May 14, 2020, 7:54am UTC](https://discuss.elastic.co/t/hide-legends-in-vertical-bar-chart-in-kibana-7-4-2/227843/7 "2020-05-14T07:54:29Z")

</div>

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