Commit 6c91510c98bfea73c7845bcea23cc091d1705337
Committed by
Sergio Oliveira
1 parent
7ef2dcac
Exists in
master
and in
39 other branches
Fix bug in doughnut chart
Showing
1 changed file
with
17 additions
and
15 deletions
Show diff stats
src/templates/doughnut-chart.html
| ... | ... | @@ -13,21 +13,23 @@ $(function () { |
| 13 | 13 | var data = []; |
| 14 | 14 | |
| 15 | 15 | {% for option, value in chart_data.items %} |
| 16 | - color = colors.shift(); | |
| 17 | - data.push( | |
| 18 | - { | |
| 19 | - value: {{ value }}, | |
| 20 | - color: color, | |
| 21 | - highlight: chroma(color).darken().hex(), | |
| 22 | - label: "{{ option }}" | |
| 23 | - } | |
| 24 | - ); | |
| 25 | - description.append($('<label>') | |
| 26 | - .addClass('label label-default') | |
| 27 | - .css('background', color) | |
| 28 | - .append('{{ option }}') | |
| 29 | - ); | |
| 30 | - description.append(' '); | |
| 16 | + {% if value > 0 %} | |
| 17 | + color = colors.shift(); | |
| 18 | + data.push( | |
| 19 | + { | |
| 20 | + value: {{ value }}, | |
| 21 | + color: color, | |
| 22 | + highlight: chroma(color).darken().hex(), | |
| 23 | + label: "{{ option }}" | |
| 24 | + } | |
| 25 | + ); | |
| 26 | + description.append($('<label>') | |
| 27 | + .addClass('label label-default') | |
| 28 | + .css('background', color) | |
| 29 | + .append('{{ option }}') | |
| 30 | + ); | |
| 31 | + description.append(' '); | |
| 32 | + {% endif %} | |
| 31 | 33 | {% endfor %} |
| 32 | 34 | |
| 33 | 35 | var context = $('.{{ chart_canvas }} > canvas').get(0).getContext("2d"); | ... | ... |