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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...