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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...