19744: Better incorporation of the text report data into HTML
[arvados.git] / tools / crunchstat-summary / crunchstat_summary / webchart.py
index 31afcf64e906166788bf06b9caa4ed191ead13c9..4c596902ba22da4faf13317c46e591cb5f1acdd6 100644 (file)
@@ -24,15 +24,45 @@ class WebChart(object):
         self.label = label
         self.summarizers = summarizers
 
-    def html(self):
+    def html(self, beforechart='', afterchart=''):
         return '''<!doctype html><html><head>
         <title>{} stats</title>
         <script type="text/javascript" src="{}"></script>
         <script type="text/javascript">{}</script>
+        <style>
+        table {{
+          width: 90%
+        }}
+        td {{
+          width: 20%
+        }}
+        #chart {{
+          margin-top: 2em;
+        }}
+        #bottomhtml {{
+          margin-top: 4em;
+        }}
+        </style>
         {}
-        </head><body></body></html>
+        </head>
+        <body>
+        <h1>{}</h1>
+        <div id="tophtml">
+        {}
+        </div>
+        <div id="chart"></div>
+        <div id="bottomhtml">
+        {}
+        </div>
+        </body>
+        </html>
         '''.format(escape(self.label),
-                   self.JSLIB, self.js(), self.headHTML())
+                   self.JSLIB,
+                   self.js(),
+                   self.headHTML(),
+                   escape(self.label),
+                   beforechart,
+                   afterchart)
 
     def js(self):
         return 'var chartdata = {};\n{}'.format(