[Git][NTPsec/ntpsec][master] ntpviz: make command line plots work again.

Gary E. Miller gitlab at mg.gitlab.com
Wed Oct 5 01:44:17 UTC 2016


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
c416a2a5 by Gary E. Miller at 2016-10-04T18:43:58-07:00
ntpviz: make command line plots work again.

multiplot labels broken.

- - - - -


1 changed file:

- ntpstats/ntpviz


Changes:

=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -744,21 +744,25 @@ plot \
 
 def local_offset_multiplot(statlist):
     "Plot comparative local offsets for a list of NTPViz objects."
+
     plot = NTPViz.Common + '''\
-set title "Local Clock Offsets"
-set ytics format "%%1.2f μs" nomirror textcolor rgb "#0060ad"
+set title "Multiplot Local Clock Offsets"
+set ytics format "%1.2f μs" nomirror textcolor rgb "#0060ad"
 set key bottom right box
 plot \\
 '''
     # FIXME: We probably need to be more flexible about computing the plot label
-    sitenames = [os.path.basename(os.path.dirname(d)) for d in statsdirs]
+    sitenames = [os.path.basename(os.path.dirname(d)) for d in args.statsdirs]
     for (i, stats) in enumerate(statlist):
         plot += '"-" using 1:($2*1000000) title "%s clock offset μs" with linespoints, \\\n' % (sitenames[i])
     plot = plot[:-4] + "\n"
     for stats in statlist:
         plot += stats.dump("loopstats") + "e\n"
-    plot = plot[:-2]
-    return plot
+
+    ret = {'html' : '', 'percs' : '' }
+    ret['title'] = "Multiplot"
+    ret['plot'] = plot
+    return ret
 
 # here is how to create the base64 from an image file:
 # with open("path/to/file.png", "rb") as f:
@@ -1039,7 +1043,7 @@ Python by ESR, concept and GNUPLOT code by Dan Drown.
                 raise SystemExit(1)
             if None != args.show_peer_offsets:
                 plot = stats.peer_offsets_gnuplot(args.show_peer_offsets)
-            if None !=show_peer_jitters:
+            if None != args.show_peer_jitters:
                 plot = stats.peer_jitters_gnuplot(args.show_peer_jitters)
 
         if args.show_temps:
@@ -1060,9 +1064,9 @@ Python by ESR, concept and GNUPLOT code by Dan Drown.
     if None != plot:
         # finish up the plot, and exit
         if args.generate:
-            gnuplot(plot)
+            gnuplot(plot['plot'])
         else:
-            sys.stdout.write(plot)
+            sys.stdout.write(plot['plot'])
         raise SystemExit(0)
 
     # Fall through to HTML code generation



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c416a2a5b6cac8cf1d7e703842f8fc5f4318678d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161005/e185d46d/attachment.html>


More information about the vc mailing list