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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...