From 7d5743578fcfc687079b66efcb1a50cfe5af12cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Fri, 23 Sep 2022 15:18:24 +0200
Subject: [PATCH] fix: backwater curves chart: restore filled legend rectangle
 items

refs #554
---
 src/app/components/remous-results/line-and-chart-data.ts  | 6 ++++--
 .../components/remous-results/remous-results.component.ts | 8 ++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/app/components/remous-results/line-and-chart-data.ts b/src/app/components/remous-results/line-and-chart-data.ts
index c0c7b1d17..433e147f6 100644
--- a/src/app/components/remous-results/line-and-chart-data.ts
+++ b/src/app/components/remous-results/line-and-chart-data.ts
@@ -193,13 +193,15 @@ export class ChartData {
     /**
      * Dessigne une ligne droite entre y0 (abscisse 0) et ymax (abscisse max),
      * sans passer par les mÊthodes mapPoint() et mapY() utilisÊes dans drawLine
+     * @param fillArea true pour remplir la zone sous la ligne
+     * @param fillColor couleur de remplissage de la zone sous la ligne
      */
-    public drawSimpleLine(y0: number, ymax: number, prof: number, color: string, lbl: string, fillColor?: string) {
+    public drawSimpleLine(y0: number, ymax: number, prof: number, color: string, lbl: string, fillArea: boolean = false, fillColor?: string) {
         const l = this.newLine(prof);
         l.setPoint(0, y0);
         l.setPoint(this._longBief, ymax);
         l.data = {
-            label: lbl, fill: fillColor !== undefined, tension: 0, spanGaps: true,
+            label: lbl, fill: fillArea, tension: 0, spanGaps: true,
             borderColor: color, backgroundColor: fillColor, pointRadius: 0, showLine: "true"
         };
     }
diff --git a/src/app/components/remous-results/remous-results.component.ts b/src/app/components/remous-results/remous-results.component.ts
index 0e810fe2a..e982e1999 100644
--- a/src/app/components/remous-results/remous-results.component.ts
+++ b/src/app/components/remous-results/remous-results.component.ts
@@ -272,18 +272,18 @@ export class RemousResultsComponent extends ResultsComponentDirective implements
         }
 
         // ligne de fond
-        gr1.drawSimpleLine(ZF1, ZF2, 3, "#753F00", this.uitextFond, "#753F00");
+        gr1.drawSimpleLine(ZF1, ZF2, 3, "#753F00", this.uitextFond, true, "#753F00");
 
         // ligne de berge
         if (hauteurBerge) {
-            gr1.drawSimpleLine(ZF1 + hauteurBerge, ZF2 + hauteurBerge, 4, "#C58F50", this.uitextBerge);
+            gr1.drawSimpleLine(ZF1 + hauteurBerge, ZF2 + hauteurBerge, 4, "#C58F50", this.uitextBerge, false, "#C58F50");
         }
 
         // hauteur normale
         if (this._remousResults.hautNormale?.ok) {
             const Yn = this._remousResults.hautNormale.vCalc;
             gr1.drawSimpleLine(Yn + ZF1, Yn + ZF2,
-                5, "#A4C537", this.uitextTirantNormal
+                5, "#A4C537", this.uitextTirantNormal, false, "#A4C537"
             );
         }
 
@@ -291,7 +291,7 @@ export class RemousResultsComponent extends ResultsComponentDirective implements
         if (this._remousResults.hautCritique?.ok) {
             const Yc = this._remousResults.hautCritique.vCalc;
             gr1.drawSimpleLine(Yc + ZF1, Yc + ZF2,
-                6, "#FF0000", this.uitextTirantCritique
+                6, "#FF0000", this.uitextTirantCritique, false, "#FF0000"
             );
         }
 
-- 
GitLab