@@ -67,6 +75,20 @@ var currentPeriod = 'today';
/* --- Graphique CSS pur --- */
+function renderYAxis(max) {
+ var yaxis = document.getElementById('chart-yaxis');
+ yaxis.textContent = '';
+ var values = [max, Math.round(max / 2), 0];
+ values.forEach(function(v) {
+ var lbl = document.createElement('div');
+ lbl.style.fontSize = '0.6rem';
+ lbl.style.color = '#6c757d';
+ lbl.style.lineHeight = '1';
+ lbl.textContent = v;
+ yaxis.appendChild(lbl);
+ });
+}
+
function renderChart(data) {
var container = document.getElementById('chart-container');
var labelsEl = document.getElementById('chart-labels');
@@ -79,6 +101,7 @@ function renderChart(data) {
labelsEl.textContent = '';
if (!data || data.length === 0) {
+ renderYAxis(0);
var msg = document.createElement('span');
msg.className = 'text-muted small';
msg.textContent = 'Aucune donnee disponible.';
@@ -88,6 +111,7 @@ function renderChart(data) {
var max = 1;
data.forEach(function(d) { if ((d.count || 0) > max) max = d.count; });
+ renderYAxis(max);
data.forEach(function(item) {
var count = item.count || 0;
@@ -132,6 +156,7 @@ function renderWeekly(weekly) {
if (allNull) {
container.style.display = 'none';
labelsEl.style.display = 'none';
+ document.getElementById('chart-yaxis').textContent = '';
unavail.classList.remove('d-none');
return;
}