Author: eallen
Date: 2009-04-23 14:22:49 -0400 (Thu, 23 Apr 2009)
New Revision: 3327
Modified:
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/stat.strings
Log:
Set stacked chart width and height when expanding and restoring
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2009-04-23 17:58:57 UTC (rev 3326)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2009-04-23 18:22:49 UTC (rev 3327)
@@ -455,54 +455,35 @@
self.container_height.default = 100
self.add_parameter(self.container_height)
- def fake_samples(self, count, t, diff):
- start = randrange(1, 100)
-
- return [ (t+timedelta(seconds=-i*diff), start + randrange(-5, 5)) for i in
range(0, count) ]
-
def do_render(self, session, object):
- chart = StackedValueChart(self.container_width.get(session),
self.container_height.get(session), 100)
-
cls = self.class_.get(session)
stats = [getattr(cls, x) for x in self.stats.get(session)]
+ legend_height = len(stats) * 16 + 16
- samples = dict()
- values = dict()
+ chart = StackedValueChart(self.container_width.get(session),
+ self.container_height.get(session),
+ legend_height)
duration = self.duration.get(session)
- #XXX fake stats for now
- #count = self.container_width.get(session) / 3
- #t = datetime.now()
- #seed(1)
- #for stat in stats:
- # samples[stat] = self.fake_samples(min(count, 200), t, 10)
+ max_value = 1
+ min_value = 999999
- for stat in stats:
- samples[stat] = stat.samples(object, duration)
-
points = dict()
+ samples = dict()
+ values = dict()
for stat in stats:
+ samples[stat] = stat.samples(object, duration)
for sample in samples[stat]:
t = sample[0]
if not t in points:
points[t] = list()
+ values[t] = 0
points[t].append(sample[1])
+ values[t] = values[t] + sample[1]
+ max_value = max(nvl(values[t], 0), max_value)
+ min_value = min(nvl(values[t], 0), min_value)
- for t in points:
- values[t] = 0
- for v in points[t]:
- values[t] = values[t] + v
-
- max_value = 1
- min_value = 0
-
- for t in points:
- vals = values[t]
- if vals:
- max_value = max(nvl(vals, 0), max_value)
- min_value = min(nvl(vals, 0), min_value)
-
max_value = round(max_value * 1.1 + 1)
if min_value < 0:
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2009-04-23 17:58:57 UTC (rev 3326)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2009-04-23 18:22:49 UTC (rev 3327)
@@ -159,6 +159,9 @@
src = branch.marshal();
src = cumin.refreshTime(src);
+ oImg.className = "Loading";
+ oImg.width = width;
+ oImg.height = height;
oImg.style.visibility = "hidden";
oImg.src = src;
}
@@ -185,8 +188,12 @@
$('{id}').onfullpage = function (width, height) { stackedNotify(true, width,
height, '{id}'); };
$('{id}').onrestore = function () { stackedNotify(false, {width}, 100,
'{id}'); };
var oImg = document.images['{id}'];
- $(oImg).addEvent('load', function () { this.style.visibility =
"visible" });
- $(oImg).addEvent('dblclick', function ()
{fullpage(this.parentNode.parentNode.parentNode.getElementsByTagName('p')[0])});
+ $(oImg).addEvent('load', function () {
+ this.style.visibility = "visible";
+ this.removeAttribute("width");
+ this.removeAttribute("height");
+ this.className = "";
+ });
}())
//]]>
</script>