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
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...