Author: eallen
Date: 2009-07-13 16:17:06 -0400 (Mon, 13 Jul 2009)
New Revision: 3491
Modified:
mgmt/trunk/cumin/resources/app.js
mgmt/trunk/cumin/resources/open-flash-chart.swf
Log:
Fix bug where only 10 minutes of data would display after a 1 minute.
Modified: mgmt/trunk/cumin/resources/app.js
===================================================================
--- mgmt/trunk/cumin/resources/app.js 2009-07-13 19:58:14 UTC (rev 3490)
+++ mgmt/trunk/cumin/resources/app.js 2009-07-13 20:17:06 UTC (rev 3491)
@@ -94,9 +94,10 @@
}
}
- this.setupChart = function (id, fullpage_url) {
- cumin.setFullpageHandler(id, fullpage_url);
+ this.setupChart = function (id, width) {
var chart = $(id);
+ chart.onfullpage = function (width, height) { cumin.chartNotify(true, width,
height, id); };
+ chart.onrestore = function () { cumin.chartNotify(false, width, 100, id); };
var oImg = document.images[id];
var mImg = $(oImg);
mImg.addEvent('load', function () {
@@ -372,7 +373,7 @@
}
/* called from .swf in response to chart.get_ymax() */
-function got_ymax(id, href, axis_max, vals_max) {
+function got_ymax(id, href, axis_max, vals_max, low, high) {
var chart = cumin.getFlashChart(id);
if (chart == null)
return false;
@@ -380,13 +381,26 @@
var branch = wooly.session.branch(href);
var now = new Date().getTime();
- var then = 0;
+ var then = now - 10 * 1000;
if (typeof chart.last_time != "undefined") {
then = chart.last_time;
}
chart.last_time = now;
var elapsed = now - then;
branch['elapsed'] = elapsed; // milliseconds since last update
+
+ // hack: do a full update every minute
+ if (typeof chart.last_full_time == "undefined") {
+ chart.last_full_time = now;
+ }
+ var last_full_time = chart.last_full_time;
+ if (now - last_full_time > 60 * 1000) {
+ branch['low'] = low;
+ branch['high'] = high;
+ delete branch.elapsed;
+ chart.last_full_time = now;
+ }
+
branch['amax'] = axis_max;
branch['vmax'] = vals_max;
@@ -413,3 +427,20 @@
}
});
+function ofc_range(id, href, low, high) {
+ var chart = cumin.getFlashChart(id);
+ if (chart) {
+ var now = new Date().getTime();
+ chart.last_full_time = now;
+
+ var branch = wooly.session.branch(href);
+
+ branch['low'] = low;
+ branch['high'] = high;
+ if (branch.elapsed)
+ delete branch.elapsed;
+
+ href = branch.marshal();
+ chart.reload(href, true);
+ }
+}
\ No newline at end of file
Modified: mgmt/trunk/cumin/resources/open-flash-chart.swf
===================================================================
(Binary files differ)
Show replies by date