Dashboards & Visualizations

Bubble chart in Django using webframework

rsathish47
Contributor

Hi All,

Am using Cascading form inputs module for the bubble chart. But when i pass the tokens to the search bubble chart is not working if i gave plain search without tokens in bubble chart is working. Please help

{% extends "splunkdj:base_with_app_bar.html" %}

{% load splunkmvc %}
{% load splunk_wftoolkit %}

{% block title %}Cascading Form Inputs - Web Framework Toolkit{% endblock title %}

{% block css %}

{% endblock css %}

{% block content %}




Cascading form inputs



<div class="dashboard-row">
    <div class="dashboard-cell" style="width: 50%;">
        <div class="dashboard-panel">
            <div class="dashboard-element">
                <div class="panel-head">
                    <h3>Cascading dropdown lists</h3>
                </div>
                <div class="panel-body">
                    <p>AssignedGrpSerach?</p>
                    {% dropdown id="Assigned_Groups" managerid="AssignedGrpSerach" default="*" valueField="Assigned_Group" %}
                    <p>Assignee?</p>
                    {% dropdown id="Assignees" managerid="AssigneeSearch" valueField="Assignee" %}
                    <button id="searchbutton" class="btn btn-primary">Search</button>
                </div>
            </div>
        </div>
    </div>
    <div class="dashboard-cell" style="width: 50%;">
        <div class="dashboard-panel">
            <div class="dashboard-element">
                <div class="panel-head">
                </div>
                <div class="panel-body">
                    {% single id="singlevalue" managerid="simplesearch1" beforeLabel="Event Count: " %}
                </div>
            </div>
        </div>
    </div>
</div>
<Div class="dashboard-row">
     <div class="dashboard-cell" style="width: 100%;">
    <div class="dashboard-cell" style="width: 50%;">
        <div class="dashboard-panel">
            <div class="dashboard-element">
                <div class="panel-head">
                </div>
                <div class="panel-body">
                    {% bubblechart 
                        id="bubble1" 
                        managerid="search1"
                        valueField="count"
                        labelField="Assigned_Status"
                        categoryField="Assigned_Status"
                    %}
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock content%}

{% block managers %}

{% searchmanager id="AssignedGrpSerach"
search="| inputcsv OpenIncidents.csv | dedup Assigned_Group | table Assigned_Group"
cache=True preview=True %}

{% searchmanager id="AssigneeSearch" 
    search="|inputcsv OpenIncidents.csv| search Assigned_Group=\"$Assigned_Group$\" | dedup Assignee | table Assignee |sort Assignee"|token_safe 
    cache=True preview=True autostart=False %}

{% searchmanager id="simplesearch1" 
    search="| inputcsv OpenIncidents.csv | search Assigned_Group=\"$Assigned_Group$\"  Assignee=\"$Assignee$\" | stats count"|token_safe 
    preview=True cache=True autostart=False %}

{% searchmanager id="search1" 
    search="| inputcsv OpenIncidents.csv | search Assigned_Group=\"$Assigned_Group$\"  Assignee=\"$Assignee$\"| eval Assigned_Status=if(isnull(Assignee),\"Unassigned\",Status) | stats count by Assigned_Status" 
    preview=True cache=True  autostart=False %}

{% endblock managers %}

{% block js %}

{% endblock js %}

0 Karma

aelliott
Motivator

try defaulting the token values to something.
This is how I would do it:

right away set your tokens to blank
tokens.set("Assigned_Group","");

When you do set it, do this instead:
tokens.set("Assigned_Group","AssignedGroup=\"" + indexes.val() + "\"");

Then in your search query just set $Assigned_Group$

I do not use the values on the actual dropdowns as setting them to * may not produce results that are intended.

rsathish47
Contributor

Thanks aelliott.. i will try this option...
As of now i used postprocess search to overcome this....

Thanks

Sathish R

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Get Agentic with Splunk Lantern: Connect to Cisco Cloud Control, Transform ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

July Community Events: Master ITSI 5.0 & Automate Splunk

Struggling with alert fatigue or feeling like you're spending more time on infrastructure maintenance than ...

New Release of Federated Search: Bringing Splunk Analytics to More of Your Data

Organizations today are generating more data than ever and storing it across cloud object stores, data lakes, ...