From 092a6835f992afb3bfb15918b09d22220789ad14 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Wed, 9 Jan 2013 17:16:07 -0600 Subject: More or less finished the permutation histogram --- .../static/new/javascript/marker_regression.coffee | 46 +++++++++++++++++----- .../static/new/javascript/marker_regression.js | 21 ++++++++-- wqflask/wqflask/templates/base.html | 2 +- wqflask/wqflask/templates/marker_regression.html | 7 +++- 4 files changed, 59 insertions(+), 17 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.coffee b/wqflask/wqflask/static/new/javascript/marker_regression.coffee index ec428cfa..f3485a82 100644 --- a/wqflask/wqflask/static/new/javascript/marker_regression.coffee +++ b/wqflask/wqflask/static/new/javascript/marker_regression.coffee @@ -3,6 +3,9 @@ $ -> return a - b process_lrs_array = -> + # 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 lrs_array = js_data.lrs_array bars = {} for lrs in lrs_array @@ -10,33 +13,56 @@ $ -> if floored not of bars bars[floored] = 0 bars[floored] += 1 - + + # Now we need to take the unordered hash + # And order the keys keys = [] for key of bars keys.push(key) + keys.sort(sort_number) + + # Now that we have the ordered keys above + # We can build an array of arrays that jqPlot will use bars_ordered = [] for key in keys 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 - + display_permutation_histogram = (bars_ordered) -> - $.jqplot('permutation_histogram', [bars_ordered], - seriesDefaults: + # 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) + + $.jqplot('permutation_histogram', [bars_ordered], + title: 'Permutation Histogram' + seriesDefaults: renderer:$.jqplot.BarRenderer + rendererOptions: + #barPadding: 30 + #barMargin: 30 + barWidth: 15 + #shadowOffset: 2 + #shadowDepth: 5 + #shadowAlpha: 0.8 + pointLabels: + show: true + axesDefaults: + labelRenderer: $.jqplot.CanvasAxisLabelRenderer axes: xaxis: min: 0 - label: "LRS", - pad: 0 - yaxis: - label: "Count", - pad: 0 + #max: max_lrs + 2 + label: "LRS" + pad: 1.1 + yaxis: + min: 0 + label: "Frequency" ) diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.js b/wqflask/wqflask/static/new/javascript/marker_regression.js index 0b186242..ac85dc3d 100644 --- a/wqflask/wqflask/static/new/javascript/marker_regression.js +++ b/wqflask/wqflask/static/new/javascript/marker_regression.js @@ -34,19 +34,32 @@ return bars_ordered; }; 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], { + title: 'Permutation Histogram', seriesDefaults: { - renderer: $.jqplot.BarRenderer + renderer: $.jqplot.BarRenderer, + rendererOptions: { + barWidth: 15 + }, + pointLabels: { + show: true + } + }, + axesDefaults: { + labelRenderer: $.jqplot.CanvasAxisLabelRenderer }, axes: { xaxis: { min: 0, label: "LRS", - pad: 0 + pad: 1.1 }, yaxis: { - label: "Count", - pad: 0 + min: 0, + label: "Frequency" } } }); diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 2a60d184..590f5789 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -137,7 +137,7 @@ - + + + + + {% endblock %} \ No newline at end of file -- cgit v1.2.3