Quantcast
Channel: Latest Questions on Splunk Answers
Viewing all articles
Browse latest Browse all 13053

Web Framework - django and 3dchart - Modifying default chart settings and options

$
0
0

Hi All,

I have generated a view in html that uses Django and the all new (and very cool) Web framework.

I have some issue to apply custom settings to my chart (actually a discretebar d3chart) using django...

The doc (http://docs.splunk.com/Documentation/WebFramework) says how to modify chart settings (like activating the option showvalue=true) when using JS but not when using Django.

Based on an example taken in the Web Framework Toolkit (essentially the view d3chart), my view generates my charts as follows:

  • The django block that sets the chart itself (based on a postprocess search):

{% block chart %}

{% d3chart 
    id="d3chart1"
    managerid="post1"
            type="discreteBarChart"
    valueField="conso"
    labelField="LPAR"
    categoryField="LPAR"
%}

{% endblock chart %} - The block managers thats sets associated searches (based it self on various dropdown):

{% block managers %}

{% searchmanager 
id="search1"
search='index=nmon_lpar sourcetype=nmon_lpar PSERIES=$valuespsearies$ earliest="$earlyval$" latest="$lateval$" | eval conso=((EC_User_PCT+EC_Sys_PCT+EC_Wait_PCT+EC_Idle_PCT)*entitled/100) | $filtertime$ | stats $statmode$ by LPAR | eval conso=round(conso,2)'|token_safe 
preview=True    
%}

{% postprocessmanager 
id="post1" 
managerid="search1" 
search="| sort - conso | head 8" 
%}

{% searchmanager 
id="single1"
search='index=nmon_lpar sourcetype=nmon_lpar PSERIES=$valuespsearies$ earliest="$earlyval$" latest="$lateval$" | head 1 | fields PSERIES | dedup PSERIES'|token_safe 
preview=True    
%}

{% searchmanager
id="pseriessearch"
search="| inputlookup sysplan_pseries_config | fields PSERIES | dedup PSERIES | sort PSERIES" 
preview=True
%}

{% endblock managers %}

This works as expected and generates that kind of views (a bubblechart associated with a discretebarchart):

alt text

I have 2 related problem, the first one is to be able to set various custom chart settings.

As mentioned in the Framework doc, i've tried to adapt the JS section:

exemple of the doc:

donut_chart.settings.set("setup", function(chart){
    chart.color(d3.scale.category10().range());
    chart.staggerLabels(true);
    chart.showValues(true);
});

To things like:

 var d3chart = mvc.Components.getInstance("d3chart1");

    d3chart.settings.set("setup", function(chart){
       chart.color(d3.scale.category10().range());
      chart.staggerLabels(true);
         chart.showValues(true);
        });

With no results... (i'm taken for example the activation of show values which is currently off)

And tried others things but still with no results.

Does anyone knows how to deal with it ? I would greatly appreciate ! :-)

I guess that my main issue comes from the fact that i use django to iniate both the search and the graph (and not JS) but the Framework components reference doc does not specify how to do it when using django and not JS for this... (i would have to rewrite all the view using JS...)

The second question is related to the search itself, is there any JobProgressIndicator like module for django and JS views ? The search (based on TimeRange and other pulldown) may require time to be fully executed, the only for the user to know when the search is terminated is when charts stop to move! (sic!)

Many thanks in advance for any help !

The Web Framework is very interesting and i'm dealing to globalize it to my views...


Viewing all articles
Browse latest Browse all 13053

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>