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!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...