diff --git a/puppetboard/templates/fact.html b/puppetboard/templates/fact.html index 2e3380f..ffaa5ce 100644 --- a/puppetboard/templates/fact.html +++ b/puppetboard/templates/fact.html @@ -1,9 +1,8 @@ {% extends 'layout.html' %} {% import '_macros.html' as macros %} -{% if render_graph %} - {% block javascript %} +{% if render_graph %} var chart = null; var data = [ {% for fact in facts|groupby('value') %} @@ -22,19 +21,21 @@ var otherdata = fact_values.slice(15); if (otherdata.length > 0) { realdata.push(["other", otherdata.reduce(function(a,b){return a + b[1];},0)]); } +{% endif %} {% endblock javascript %} {% block onload_script %} - $('table').tablesort(); - chart = c3.generate({ + $('table').tablesort(); + {% if render_graph %} + chart = c3.generate({ bindto: '#factChart', data: { columns: realdata, type : '{{config.GRAPH_TYPE|default('pie')}}', } -}); + }); + {% endif %} {% endblock onload_script %} -{% endif %} {% block content %}