mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-08 15:22:27 +00:00
Updates chart markup
This commit is contained in:
parent
fa241b08e7
commit
37cd7e684c
3 changed files with 32 additions and 42 deletions
|
@ -96,22 +96,22 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="columns is-multiline">
|
<div class="columns is-multiline">
|
||||||
<div class="column">
|
<div class="column is-half">
|
||||||
<h3>{% trans "Total users" %}</h3>
|
<h3>{% trans "Total users" %}</h3>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<canvas id="user_stats"></canvas>
|
<canvas id="user_stats"></canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column is-half">
|
||||||
<h3>{% trans "Status activity" %}</h3>
|
<h3>{% trans "Status activity" %}</h3>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<canvas id="status_stats"></canvas>
|
<canvas id="status_stats"></canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column is-half">
|
||||||
<h3>{% trans "User signup activity" %}</h3>
|
<h3>{% trans "User signup activity" %}</h3>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<canvas id="user_stats"></canvas>
|
<canvas id="register_stats"></canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,24 +1,19 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<script>
|
<script>
|
||||||
const labels = [{% for label in registration_stats.labels %}"{{ label }}",{% endfor %}];
|
var registerStats = new Chart(
|
||||||
const data = {
|
document.getElementById('register_stats'),
|
||||||
labels: labels,
|
{
|
||||||
datasets: [{
|
type: 'bar',
|
||||||
label: '{% trans "Active this month" %}',
|
data: {
|
||||||
backgroundColor: 'rgb(75, 192, 192)',
|
labels: [{% for label in register_stats.labels %}"{{ label }}",{% endfor %}],
|
||||||
borderColor: 'rgb(75, 192, 192)',
|
datasets: [{
|
||||||
data: {{ register_stats.total }},
|
label: '{% trans "Registrations" %}',
|
||||||
}]
|
backgroundColor: 'rgb(75, 192, 192)',
|
||||||
};
|
borderColor: 'rgb(75, 192, 192)',
|
||||||
|
data: {{ register_stats.total }},
|
||||||
const config = {
|
}]
|
||||||
type: 'line',
|
},
|
||||||
data: data,
|
options: {}
|
||||||
options: {}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
var userStats = new Chart(
|
|
||||||
document.getElementById('user_stats'),
|
|
||||||
config
|
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,26 +1,21 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<script>
|
<script>
|
||||||
const status_labels = [{% for label in status_stats.labels %}"{{ label }}",{% endfor %}];
|
|
||||||
const status_data = {
|
|
||||||
labels: status_labels,
|
|
||||||
datasets: [{
|
|
||||||
label: '{% trans "Statuses posted" %}',
|
|
||||||
backgroundColor: 'rgb(255, 99, 132)',
|
|
||||||
borderColor: 'rgb(255, 99, 132)',
|
|
||||||
data: {{ status_stats.total }},
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
// === include 'setup' then 'config' above ===
|
|
||||||
|
|
||||||
const status_config = {
|
|
||||||
type: 'bar',
|
|
||||||
data: status_data,
|
|
||||||
options: {}
|
|
||||||
};
|
|
||||||
|
|
||||||
var statusStats = new Chart(
|
var statusStats = new Chart(
|
||||||
document.getElementById('status_stats'),
|
document.getElementById('status_stats'),
|
||||||
status_config
|
{
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: [{% for label in status_stats.labels %}"{{ label }}",{% endfor %}],
|
||||||
|
datasets: [{
|
||||||
|
label: '{% trans "Statuses posted" %}',
|
||||||
|
backgroundColor: 'rgb(255, 99, 132)',
|
||||||
|
borderColor: 'rgb(255, 99, 132)',
|
||||||
|
data: {{ status_stats.total }},
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue