Author: croberts Date: 2011-06-21 20:03:25 +0000 (Tue, 21 Jun 2011) New Revision: 4846
Modified: trunk/cumin/python/cumin/stat.py trunk/cumin/resources/open-flash-chart.swf Log: Addressing BZ: https://bugzilla.redhat.com/show_bug.cgi?id=703621 The y-axis for charts is now computed based on the visible data points.
Modified: trunk/cumin/python/cumin/stat.py =================================================================== --- trunk/cumin/python/cumin/stat.py 2011-06-21 18:05:08 UTC (rev 4845) +++ trunk/cumin/python/cumin/stat.py 2011-06-21 20:03:25 UTC (rev 4846) @@ -903,7 +903,7 @@ self.fix_method(method, mode), mode, delta, stats, end_seconds_ago=end_seconds_ago) - max_value, min_value = self.get_max_min(session, stats, samples) + max_value, min_value = self.get_max_min(session, stats, samples, time_span, end_seconds_ago)
append = False # if we should append the new samples, see if the y-axis has changed @@ -920,7 +920,7 @@ self.fix_method(method, mode), mode, False, stats, end_seconds_ago=end_seconds_ago) - max_value, min_value = self.get_max_min(session, stats, samples) + max_value, min_value = self.get_max_min(session, stats, samples, time_span, end_seconds_ago) else: append = True
@@ -1026,18 +1026,27 @@
return samples
- def get_max_min(self, session, stats, samples): + def get_max_min(self, session, stats, samples, time_span=99999, end_seconds_ago=0): # take stddev into account for max and min y values max_value = 0 min_value = 0
for stat in stats: for x in samples[stat]: - devmax = nvl(x[1], 0) + float(nvl(x[2], 0)) - devmin = nvl(x[1], 0) - float(nvl(x[2], 0)) - max_value = max(max_value, devmax) - min_value = min(min_value, devmin) + try: + # Only compute the y-axis based on visible data + # be sure to factor-in end_seconds_ago and time_span + time_change = timedelta(seconds=end_seconds_ago) + window_adjusted_time = datetime.now() - time_change + if( (window_adjusted_time - x[0]).seconds <= int(time_span)): + devmax = nvl(x[1], 0) + float(nvl(x[2], 0)) + devmin = nvl(x[1], 0) - float(nvl(x[2], 0)) + max_value = max(max_value, devmax) + min_value = min(min_value, devmin) + except Exception, err: + log.debug(err)
+ max_value = round(max_value * 1.1 + 1) if min_value < 0: min_value = round(min_value * 1.1 - 1)
Modified: trunk/cumin/resources/open-flash-chart.swf =================================================================== (Binary files differ)
cumin-developers@lists.fedorahosted.org