Ajoute le total en bas de chaque graph Charges structurelles par client
Ligne "Total" sous le graph principal et sous chacune des cartes par année -- somme calculée à partir des items déjà tracés (sumItems()), pas d'un champ stats séparé, pour rester cohérente par construction avec les barres affichées au-dessus.
This commit is contained in:
@@ -364,6 +364,25 @@ html.gin--dark-mode #figli-dashboard-app {
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
/* Total line under an h-bar-chart (currently just Charges structurelles
|
||||
par client, main chart and each per-année card) -- separate from the
|
||||
chart component itself, plain right-aligned text matching
|
||||
.figli-hbar-value's alignment/tabular-nums so the total lines up
|
||||
visually with the bars' own value column above it. */
|
||||
#figli-dashboard-app .figli-chart-total {
|
||||
margin-top: 0.5rem;
|
||||
padding-top: 0.5rem;
|
||||
border-top: 1px solid var(--figli-border);
|
||||
text-align: right;
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
#figli-dashboard-app .figli-chart-total.is-compact {
|
||||
margin-top: 0.4rem;
|
||||
padding-top: 0.4rem;
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
|
||||
/* --- Year small multiples (par année, next to the all-time chart) --- */
|
||||
#figli-dashboard-app .figli-year-hbar-grid {
|
||||
display: grid;
|
||||
|
||||
@@ -270,6 +270,14 @@
|
||||
typeColor(item) {
|
||||
return TYPE_COLORS[item.type] || '#6b7280';
|
||||
},
|
||||
// Sum of an hbar chart's own items -- for the "Total" line under
|
||||
// Charges structurelles par client (main chart and each per-année
|
||||
// card): those items are already whatever's actually plotted, so
|
||||
// summing them directly (rather than a separate stats field) keeps
|
||||
// the total consistent with the bars above it by construction.
|
||||
sumItems(items) {
|
||||
return items.reduce((sum, i) => sum + i.value, 0);
|
||||
},
|
||||
async load() {
|
||||
this.loading = true;
|
||||
this.error = null;
|
||||
|
||||
@@ -64,10 +64,12 @@
|
||||
<h2>Charges structurelles par client</h2>
|
||||
<p class="figli-note">Montant total (HT, valeur absolue) des charges structurelles par vendeur/organisme, toutes années confondues.</p>
|
||||
<h-bar-chart :items="chargeParClientItems" :format-value="formatEurRound" :color-for="typeColor"></h-bar-chart>
|
||||
<div class="figli-chart-total">Total : {{ formatEurRound(sumItems(chargeParClientItems)) }}</div>
|
||||
<div class="figli-year-hbar-grid">
|
||||
<div class="figli-year-hbar-card" v-for="y in chargeParClientParAnnee" :key="y.annee">
|
||||
<div class="figli-year-hbar-title">{{ y.annee }}</div>
|
||||
<h-bar-chart :items="y.items" :format-value="formatEurRound" :color-for="typeColor" compact></h-bar-chart>
|
||||
<div class="figli-chart-total is-compact">Total : {{ formatEurRound(sumItems(y.items)) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user