mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-04 17:04:53 +02:00
up décompte de suivi des lieux et arbres
This commit is contained in:
parent
6c457986ad
commit
949dc71fb8
4 changed files with 65 additions and 23 deletions
|
@ -21,6 +21,7 @@
|
|||
{{ parent() }}
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns@3.0.0"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2"></script>
|
||||
<script>
|
||||
const series = {{ series|json_encode|raw }};
|
||||
const theme = {{ theme|json_encode|raw }};
|
||||
|
@ -40,6 +41,13 @@ if (canvas) {
|
|||
backgroundColor: 'rgba(0,0,255,0.1)',
|
||||
fill: false,
|
||||
yAxisID: 'y',
|
||||
datalabels: {
|
||||
align: 'top',
|
||||
anchor: 'end',
|
||||
display: true,
|
||||
formatter: function(value) { return value.y; },
|
||||
font: { weight: 'bold' }
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Complétion (%)',
|
||||
|
@ -48,6 +56,13 @@ if (canvas) {
|
|||
backgroundColor: 'rgba(0,255,0,0.1)',
|
||||
fill: false,
|
||||
yAxisID: 'y1',
|
||||
datalabels: {
|
||||
align: 'bottom',
|
||||
anchor: 'end',
|
||||
display: true,
|
||||
formatter: function(value) { return value.y + '%'; },
|
||||
font: { weight: 'bold' }
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -58,14 +73,29 @@ if (canvas) {
|
|||
title: {
|
||||
display: true,
|
||||
text: label
|
||||
},
|
||||
datalabels: {
|
||||
display: true
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
title: function(context) {
|
||||
// Affiche la date au survol
|
||||
return context[0].parsed.x ? new Date(context[0].parsed.x).toLocaleString() : '';
|
||||
},
|
||||
label: function(context) {
|
||||
return context.dataset.label + ': ' + context.parsed.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
x: { type: 'time', time: { unit: 'day' }, title: { display: true, text: 'Date' } },
|
||||
y: { beginAtZero: true, title: { display: true, text: 'Nombre' } },
|
||||
y1: { beginAtZero: true, position: 'right', title: { display: true, text: 'Complétion (%)' }, grid: { drawOnChartArea: false } }
|
||||
y1: { beginAtZero: true, position: 'right', title: { display: true, text: 'Complétion (%)' }, grid: { drawOnChartArea: false }, min: 0, max: 100 }
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: [ChartDataLabels]
|
||||
});
|
||||
}
|
||||
// Affichage de la progression sur une semaine
|
||||
|
|
|
@ -44,15 +44,13 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for type, points in series %}
|
||||
{% for point in points %}
|
||||
<tr>
|
||||
<td>{{ point.date }}</td>
|
||||
<td>{{ type }}</td>
|
||||
<td>{{ point.name }}</td>
|
||||
<td>{{ point.value }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% for point in all_points %}
|
||||
<tr>
|
||||
<td>{{ point.date }}</td>
|
||||
<td>{{ point.type }}</td>
|
||||
<td>{{ point.name }}</td>
|
||||
<td>{{ point.value }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -150,7 +148,7 @@
|
|||
scales: {
|
||||
x: { type: 'time', time: { unit: 'day' }, title: { display: true, text: 'Date' } },
|
||||
y: { beginAtZero: true, title: { display: true, text: 'Nombre' } },
|
||||
y1: { beginAtZero: true, position: 'right', title: { display: true, text: 'Complétion (%)' }, grid: { drawOnChartArea: false } }
|
||||
y1: { beginAtZero: true, position: 'right', title: { display: true, text: 'Complétion (%)' }, grid: { drawOnChartArea: false }, min: 0, max: 100 }
|
||||
}
|
||||
},
|
||||
plugins: [ChartDataLabels]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue