aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Sloan2013-01-09 17:45:43 -0600
committerZachary Sloan2013-01-09 17:45:43 -0600
commit10709f9d6761de7c99379eb707df7283cd03cea8 (patch)
tree08f870dc199060772297e76b8299db0d677919c1
parent0e5e7335fca87bddb062d1470ab547044d5bcf42 (diff)
downloadgenenetwork2-10709f9d6761de7c99379eb707df7283cd03cea8.tar.gz
The histogram coffeescript is now in its own class and the graph
still displays correctly
-rw-r--r--wqflask/wqflask/static/new/javascript/marker_regression.coffee30
-rw-r--r--wqflask/wqflask/static/new/javascript/marker_regression.js38
2 files changed, 40 insertions, 28 deletions
diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.coffee b/wqflask/wqflask/static/new/javascript/marker_regression.coffee
index 7ffa0267..07a10119 100644
--- a/wqflask/wqflask/static/new/javascript/marker_regression.coffee
+++ b/wqflask/wqflask/static/new/javascript/marker_regression.coffee
@@ -3,8 +3,12 @@ $ ->
return a - b
-
- process_lrs_array = ->
+ class Permutation_Histogram
+ constructor: ->
+ @process_data()
+ @display_graph()
+
+ process_data: ->
# Put the data in a format needed for graphing
# The permutation count for a particular integer range (10-11 or 12-13 for example)
# will be on the y-axis; LRS values will be on the x-axis
@@ -27,21 +31,21 @@ $ ->
# Now that we have the ordered keys above
# We can build an array of arrays that jqPlot will use
- bars_ordered = []
+ @bars_ordered = []
for key in keys
- bars_ordered.push([parseInt(key), bars[key]])
+ @bars_ordered.push([parseInt(key), bars[key]])
console.log("bars is:", bars)
console.log("keys are:", keys)
- console.log("bars_ordered are:", bars_ordered)
- return bars_ordered
+ console.log("bars_ordered are:", @bars_ordered)
+ #return bars_ordered
- display_permutation_histogram = (bars_ordered) ->
+ display_graph: ->
# Figure out the largest key, so we can make sure the x axis max is one larger later on
- max_lrs = bars_ordered[bars_ordered.length-1][0]
- console.log("max_key is:", max_lrs)
+ #max_lrs = bars_ordered[bars_ordered.length-1][0]
+ #console.log("max_key is:", max_lrs)
- $.jqplot('permutation_histogram', [bars_ordered],
+ $.jqplot('permutation_histogram', [@bars_ordered],
title: 'Permutation Histogram'
seriesDefaults:
renderer:$.jqplot.BarRenderer
@@ -74,5 +78,7 @@ $ ->
- bars_ordered = process_lrs_array()
- display_permutation_histogram(bars_ordered) \ No newline at end of file
+ #bars_ordered = process_lrs_array()
+ #display_permutation_histogram(bars_ordered)
+
+ new Permutation_Histogram \ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.js b/wqflask/wqflask/static/new/javascript/marker_regression.js
index 5d429ddc..26f0dba4 100644
--- a/wqflask/wqflask/static/new/javascript/marker_regression.js
+++ b/wqflask/wqflask/static/new/javascript/marker_regression.js
@@ -2,12 +2,19 @@
(function() {
$(function() {
- var bars_ordered, sort_number;
+ var Permutation_Histogram, sort_number;
sort_number = function(a, b) {
- var display_permutation_histogram, process_lrs_array;
return a - b;
- process_lrs_array = function() {
- var bars, bars_ordered, floored, key, keys, lrs, lrs_array, _i, _j, _len, _len1;
+ };
+ Permutation_Histogram = (function() {
+
+ function Permutation_Histogram() {
+ this.process_data();
+ this.display_graph();
+ }
+
+ Permutation_Histogram.prototype.process_data = function() {
+ var bars, floored, key, keys, lrs, lrs_array, _i, _j, _len, _len1;
lrs_array = js_data.lrs_array;
bars = {};
for (_i = 0, _len = lrs_array.length; _i < _len; _i++) {
@@ -23,21 +30,18 @@
keys.push(key);
}
keys.sort(sort_number);
- bars_ordered = [];
+ this.bars_ordered = [];
for (_j = 0, _len1 = keys.length; _j < _len1; _j++) {
key = keys[_j];
- bars_ordered.push([parseInt(key), bars[key]]);
+ this.bars_ordered.push([parseInt(key), bars[key]]);
}
console.log("bars is:", bars);
console.log("keys are:", keys);
- console.log("bars_ordered are:", bars_ordered);
- return bars_ordered;
+ return console.log("bars_ordered are:", this.bars_ordered);
};
- return display_permutation_histogram = function(bars_ordered) {
- var max_lrs;
- max_lrs = bars_ordered[bars_ordered.length - 1][0];
- console.log("max_key is:", max_lrs);
- return $.jqplot('permutation_histogram', [bars_ordered], {
+
+ Permutation_Histogram.prototype.display_graph = function() {
+ return $.jqplot('permutation_histogram', [this.bars_ordered], {
title: 'Permutation Histogram',
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
@@ -64,9 +68,11 @@
}
});
};
- };
- bars_ordered = process_lrs_array();
- return display_permutation_histogram(bars_ordered);
+
+ return Permutation_Histogram;
+
+ })();
+ return new Permutation_Histogram;
});
}).call(this);