created MultipleChartsView

This commit is contained in:
artus40
2017-08-18 14:00:59 +02:00
parent c8c59b92a2
commit 6d2ce7d7bc
6 changed files with 189 additions and 103 deletions

View File

@@ -1,5 +1,2 @@
<div class="row text-center" id="wrapper-{{ chart.get_html_id}}">
<div id="{{ chart.get_html_id }}" style="width: {{ chart.width }}px; height: {{ chart.height }}px;"></div>
<a class="btn btn-sm btn-default" href="#" id="image-{{ chart.get_html_id }}"><span class="glyphicon glyphicon-save-file"></span> Télécharger l'image</a>
</div>

View File

@@ -6,13 +6,13 @@
</a>
</li>
<li role="presentation" {% active namespace="statistiques" viewname="pies" %}>
<a href="{% url "statistiques:pies" %}?year={{year|default:0}}{% if month %}&month={{month}}{% endif %}">Typologie du public&nbsp;
<span class="glyphicon glyphicon-adjust"></span>
<a href="{% url "statistiques:pies" %}?year={{year|default:0}}{% if month %}&month={{month}}{% endif %}">Typologie&nbsp;
<span class="glyphicon glyphicon-user"></span>
</a>
</li>
<li role="presentation" {% active namespace="statistiques" viewname="frequentation" %}>
<a href="{% url "statistiques:frequentation" %}?year={{year|default:0}}{% if month %}&month={{month}}{% endif %}">Fréquentation&nbsp;
<span class="glyphicon glyphicon-adjust"></span>
<span class="glyphicon glyphicon-stats"></span>
</a>
</li>
</ul>

View File

@@ -0,0 +1,43 @@
{% extends "statistiques/base.html" %}
{% block title %}{{block.super}} {{page_title}}{% endblock %}
{% block breadcrumbs %}{{block.super}}<li>{{page_title}}</li>{% endblock %}
{% block sidebar %}
{{ block.super }}
<div class="panel panel-primary">
<div class="panel-body text-right">
{% include "statistiques/filter_form.html" %}
<hr />
<p>Échantillon : {{ queryset_count }} objets</p>
</div>
</div>
{% endblock %}
{% block page_content %}
<script type="text/javascript">
function hideAll() {
{% for _, graph in graphs %}{% with graph.get_html_id as id %}
$("#tab-{{id}}").attr("class", "");
$("#wrapper-{{id}}").hide();
{% endwith %}{% endfor %}
}
function showGraph(id) {
hideAll();
$("#tab-" + id).attr("class", "active");
$("#wrapper-" + id).show();
}
</script>
<ul class="nav nav-tabs">
{% for title, graph in graphs %}<li role="presentation" id="tab-{{graph.get_html_id}}"><a href="#" onclick="showGraph('{{graph.get_html_id}}');">{{ title }}</a></li>{% endfor %}
</ul>
{% for title, graph in graphs %}
<div class="row text-center" id="wrapper-{{ graph.get_html_id}}">
{{ graph.as_html }}
</div>
{% endfor %}
{% endblock %}