Bug 70720

Summary: systemd-analyze: SVG output is hard to read (transparent background)
Product: systemd Reporter: Jean Delvare <jdelvare>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Sample output from systemd-analyze plot version 207

Description Jean Delvare 2013-10-21 11:51:15 UTC
In systemd version 207, "systemd-analyze plot" generates an SVG file with transparent background. Transparent background is typically rendered as a grey checker (in eog, gimp...) which makes the lines at the top of the picture as well as the legend at the bottom very hard to read.

Systemd version 195 did not suffer from this problem. The output of "systemd-analyze plot" had white background.
Comment 1 Jean Delvare 2013-10-21 11:53:09 UTC
Created attachment 87920 [details]
Sample output from systemd-analyze plot version 207
Comment 2 Thomas H.P. Andersen 2013-10-21 12:13:08 UTC
You can manually add a line to the svg in the <defs><style>:
"svg        { background: rgb(255,255,255); }"


I can commit this fix later when I am at my laptop:
index c088cad..3303b55 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -122,6 +122,7 @@ static void svg_header(void) {
         /* style sheet */
         svg("<defs>\n  <style type=\"text/css\">\n    <![CDATA[\n");

+        svg("      svg        { background: rgb(255,255,255); }\n");
         svg("      rect       { stroke-width: 1; }\n");
         svg("      rect.cpu   { fill: rgb(64,64,240); stroke-width: 0; fill-opacity: 0.7; }\n");
         svg("      rect.wait  { fill: rgb(240,240,0); stroke-width: 0; fill-opacity: 0.7; }\n");
Comment 3 Jean Delvare 2013-10-21 13:44:17 UTC
I tried editing the SVG file manually as you suggested but it did not work.

I don't know much about SVG but the files generated by previous versions of systemd-analyze used to have an explicit rectangle drawn for the background:

<rect x="0" y="0" width="1035" height="3104" style="fill:rgb(100%,100%,100%);fill-opacity:1;stroke:none;"/>
Comment 4 Thomas H.P. Andersen 2013-10-21 19:41:42 UTC
You were right. Just setting the style for the entire svg only worked in firefox which was where I was testing. I commited a different fix that adds a style:
rect.background   { fill: rgb(255,255,255); }\n
and a rect:
<rect class="background" width="100%" height="100%" />

Tested with firefox, eog, and gimp.

http://cgit.freedesktop.org/systemd/systemd/commit/?id=418e37506e6a419a808a82081ca1616caa03a206
Comment 5 Jean Delvare 2013-10-22 07:25:45 UTC
I tried manually editing the SVG output with the method described in comment #4 and the result looks good in eog. Thanks for the quick fix!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.