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!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...