Splunk Dev

SplunkJs in an AngularJs app... How to re-render() the charts?

northben
Explorer

I am building a dashboard using AngularJs and Splunk. When I navigate back to a view, the charts are gone, and I can't figure out how to get them to re-render. I am not sure if this is more of a question for Splunk developers or Angular developers. I am still learning Angular, and there aren't a lot of SplunkJs examples/docs, so here I am.

The code in question begins here: https://github.com/northben/splunk-dashboard/blob/master/app/home/home.js#L62

Here's the deployed app: dashboard.pixelchef.net/
Here's my repo: https://github.com/northben/splunk-dashboard

0 Karma

northben
Explorer

I solved my own problem... Thanks to piUek on https://answers.splunk.com/answers/216495/how-to-force-re-rendering-of-chart-elements-in-htm.html, I was able to implement the following code (to be refactored, of course):

$scope.$on("$destroy", function() {
      mvc.Components.getInstance('mysearch1').dispose();
    });
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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