[rhmessaging-commits] rhmessaging commits: r3418 - mgmt/trunk/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Jun 4 16:30:25 EDT 2009


Author: eallen
Date: 2009-06-04 16:30:25 -0400 (Thu, 04 Jun 2009)
New Revision: 3418

Modified:
   mgmt/trunk/cumin/python/cumin/charts.py
Log:
Accumulate (x,y) points as they are drawn on the charts for use in the mouseover javascript.

Modified: mgmt/trunk/cumin/python/cumin/charts.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/charts.py	2009-06-04 20:26:30 UTC (rev 3417)
+++ mgmt/trunk/cumin/python/cumin/charts.py	2009-06-04 20:30:25 UTC (rev 3418)
@@ -153,6 +153,7 @@
         cr.set_source_rgba(color[0], color[1], color[2], 0.66)
 
         tnow = time()
+        points = list()
 
         for dt, value, dev in samples:
             if value is None:
@@ -167,8 +168,12 @@
             x = self.width - ((tnow - t) / float(self.x_max)) * self.width
             y = self.height - (value / float(self.y_max)) * self.height
             cr.line_to(x, y)
+            if x < 0:
+                break
+            points.append([int(x), int(y), value])
 
         cr.stroke()
+        return points
 
     def plot_ticks(self, samples, color=(0, 0, 0)):
         cr = Context(self.surface)
@@ -212,6 +217,7 @@
     def plot_legend(self, titles, colors):
         cr = Context(self.surface)
         cr.set_line_width(1.5)
+        title_xy = list()
 
         for i, item in enumerate(zip(titles, colors)):
             title, color = item
@@ -232,6 +238,10 @@
             cr.show_text(title)
             cr.stroke()
 
+            width, height = cr.text_extents(title)[2:4]
+            title_xy.append([width, y])
+        return title_xy
+
     def plot_frame(self, color=(0.8, 0.8, 0.8)):
         cr = Context(self.surface)
         cr.set_line_width(1)




More information about the rhmessaging-commits mailing list