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
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
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
Can I change this through JSON??
@flash1293 is this possible ?
Thanks
Rashmi
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.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.