r5070 - in branches/noflash/cumin: python/cumin resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-10-13 20:06:52 +0000 (Thu, 13 Oct 2011)
New Revision: 5070
Modified:
branches/noflash/cumin/python/cumin/stat.py
branches/noflash/cumin/resources/app.js
Log:
converting JavaScript charts to use JSONP rather than plain JSON.
Modified: branches/noflash/cumin/python/cumin/stat.py
===================================================================
--- branches/noflash/cumin/python/cumin/stat.py 2011-10-13 17:03:46 UTC (rev 5069)
+++ branches/noflash/cumin/python/cumin/stat.py 2011-10-13 20:06:52 UTC (rev 5070)
@@ -937,7 +937,8 @@
# create the chart dict
chart = self.get_chart(session, adapter, stats, samples, time_span, max_value, min_value, append, end_seconds_ago)
#print "**********\n"+chart.create()
- return chart.create()
+ chart.graph_div = "%s_chart" % chart.id.replace(".", "_")
+ return "stathandler(%s)" % chart.create()
def get_y_labels(self, absy, intervals, step):
y_step = absy / intervals
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-10-13 17:03:46 UTC (rev 5069)
+++ branches/noflash/cumin/resources/app.js 2011-10-13 20:06:52 UTC (rev 5070)
@@ -568,30 +568,29 @@
drawAllCharts = function() {
$$('.jqplotgraph').each(function(thisdiv) {
- var div = $(thisdiv);
- var jsonurl = $(div).getParent().getElements('a')[3].get('href');
- var jsonRequest = new Request.JSON({
+ var jsonurl = $(thisdiv).getParent().getElements('a')[3].get('href');
+ var jsonRequest = new Request.JSONP({
url : jsonurl,
-
- onComplete : function(response) {
- console.log("complete: " + response);
- },
- onFailure : function(error) {
- console.log(error.responseText);
- },
- onSuccess : function(json) {
- console.log("Success");
- var dataopts = new Object();
- dataopts['xmin'] = -3600;
- dataopts['xmax'] = 0;
- dataContainer = parseJson(json);
- drawChart($(div).get('id'), dataContainer, dataopts);
- }
- }).get(); // the .get() here fires-off the json request
+ callBackKey : "stathandler",
+ }).send(); // the .send() here fires-off the jsonp request
});
- t = setTimeout("drawAllCharts()", 10000);
+ t = setTimeout("drawAllCharts()", 1000000);
}
+stathandler = function(response) {
+ try {
+ console.info("In stathandler for: " + response["graph_div"]);
+ var dataopts = new Object();
+ dataopts['xmin'] = -3600;
+ dataopts['xmax'] = 0;
+ dataContainer = parseJson(response);
+ drawChart(response["graph_div"], dataContainer, dataopts);
+ } catch(err) {
+ console.log("Caught exception: " + err);
+ }
+ return true;
+}
+
parseJson = function(json) {
var dataContainer = new Object();
dataContainer['end_secs'] = json.end_secs;
@@ -631,9 +630,9 @@
.append([ json.x_axis.labels.labels[i].text ]);
}
- console.log("end_secs: " + dataContainer['end_secs'] + " tnow: "
- + dataContainer['tnow']);
- console.log("x-axis vals: " + dataContainer['x_axis_values']);
+// console.log("end_secs: " + dataContainer['end_secs'] + " tnow: "
+// + dataContainer['tnow']);
+// console.log("x-axis vals: " + dataContainer['x_axis_values']);
console.log("x_coord_vals: " + dataContainer['x_coordinate_values']);
console.log("y_coord_vals: " + dataContainer['y_coordinate_values']);
return dataContainer;
12 years, 7 months
r5068 - branches/noflash/cumin/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-10-12 21:24:08 +0000 (Wed, 12 Oct 2011)
New Revision: 5068
Modified:
branches/noflash/cumin/resources/app.js
Log:
Adding back some console.log statements for the time being.
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-10-12 21:10:27 UTC (rev 5067)
+++ branches/noflash/cumin/resources/app.js 2011-10-12 21:24:08 UTC (rev 5068)
@@ -574,13 +574,13 @@
url : jsonurl,
onComplete : function(response) {
- //console.log("complete: " + response);
+ console.log("complete: " + response);
},
onFailure : function(error) {
console.log(error.responseText);
},
onSuccess : function(json) {
- //console.log("Success");
+ console.log("Success");
var dataopts = new Object();
dataopts['xmin'] = -3600;
dataopts['xmax'] = 0;
@@ -631,11 +631,11 @@
.append([ json.x_axis.labels.labels[i].text ]);
}
-// console.log("end_secs: " + dataContainer['end_secs'] + " tnow: "
-// + dataContainer['tnow']);
-// console.log("x-axis vals: " + dataContainer['x_axis_values']);
-// console.log("x_coord_vals: " + dataContainer['x_coordinate_values']);
-// console.log("y_coord_vals: " + dataContainer['y_coordinate_values']);
+ console.log("end_secs: " + dataContainer['end_secs'] + " tnow: "
+ + dataContainer['tnow']);
+ console.log("x-axis vals: " + dataContainer['x_axis_values']);
+ console.log("x_coord_vals: " + dataContainer['x_coordinate_values']);
+ console.log("y_coord_vals: " + dataContainer['y_coordinate_values']);
return dataContainer;
}
12 years, 7 months
r5067 - branches/lucidity/sage/python/sage
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-10-12 21:10:27 +0000 (Wed, 12 Oct 2011)
New Revision: 5067
Modified:
branches/lucidity/sage/python/sage/verifiedhttps_m2crypto.py
Log:
Merge 5066 from trunk.
svn merge -c 5066 svn+ssh://svn.fedorahosted.org/svn/cumin/trunk .
Change timeout member to avoid conflicts.
Modified: branches/lucidity/sage/python/sage/verifiedhttps_m2crypto.py
===================================================================
--- branches/lucidity/sage/python/sage/verifiedhttps_m2crypto.py 2011-10-12 21:06:52 UTC (rev 5066)
+++ branches/lucidity/sage/python/sage/verifiedhttps_m2crypto.py 2011-10-12 21:10:27 UTC (rev 5067)
@@ -21,7 +21,7 @@
"""
self.server_verify = server_verify
self.domain_verify = domain_verify
- self.timeout = timeout
+ self._my_timeout = timeout
ctx = SSL.Context()
ctx.load_cert(cert_file, key_file)
@@ -44,8 +44,8 @@
# created. There is no hook in M2Crypto to set
# this prior to the connection.
httpslib.HTTPSConnection.connect(self)
- if self.timeout is not None:
- self.sock.settimeout(self.timeout)
+ if self._my_timeout is not None:
+ self.sock.settimeout(self._my_timeout)
except SSL.Checker.WrongHost, e:
# Allow the host name check to fail if domain_verify is off.
# This is mostly for testing with self-signed certificates
12 years, 7 months
r5066 - trunk/sage/python/sage
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-10-12 21:06:52 +0000 (Wed, 12 Oct 2011)
New Revision: 5066
Modified:
trunk/sage/python/sage/verifiedhttps_m2crypto.py
Log:
Change name of timeout member to avoid conflicts
Modified: trunk/sage/python/sage/verifiedhttps_m2crypto.py
===================================================================
--- trunk/sage/python/sage/verifiedhttps_m2crypto.py 2011-10-12 20:48:06 UTC (rev 5065)
+++ trunk/sage/python/sage/verifiedhttps_m2crypto.py 2011-10-12 21:06:52 UTC (rev 5066)
@@ -21,7 +21,7 @@
"""
self.server_verify = server_verify
self.domain_verify = domain_verify
- self.timeout = timeout
+ self._my_timeout = timeout
ctx = SSL.Context()
ctx.load_cert(cert_file, key_file)
@@ -44,8 +44,8 @@
# created. There is no hook in M2Crypto to set
# this prior to the connection.
httpslib.HTTPSConnection.connect(self)
- if self.timeout is not None:
- self.sock.settimeout(self.timeout)
+ if self._my_timeout is not None:
+ self.sock.settimeout(self._my_timeout)
except SSL.Checker.WrongHost, e:
# Allow the host name check to fail if domain_verify is off.
# This is mostly for testing with self-signed certificates
12 years, 7 months
r5065 - branches/noflash/wooly/resources/plugins
by croberts@fedoraproject.org
Author: croberts
Date: 2011-10-12 20:48:06 +0000 (Wed, 12 Oct 2011)
New Revision: 5065
Added:
branches/noflash/wooly/resources/plugins/jqplot.horizontalLegendRenderer.js
Log:
more jqplot plugins
Added: branches/noflash/wooly/resources/plugins/jqplot.horizontalLegendRenderer.js
===================================================================
--- branches/noflash/wooly/resources/plugins/jqplot.horizontalLegendRenderer.js (rev 0)
+++ branches/noflash/wooly/resources/plugins/jqplot.horizontalLegendRenderer.js 2011-10-12 20:48:06 UTC (rev 5065)
@@ -0,0 +1,41 @@
+(function($) {
+
+ // Class: $.jqplot.horizontalLegendRenderer
+ // Renders the table legends horizontally.
+
+ if ($.jqplot == undefined) { return }
+
+ $.jqplot.horizontalLegendRenderer = function() { };
+ $.jqplot.horizontalLegendRenderer.prototype.init = function(options) {
+ $.extend(true, this, options);
+ };
+
+ // The draw function should return the HTML <table> element with the chart legends.
+ $.jqplot.horizontalLegendRenderer.prototype.draw = function(options) {
+ var series = this._series;
+ // The legends table contains a single row, with one td per series.
+ // each td element contains two divs - the series color and series label.
+ this._elem = $('<table class="jqplot-table-legend"><tr></tr></table>');
+ for ( var i = 0; i < series.length; i++ ) {
+ var s = series[i];
+ var td = $('<td>'
+ + ' <div style="float:left">' // This div contains the color swatch
+ + ' <div class="jqplot-table-legend-swatch" style="width:10px; height: 10px; border: 1px solid black; margin: 2px 2px 0 2px;"/>'
+ + ' </div>'
+ + ' <div style="float: right"></div>' // This div contains the series label
+ + '</td>');
+ td.find('div:eq(0) div').css('background-color', s.color);
+ td.children('div:eq(1)').append(s.label);
+ this._elem.append(td);
+ }
+ return this._elem;
+ }
+
+ // The pack function positions the legends table.
+ $.jqplot.horizontalLegendRenderer.prototype.pack = function(offsets) {
+ this._elem.css('left', offsets.left + this.xoffset);
+ this._elem.css('top', offsets.top + this.yoffset);
+ }
+
+
+})(jQuery);
12 years, 7 months
r5064 - branches/noflash/wooly/python/wooly
by croberts@fedoraproject.org
Author: croberts
Date: 2011-10-12 20:45:33 +0000 (Wed, 12 Oct 2011)
New Revision: 5064
Modified:
branches/noflash/wooly/python/wooly/pages.strings
Log:
Adding another js library for jqplot charts.
Modified: branches/noflash/wooly/python/wooly/pages.strings
===================================================================
--- branches/noflash/wooly/python/wooly/pages.strings 2011-10-12 20:36:40 UTC (rev 5063)
+++ branches/noflash/wooly/python/wooly/pages.strings 2011-10-12 20:45:33 UTC (rev 5064)
@@ -24,6 +24,10 @@
<script type="text/javascript" src="resource?name=jquery.jqplot.js"></script>
<script type="text/javascript" src="resource?name=jqplot.pieRenderer.min.js"></script>
<script type="text/javascript" src="resource?name=jqplot.donutRenderer.min.js"></script>
+ <script type="text/javascript" src="resource?name=jqplot.horizontalLegendRenderer.js"></script>
+ <script type="text/javascript" src="resource?name=jqplot.highlighter.min.js"></script>
+ <script type="text/javascript" src="resource?name=jqplot.cursor.js"></script>
+ <script type="text/javascript" src="resource?name=jqplot.dateAxisRenderer.js"></script>
<script type="text/javascript">
$j = jQuery.noConflict();
12 years, 7 months
r5063 - branches/noflash/cumin/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-10-12 20:36:40 +0000 (Wed, 12 Oct 2011)
New Revision: 5063
Modified:
branches/noflash/cumin/resources/app.js
Log:
Getting rid of some unnecessary console.log statements
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-10-12 20:23:14 UTC (rev 5062)
+++ branches/noflash/cumin/resources/app.js 2011-10-12 20:36:40 UTC (rev 5063)
@@ -574,13 +574,13 @@
url : jsonurl,
onComplete : function(response) {
- console.log("complete: " + response);
+ //console.log("complete: " + response);
},
onFailure : function(error) {
console.log(error.responseText);
},
onSuccess : function(json) {
- console.log("Success");
+ //console.log("Success");
var dataopts = new Object();
dataopts['xmin'] = -3600;
dataopts['xmax'] = 0;
@@ -631,11 +631,11 @@
.append([ json.x_axis.labels.labels[i].text ]);
}
- console.log("end_secs: " + dataContainer['end_secs'] + " tnow: "
- + dataContainer['tnow']);
- console.log("x-axis vals: " + dataContainer['x_axis_values']);
- console.log("x_coord_vals: " + dataContainer['x_coordinate_values']);
- console.log("y_coord_vals: " + dataContainer['y_coordinate_values']);
+// console.log("end_secs: " + dataContainer['end_secs'] + " tnow: "
+// + dataContainer['tnow']);
+// console.log("x-axis vals: " + dataContainer['x_axis_values']);
+// console.log("x_coord_vals: " + dataContainer['x_coordinate_values']);
+// console.log("y_coord_vals: " + dataContainer['y_coordinate_values']);
return dataContainer;
}
@@ -697,7 +697,6 @@
} else {
allCharts[divName] = $j.jqplot(holder, dataContainer['y_coordinate_values'],chartOptionsObject);
}
- console.log("Done");
}
12 years, 7 months
r5062 - in branches/noflash/cumin: python/cumin resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-10-12 20:23:14 +0000 (Wed, 12 Oct 2011)
New Revision: 5062
Modified:
branches/noflash/cumin/python/cumin/stat.strings
branches/noflash/cumin/resources/app.js
Log:
Fixing the overlapping chart problem. We now keep an array of all charts for the given page and use that to manage the clear/redraw cycle on updates.
Modified: branches/noflash/cumin/python/cumin/stat.strings
===================================================================
--- branches/noflash/cumin/python/cumin/stat.strings 2011-10-12 18:33:46 UTC (rev 5061)
+++ branches/noflash/cumin/python/cumin/stat.strings 2011-10-12 20:23:14 UTC (rev 5062)
@@ -298,8 +298,9 @@
<div class="StatValueChart{fullpageable}" id="{id}">
<h2>{title}</h2>
<div class="duration">{duration}</div>
- <div id="{id_nodots}_chart" class="jqplotgraph" style="height:150px;width:400px;">
- <a rel="api" type="application/json" href="{href}" style="display:none">Data</a>
+ <!-- don't put this data url inside the holder div, jqplot will kill it on a zoom -->
+ <a rel="api" type="application/json" href="{href}" style="display:none">Data</a>
+ <div id="{id_nodots}_chart" class="jqplotgraph" style="height:150px;width:400px;">
<div class="loading" style="display:none;"><span>Loading...</span></div>
</div>
</div>
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-10-12 18:33:46 UTC (rev 5061)
+++ branches/noflash/cumin/resources/app.js 2011-10-12 20:23:14 UTC (rev 5062)
@@ -561,6 +561,7 @@
return false;
}
+var allCharts = new Object();
window.addEvent("domready", function() {
drawAllCharts();
});
@@ -568,7 +569,7 @@
drawAllCharts = function() {
$$('.jqplotgraph').each(function(thisdiv) {
var div = $(thisdiv);
- var jsonurl = $(div).getElements('a').get('href');
+ var jsonurl = $(div).getParent().getElements('a')[3].get('href');
var jsonRequest = new Request.JSON({
url : jsonurl,
@@ -649,8 +650,7 @@
drawChart = function(holder, dataContainer, dataopts) {
$j.jqplot.config.enablePlugins = true;
-
- $j.jqplot(holder, dataContainer['y_coordinate_values'], {
+ var chartOptionsObject = {
grid: { background: '#FFFFFF' },
legend: {show:true,
location: 'n',
@@ -689,7 +689,15 @@
looseZoom:true,
showCursorLegend:false}
- });
+ }
+ var divName = $(holder).get('id');
+ if(allCharts[divName]) {
+ allCharts[divName].redraw(true);
+ allCharts[divName] = $j.jqplot(holder, dataContainer['y_coordinate_values'],chartOptionsObject);
+ } else {
+ allCharts[divName] = $j.jqplot(holder, dataContainer['y_coordinate_values'],chartOptionsObject);
+ }
+ console.log("Done");
}
12 years, 7 months
r5061 - branches/noflash/cumin/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-10-12 18:33:46 +0000 (Wed, 12 Oct 2011)
New Revision: 5061
Modified:
branches/noflash/cumin/resources/app.js
Log:
The new pure javascript charts will now update themselves on the fly.
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-10-12 18:33:17 UTC (rev 5060)
+++ branches/noflash/cumin/resources/app.js 2011-10-12 18:33:46 UTC (rev 5061)
@@ -562,27 +562,35 @@
}
window.addEvent("domready", function() {
+ drawAllCharts();
+});
+
+drawAllCharts = function() {
$$('.jqplotgraph').each(function(thisdiv) {
- var div = $(thisdiv);
- var jsonurl = $(div).getElements('a').get('href');
- var jsonRequest = new Request.JSON({
- url : jsonurl,
+ var div = $(thisdiv);
+ var jsonurl = $(div).getElements('a').get('href');
+ var jsonRequest = new Request.JSON({
+ url : jsonurl,
+
+ onComplete : function(response) {
+ console.log("complete: " + response);
+ },
+ onFailure : function(error) {
+ console.log(error.responseText);
+ },
+ onSuccess : function(json) {
+ console.log("Success");
+ var dataopts = new Object();
+ dataopts['xmin'] = -3600;
+ dataopts['xmax'] = 0;
+ dataContainer = parseJson(json);
+ drawChart($(div).get('id'), dataContainer, dataopts);
+ }
+ }).get(); // the .get() here fires-off the json request
+ });
+ t = setTimeout("drawAllCharts()", 10000);
+}
- onComplete : function(response) {
- console.log("complete: " + response);
- },
- onFailure : function(error) {
- console.log(error.responseText);
- },
- onSuccess : function(json) {
- console.log("Success");
- dataContainer = parseJson(json);
- drawChart($(div).get('id'), dataContainer);
- }
- }).get(); // the .get() here fires-off the json request
- });
-});
-
parseJson = function(json) {
var dataContainer = new Object();
dataContainer['end_secs'] = json.end_secs;
@@ -638,7 +646,7 @@
return series;
}
-drawChart = function(holder, dataContainer) {
+drawChart = function(holder, dataContainer, dataopts) {
$j.jqplot.config.enablePlugins = true;
@@ -652,7 +660,7 @@
placement: "outsideGrid"},
axes: {
y2axis: {autoscale: true, min:0},
- xaxis: {autoscale: false, pad:0, min:-3600, max:0,
+ xaxis: {autoscale: false, pad:0, min:dataopts['xmin'], max:dataopts['xmax'],
// probably need to pass in min/max based on current selection
// renderer:$j.jqplot.DateAxisRenderer,
// tickOptions: {formatString: '%#M'},
@@ -661,6 +669,7 @@
series: getSeries(dataContainer),
seriesColors: ['#cc0000', '#00cc00', '#0000cc'],
seriesDefaults: {
+ lineWidth:1,
fill:true,
fillAndStroke:true,
fillAlpha: 0.4,
12 years, 7 months
r5060 - branches/noflash/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2011-10-12 18:33:17 +0000 (Wed, 12 Oct 2011)
New Revision: 5060
Modified:
branches/noflash/cumin/python/cumin/stat.py
Log:
Bringing in a bug fix from trunk to prevent some charts from erroring out.
Modified: branches/noflash/cumin/python/cumin/stat.py
===================================================================
--- branches/noflash/cumin/python/cumin/stat.py 2011-10-12 16:15:55 UTC (rev 5059)
+++ branches/noflash/cumin/python/cumin/stat.py 2011-10-12 18:33:17 UTC (rev 5060)
@@ -559,6 +559,10 @@
min_value = float(min_value)
max_value = round(max_value * 1.1 + 1)
+ if type == "percent" and max_value > 100:
+ # since none of our percentage graphs go above 100%
+ # we limit it here to match the flash graph
+ max_value = 100
if min_value < 0:
min_value = round(min_value * 1.1 - 1)
@@ -945,7 +949,7 @@
value = int(round(i * y_step, 0))
if value >= 1000000:
- svalue = "%.2fm" % (round(value / 1000000.0, 2))
+ svalue = "%.2fM" % (round(value / 1000000.0, 2))
elif value >= 10000:
svalue = "%ik" % int(round(value / 1000.0, -1))
else:
@@ -1186,7 +1190,7 @@
self.alpha = 1
- def get_max_min(self, session, stats, samples):
+ def get_max_min(self, session, stats, samples, time_span, end_seconds_ago):
max_value = 0
min_value = 0
points = dict()
@@ -1324,8 +1328,8 @@
return chart_obj
class PercentAreaChart(AreaChart):
- def get_max_min(self, session, stats, samples):
- max_val, min_val = super(PercentAreaChart, self).get_max_min(session, stats, samples)
+ def get_max_min(self, session, stats, samples, time_span, end_seconds_ago):
+ max_val, min_val = super(PercentAreaChart, self).get_max_min(session, stats, samples, time_span, end_seconds_ago)
percent = self.page.percent_property.get(session)
total = self.page.get_object_property(session, percent)
12 years, 7 months