diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/marker_regression.coffee | 30 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/marker_regression.js | 38 |
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); |