Package: libjs-jquery-flot
Version: 4.2.1+dfsg-2
Severity: normal
Forwarded: https://github.com/flot/flot/issues/1708
Tags: patch

Dear Maintainer,

With the upgrade to 4.x, flot lost the ability to control the legenda
background. All legends come up with black text on black blackground,
and therefore are broken by default. This has been reported upstream
more than a year ago, with a patch, and is still unfixed.

The attached patch is from https://github.com/flot/flot/pull/1709, and I
confirm that it applies cleanly to the current package and fixed the
issue for me.

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 
'unstable'), (500, 'testing'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-1-amd64 (SMP w/4 CPU threads)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8), 
LANGUAGE=pt_BR:pt:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libjs-jquery-flot depends on:
ii  libjs-jquery  3.5.1+dfsg+~3.5.5-7

Versions of packages libjs-jquery-flot recommends:
ii  javascript-common  11+nmu1
ii  libjs-excanvas     0.r4~git20090427.0000000-4

Versions of packages libjs-jquery-flot suggests:
pn  libjs-jquery-flot-docs  <none>

-- no debconf information
From bc3315ba9723bcc93c95e4820537d0432b984cd6 Mon Sep 17 00:00:00 2001
From: Marcos <[email protected]>
Date: Mon, 7 Oct 2019 16:28:19 -0300
Subject: [PATCH] Make flot to control legend backgrounds using SVG fill
 property.

SVG 2.0 uses the "fill" property to control the background color of
shapes and text.

The CSS property "background-color" has no effect on the new SVG shapes spec.
---
 source/jquery.flot.legend.js | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/source/jquery.flot.legend.js b/source/jquery.flot.legend.js
index eb48ac9d..888eafb2 100644
--- a/source/jquery.flot.legend.js
+++ b/source/jquery.flot.legend.js
@@ -11,7 +11,9 @@
             container: null, // container (as jQuery object) to put legend in, null means default on top of graph
             position: 'ne', // position of default legend container within plot
             margin: 5, // distance from grid edge to default legend container within plot
-            sorted: null // default to no legend sorting
+            sorted: null, // default to no legend sorting
+            backgroundColor: null, 
+            backgroundOpacity: 0 // No background shows by default
         }
     };
 
@@ -154,6 +156,20 @@
             options.legend.container.style.width = width + 'px';
             options.legend.container.style.height = height + 'em';
         }
+
+        // ----------------------------------------------------------------------------------------
+        // Control backgroundColor
+        // ----------------------------------------------------------------------------------------
+        if(options.legend.backgroundColor){
+            $('.legendLayer rect.background').css({
+                'fill': options.legend.backgroundColor, // New SVG 2.0 spec, uses fill
+                'background': options.legend.backgroundColor, // Back compau with SVG 1.1
+            });            
+        }
+        // ----------------------------------------------------------------------------------------
+        // Control background-opacity
+        // ----------------------------------------------------------------------------------------
+        $('.legendLayer rect.background').css('opacity', options.legend.backgroundOpacity? options.legend.backgroundOpacity : 1);
     }
 
     // Generate html for a shape

Attachment: signature.asc
Description: PGP signature

Reply via email to