Splunk Search

Is it possible to hide the legend on Choropleth Maps?

romanokpbah
Engager

I've got iplocation data that I'm visualizing with a Choropleth. In my dashboard there will only be a single IP represented on the map. The country where the coordinates fall will be shaded in.

Since I'm only representing one value, the legend is unnecessary. Is there a way to hide the legend?

I tried the charting.legend.placement = none option, but it doesn't seem to have an effect on the Choropleth.

fabricebourel
Explorer

I think charting.legend.placement is not the right option to use for a choropleth map.

Using simpleXML in Splunk UI, I successfully used <option name="mapping.legend.placement">none</option> instead.

This is not well documented in the reference available at https://docs.splunk.com/Documentation/Splunk/7.2.3/Viz/PanelreferenceforSimplifiedXML (search for Complete Choropleth map example). I found it by simply editing the source generated in my dashboard in Splunk UI for my choropleth object ("Format Visualization" button) when I checked "Show Legend" to "no".

Using SplunkJS in my own external webapp, on the other side, "mapping.legend.placement":"none", has no effect.

0 Karma

niketn
Legend

You can do this by using CSS Extension to Simple XML Dashboard in Splunk

Code for CSS to override legend style to hide the same (say choropleth_style_override.css)

/* Choropleth Hide Map Legend */
.legend.leaflet-control {
    visibility: hidden !important;
}

To be saved in your Splunk Apps static folder(create if it does not exist)

$SPLUNK_HOME/etc/app/<YourAppName>/appserver/static

Finally reference CSS file in your form or dashboard using stylesheet atrribute in the root node

<dashboard stylesheet="choropleth_style_override.css">

PS: CSS and JS extensions to dashboards require you to restart Splunk and may need to clear browser history.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

@romanokpbah @charliedgz were you able to try CSS extension based solution to hide legends in choropleth map?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

fabricebourel
Explorer

The CSS is correct:

/* Choropleth Hide Map Legend */
.legend.leaflet-control {
    visibility: hidden !important;
}

It works also when using SplunkJS on an external Webapp.

0 Karma

charliedgz
Path Finder

Is it not possible to hide the legend? A whole year and no response... Shouldn't this be relatively simple...

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...