Skip to content

Commit

Permalink
feat: dashboard rendering for not opened
Browse files Browse the repository at this point in the history
  • Loading branch information
dodumosu committed Aug 8, 2021
1 parent f915254 commit 191e3c6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions apollo/frontend/templates/frontend/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h5 class="text-center">{% if not location and not request.args.location %}<a cl
</div>
{%- if session['dashboard_chart_type'] == 'bar' %}
<pre style="display:none" id="csvdata">
Id,Link,Name,Complete,Offline,Partial,Missing
Id,Link,Name,Complete,Offline,Partial,Missing,Closed
{% for row in data -%}
{{ row.id }},
{%- if group %}
Expand All @@ -65,7 +65,7 @@ <h5 class="text-center">{% if not location and not request.args.location %}<a cl
{{ url_for('dashboard.checklists', form_id=form_id, group=row.slug, locationtype=locationtype, **args) }}
{%- endif %}
{%- endif -%}
,"{{ row.name }}",{{ row.Complete }},{{ row.Offline }},{{ row.Partial }},{{ row.Missing }}
,"{{ row.name }}",{{ row.Complete }},{{ row.Offline }},{{ row.Partial }},{{ row.Missing }},{{ row.Closed }}
{% endfor -%}
</pre>
<div id="barchart"></div>
Expand Down Expand Up @@ -171,23 +171,25 @@ <h5 class="text-center">{% if not location and not request.args.location %}<a cl
.set('Missing', json.Missing + (json.Conflict || 0))
.set('Partial', json.Partial)
.set('Complete', json.Complete)
.set('No Signal', json.Offline);
var labels = ['Missing', 'Partial', 'Complete', 'No Signal'];
.set('No Signal', json.Offline)
.set('Not Opened', json.Closed);
var labels = ['Missing', 'Partial', 'Complete', 'No Signal', 'Not Opened'];
var labelsMap = new Map()
.set('Missing', "{{ _('Missing') }}")
.set('Partial', "{{ _('Partial') }}")
.set('Complete', "{{ _('Complete') }}")
.set('No Signal', "{{ _('No Signal') }}");
var colors = ["#dc3545", "#ffc107", "#007bff", "#aaaaaa"];
var label_colors = ["#ffffff", "#000000", "#ffffff", "#000000"];
.set('No Signal', "{{ _('No Signal') }}")
.set('Not Opened', "{{ _('Not Opened') }}");
var colors = ["#dc3545", "#ffc107", "#007bff", "#aaaaaa", "#374151"];
var label_colors = ["#ffffff", "#000000", "#ffffff", "#000000", "#ffffff"];
var total_label = "{{ _('Total') }}";

drawPieChart(el, dataMap, labels, labelsMap, colors, label_colors, total_label);
});
{%- else %}
let rawData = d3.select('#csvdata').text();
let csvData = d3.csvParse(rawData);
let colors = ["#007bff", "#aaaaaa", "#ffc107", "#dc3545"];
let colors = ["#007bff", "#aaaaaa", "#ffc107", "#dc3545", "#374151"];

drawNormalizedBarchart('#barchart', csvData, colors);
{%- endif %}
Expand Down

0 comments on commit 191e3c6

Please sign in to comment.