From e1603608bc472453b3b212ef7a2e737a63367245 Mon Sep 17 00:00:00 2001 From: Spencer Krum Date: Wed, 28 Aug 2013 17:07:33 -0700 Subject: [PATCH] _macros.html: Add a second Pie chart to facts/ The second chart is in order of the value of the fact. So in the uptime fact we see 1 day before 2 days before 50 days. --- puppetboard/templates/_macros.html | 28 ++++++++++++++++++++++++++-- puppetboard/templates/fact.html | 1 + 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/puppetboard/templates/_macros.html b/puppetboard/templates/_macros.html index 508f984..1d03aa3 100644 --- a/puppetboard/templates/_macros.html +++ b/puppetboard/templates/_macros.html @@ -46,8 +46,32 @@ var data = [ } ] var ctx = document.getElementById("factChart").getContext("2d"); - var myNewChart = new Chart(ctx).Pie(data); - new Chart(ctx).Pie(data); + new Chart(ctx).Pie(data.sort(function(a,b) { return parseFloat(a.value) - parseFloat(b.value)})); + +{%- endmacro %} +{% macro facts_graph_value(facts, autofocus=False, condensed=False, show_node=False, margin_top=20, margin_bottom=20) -%} + + + {%- endmacro %} diff --git a/puppetboard/templates/fact.html b/puppetboard/templates/fact.html index bafd909..e2d3ded 100644 --- a/puppetboard/templates/fact.html +++ b/puppetboard/templates/fact.html @@ -3,5 +3,6 @@ {% block content %}

{{name}}

{{macros.facts_graph(facts, autofocus=True, show_node=True, margin_bottom=10)}} +{{macros.facts_graph_value(facts, autofocus=True, show_node=True, margin_bottom=10)}} {{macros.facts_table(facts, autofocus=True, show_node=True, margin_bottom=10)}} {% endblock content %}