Hide legends in vertical bar chart in Kibana 7.4.2

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

Can someone please help

1 Like

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

2 Likes

Can I change this through JSON??

@flash1293 is this possible ?

Thanks
Rashmi

@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:

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:

// 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

Thanks for the solution.

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