Author: eallen
Date: 2010-10-11 16:53:16 -0400 (Mon, 11 Oct 2010)
New Revision: 4384
Modified:
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/resources/open-flash-chart.swf
Log:
BZ 639349: Optimize json data send to flash charts
- Removed the tip text for each point. Now constructing tips in the .swf based on uid
- using ints instead of floats for alpha
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2010-10-08 20:52:47 UTC (rev 4383)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2010-10-11 20:53:16 UTC (rev 4384)
@@ -623,7 +623,7 @@
chart.elements = list()
element = Element()
element.type = "pie"
- element.alpha = 0.7
+ element.alpha = 7
element.start_angle = 0
element.gradient_fill = True
element.radius = 90
@@ -854,7 +854,7 @@
def __init__(self, app, name, page):
super(AreaChart, self).__init__(app, name, page)
- self.alpha = 0.3
+ self.alpha = 3
def fetch_samples(self, adapter, dur, interval, method, mode, delta, stats,
end_seconds_ago=0):
samples = dict()
@@ -902,8 +902,8 @@
tnow = time()
vals = [{"x":int(duration -(tnow - secs(dt)) + end_secs),
"y":value,
- "uid": dt.strftime("%m%d%Y%H%M%S"),
- "tip": "<br>%s: #val#<br>Time: %s" % (text,
dt.strftime("%m/%d/%Y %H:%M:%S"))}
+ "uid": dt.strftime("%m%d%Y%H%M%S")}
+ #"tip": "<br>%s: #val#<br>Time: %s" % (text,
dt.strftime("%m/%d/%Y %H:%M:%S"))
for dt, value, dev in reversed(samples[stat])
if value is not None]
return vals
@@ -922,7 +922,8 @@
"halo-size": halo_size}
line.colour = color
line.width = line_width
- line.text = mode == "rate" and "%s / sec" % stat.title or
stat.title
+ tip_title = stat.title.split(" ")[-1]
+ line.text = mode == "rate" and "%s / sec" % tip_title or
stat.title
vals = self.get_vals(session, samples, stat, line.text, duration, end_secs)
line.values = vals
@@ -985,13 +986,14 @@
return chart
class StackedAreaChart(AreaChart):
+ colors = ('#FFABAB', '#ABABFF', '#ABFFAB', '#FFABFF',
'#FFFFAB', '#ABFFFF', '#ABABAB')
def __init__(self, app, name, page):
super(StackedAreaChart, self).__init__(app, name, page)
self.points = self.Points(app, "points")
self.add_attribute(self.points)
- #self.alpha = 1
+ self.alpha = 1
def get_max_min(self, session, stats, samples):
max_value = 0
@@ -1035,8 +1037,8 @@
if points:
vals = [{"x":int(duration -(tnow - secs(dt)) + end_secs),
"y":stacked_value,
- "uid": dt.strftime("%m%d%Y%H%M%S"),
- "tip": "<br>%s: %s<br>Time: %s" % (text,
str(value), dt.strftime("%m/%d/%Y %H:%M:%S"))}
+ "uid": dt.strftime("%m%d%Y%H%M%S")}
+ #"tip": "<br>%s: %s<br>Time: %s" % (text,
str(value), dt.strftime("%m/%d/%Y %H:%M:%S"))}
for dt, value, stacked_value in reversed(points[stat])
if value is not None]
Modified: mgmt/trunk/cumin/resources/open-flash-chart.swf
===================================================================
(Binary files differ)