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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...