# Toggling legend in embedded visualizations

**URL:** <https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448>\
**Category:** Kibana\
**Created:** [May 19, 2017, 2:47pm UTC](https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448 "2017-05-19T14:47:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kostja79](https://avatars.discourse-cdn.com/v4/letter/k/3ec8ea/32.png) [@kostja79](https://discuss.elastic.co/u/kostja79)\
**Post date:** [May 19, 2017, 2:47pm UTC](https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448/1 "2017-05-19T14:47:06Z")

</div>

I embedded some Kibana visualizations in my html pages via iframe.  
How can I toggle every legend on load?

Thanks

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [May 19, 2017, 9:40pm UTC](https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448/2 "2017-05-19T21:40:57Z")

</div>

So you want the legend closed by default? Have you tried saving the visualizations with the legend closed? The state of the legend should be persisted in the saved visualization.

---

<div class="post-metadata">

**Author:** ![kostja79](https://avatars.discourse-cdn.com/v4/letter/k/3ec8ea/32.png) [@kostja79](https://discuss.elastic.co/u/kostja79)\
**Post date:** [May 22, 2017, 10:44am UTC](https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448/3 "2017-05-22T10:44:25Z")

</div>

Hi Barges,

thank you for your response.

Yes, it works saving the visualization with the legend close, I'm wondering if it is possible without modifying the visualizations.

Daniele

---

<div class="post-metadata">

**Author:** ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)\
**Post date:** [May 22, 2017, 11:32am UTC](https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448/4 "2017-05-22T11:32:38Z")

</div>

can you paste your url you are trying to embed ?

`<iframe src="https://localhost:5601/qgh/app/kibana#/visualize/edit/geosrc?embed=true&_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:'2017-05-20T20:21:55.159Z',mode:quick,to:'2017-05-22T10:00:00.000Z'))&_a=(filters:!(),linked:!f,query:(query_string:(analyze_wildcard:!t,query:'*')),uiState:(),vis:(aggs:!((enabled:!t,id:'1',params:(),schema:metric,type:count),(enabled:!t,id:'2',params:(field:geo.src,order:desc,orderBy:'1',row:!f,size:20),schema:split,type:terms),(enabled:!t,id:'3',params:(field:bytes,ranges:!((from:0,to:1000),(from:1000,to:2000),(from:2000,to:3000),(from:3000))),schema:group,type:range)),listeners:(),params:(addLegend:!t,addTimeMarker:!f,addTooltip:!t,defaultYExtents:!f,legendPosition:right,mode:percentage,scale:linear,setYExtents:!f,shareYAxis:!t,times:!(),yAxis:()),title:geosrc,type:histogram))" height="600" width="800"></iframe>`

for example, here you see the `addLegend:!t` .... changing it to `addLegend:!f` will hide it ...

---

<div class="post-metadata">

**Author:** ![kostja79](https://avatars.discourse-cdn.com/v4/letter/k/3ec8ea/32.png) [@kostja79](https://discuss.elastic.co/u/kostja79)\
**Post date:** [May 24, 2017, 10:55am UTC](https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448/5 "2017-05-24T10:55:40Z")

</div>

Hi Peter,

I was trying with the URL:  
[http://localhost/app/kibana#/visualize/edit/aeff4860-3c9c-11e7-8fd2-955d1cc3b06d?embed=true&\_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-12h,interval:'1h',mode:quick,timezone:Europe%2FBerlin,to:now)](http://localhost/app/kibana#/visualize/edit/aeff4860-3c9c-11e7-8fd2-955d1cc3b06d?embed=true&_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-12h,interval:'1h',mode:quick,timezone:Europe%2FBerlin,to:now)))

Now, following your hint, I appended:  
&\_a=(uiState:(vis:(colors:(KO:%23BF1B00,OK:%239AC48A),legendOpen:!f)))

So I'm able to manage the legend with the field "legendOpen". Unfortunately I can't avoid tu set also the field "color" instead to use the default setting.

Thanks

---

<div class="post-metadata">

**Author:** ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)\
**Post date:** [May 24, 2017, 2:24pm UTC](https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448/6 "2017-05-24T14:24:14Z")

</div>

just omit the `colors` part ?

---

<div class="post-metadata">

**Author:** ![kostja79](https://avatars.discourse-cdn.com/v4/letter/k/3ec8ea/32.png) [@kostja79](https://discuss.elastic.co/u/kostja79)\
**Post date:** [June 7, 2017, 10:32am UTC](https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448/7 "2017-06-07T10:32:40Z")

</div>

No, it doesn't work if I omit the "colors" part.

---

<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:** [July 5, 2017, 10:32am UTC](https://discuss.elastic.co/t/toggling-legend-in-embedded-visualizations/86448/8 "2017-07-05T10:32:48Z")

</div>

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