All Apps and Add-ons

Implementing Sankey Chart in Django

theouhuios
Motivator

Hello

How do I add a Sankey chart (or for that matter any webframework toolkit chart) to an exisiting django view. I followed this and was able to create a django dashboard. But now I want to add a panel with sankey chart in the same dashboard. I followed the example in Webtoolkit app and according to the code mentioned on how to use it in other views. This is the code which I am using as of now.

<div class="dashboard-row dashboard-row3 id=example-chart"></div>
<script>
require([
"splunkjs/ready!",
"jquery",
"splunk_wftoolkit/components/sankey/sankey",
],
function(mvc, $, Sankey) {
var sankey = new Sankey({
'id' : 'example',
'managerid' : 'search_chart',
'el' : $('#example-chart')
}).render();
});
</script>

and the searchmanager is

{% searchmanager
        id="search_chart"
        search="index=_internal | head 1000 | stats count by sourcetype clientip"
       cache=True
    %}

But it says No results even though there are results when I run the search. Any help on how to implement this.

0 Karma

magnew_splunk
Splunk Employee
Splunk Employee

Hi theouhuios,

This looks mostly right--I don't see anything obviously wrong with the way you are wiring it up. How do you know the search gets data? If you put a built in chart in the place of the sankey, does that show data?

The only thing I see here that I don't expect to work is that you are missing some quotation marks in your div definition. It should be:

<div class="dashboard-row dashboard-row3" id="example-chart"></div>
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 ...