Dashboards & Visualizations

How to force re-rendering of chart elements in HTML dashboards?

smichalski
Explorer

Hi everybody,

inside our Splunk 6.1 HTML dashboards, we use a custom CSS to increase the charts' font-size and JS to hide and display element-groups on user interaction. Basically, this does work. Unfortunately on charts that had been hidden at the initialization of the dashboard and displayed subsequently, larger legends get partially cut off or unreadably condensed.

I assume that is because Splunk renders the Highcharts invisibly with some default values, so that a re-displayed chart gets spoiled when the browser applies the custom CSS belatedly. If you change the height of the chart manually by dragging its resize-bar, the chart gets re-rendered with the correct proportions and everything looks fine again. Is there a way to bin re-rendering/re-drawing/re-freshing of a single chart or all charts to something else, like clicking a link? So that re-rendering is triggered when the show/hide link is clicked.

I experimented on something like the following (jQuery) which would work, but it ignores a defined height and sets the chart back to 250px default:

$('a#mylink').on("click", function(event) {
    element1.render();
});

Any better ideas?

Cheers, Sven

piUek
Path Finder

How are You hiding these charts?
And how/where do You set chart height?

There are few ways for re-rendering the charts or managing their attributes, but You have to use splunkjs to get to them. In example type this in javascript console:

get the list of splunk elements (to get the chart):

splunkjs.mvc.Components.getInstanceNames();

get Your chart:

var chart = splunkjs.mvc.Components.getInstance('example-chart');

hide chart:

chart.hide();

show chart:

chart.show();

change chart height:

chart.settings.set('height', 600);

kartik13
Communicator

Hi,
I am trying to change the search to which it is linked . After changing it i want to re render the chart with new values.
Can you update on this, if it is being solved.

Thanks

0 Karma

ankit_vasudeva
Engager

I am facing similar issue. Did you get any solution?

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...