Dashboards & Visualizations

How to set properties in a custom visualization in Javascript?

simpkins1958
Contributor

Trying to use sample code from http://dev.splunk.com/view/webframework-developapps/SP-CAAAESD to set these properties in a custom visualization:

      <viz type="leaflet_maps_app.leaflet_maps" id="clusterMapId">
....
           <option name="leaflet_maps_app.leaflet_maps.mapCenterLat">46.0</option>
            <option name="leaflet_maps_app.leaflet_maps.mapCenterLon">120.0</option>
            <option name="leaflet_maps_app.leaflet_maps.mapCenterZoom">6</option>

With this javascript and not working:

require([
    "splunkjs/mvc",
    "splunkjs/mvc/simplexml/ready!"
], function(mvc) {


    // Get the Events table
    var myClusterMap = mvc.Components.get('clusterMapId');

    // Programmatically change a property in the Events table
    myClusterMap.getVisualization(function(eventsView) {
        eventsView.settings.set("leaflet_maps_app.leaflet_maps.mapCenterLon", "-120");
    });     
});
0 Karma

zeinstein
Path Finder

You might check out the answer here: https://answers.splunk.com/answers/500008/how-to-add-custom-option-to-a-panel.html
The main point being: custom app's custom options are not working anymore like they did before. So you might need some workarounds.
I hope it helps somewhat.

0 Karma
Get Updates on the Splunk Community!

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, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...