NexusDashboard/app/templates/reports/graph.html.j2

105 lines
2.9 KiB
Plaintext
Raw Permalink Normal View History

2022-03-14 03:10:07 +00:00
{% extends 'base.html.j2' %}
{% block title %}
2022-05-14 13:53:23 +00:00
{{ name }} History for {{start_date}} to {{end_date}}
2022-03-14 03:10:07 +00:00
{% endblock title %}
{% block content_before %}
2022-05-14 13:53:23 +00:00
{{ name }} History for {{start_date}} to {{end_date}}
2022-03-14 03:10:07 +00:00
{% endblock content_before %}
{% block content %}
2022-05-14 13:53:23 +00:00
<div class ="row">
{% if data_type == "items" %}
<div class="col">
<a role="button" class="btn btn-primary btn btn-block"
href='{{url_for('reports.items_graph', start=(start|int+1), end=(end|int+1))}}'>
Previous
</a>
</div>
{% if end|int > 0 %}
<div class="col">
<a role="button" class="btn btn-primary btn btn-block"
href='{{url_for('reports.items_graph', start=(start|int-1), end=(end|int-1))}}'>
Next
</a>
</div>
{% endif %}
{% elif data_type == "currency" %}
<div class="col">
<a role="button" class="btn btn-primary btn btn-block"
href='{{url_for('reports.currency_graph', start=(start|int+1), end=(end|int+1))}}'>
Previous
</a>
</div>
{% if end|int > 0 %}
<div class="col">
<a role="button" class="btn btn-primary btn btn-block"
href='{{url_for('reports.currency_graph', start=(start|int-1), end=(end|int-1))}}'>
Next
</a>
</div>
{% endif %}
{% elif data_type == "uscore" %}
<div class="col">
<a role="button" class="btn btn-primary btn btn-block"
href='{{url_for('reports.uscore_graph', start=(start|int+1), end=(end|int+1))}}'>
Previous
</a>
</div>
{% if end|int > 0 %}
<div class="col">
<a role="button" class="btn btn-primary btn btn-block"
href='{{url_for('reports.uscore_graph', start=(start|int-1), end=(end|int-1))}}'>
Next
</a>
</div>
{% endif %}
{% else %}
<h1> INVALID DATA TYPE </h1>
{% endif %}
</div>
<hr/>
2022-03-14 03:10:07 +00:00
<canvas id="item_chart"></canvas>
{% endblock %}
{% block js %}
{{ super () }}
<script type="text/javascript" src="{{ url_for('static', filename='chartjs/chart.min.js') }}"></script>
<script>
$(document).ready(function(){
let config = {
type: 'line',
data: {
labels: {{labels}},
datasets: {{datasets}},
},
options: {
2022-03-14 18:07:50 +00:00
plugins: { legend: { display: false }, },
scales: {
x: {
2022-05-14 13:53:23 +00:00
display: true,
2022-03-14 18:07:50 +00:00
title: {
display: true,
text: 'Date'
2022-05-14 13:53:23 +00:00
}
2022-03-14 18:07:50 +00:00
},
y: {
display: true,
2022-05-14 13:53:23 +00:00
title: {
2022-04-09 04:43:55 +00:00
display: true,
text: '{{ name }}'
2022-05-14 13:53:23 +00:00
}
2022-03-14 18:07:50 +00:00
}
}
2022-03-14 03:10:07 +00:00
}
};
let items_chart = new Chart(
document.getElementById('item_chart'),
config
);
}
);
</script>
{% endblock %}