From f54165c5979d2e8cb10948abd027574c815a3e1c Mon Sep 17 00:00:00 2001 From: Artem Tarasov Date: Tue, 23 Jun 2015 20:41:20 +0300 Subject: use button for returning to full view --- .../static/new/javascript/chr_lod_chart.coffee | 16 ++---- .../wqflask/static/new/javascript/chr_lod_chart.js | 59 ++++++++++++---------- wqflask/wqflask/templates/marker_regression.html | 1 + 3 files changed, 36 insertions(+), 40 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/chr_lod_chart.coffee b/wqflask/wqflask/static/new/javascript/chr_lod_chart.coffee index 321957b3..e00694be 100644 --- a/wqflask/wqflask/static/new/javascript/chr_lod_chart.coffee +++ b/wqflask/wqflask/static/new/javascript/chr_lod_chart.coffee @@ -193,18 +193,7 @@ class Chr_Lod_Chart .attr("fill", "black") add_back_button: () -> - @svg.append("text") - .attr("class", "back") - .text("Return to full view") - .attr("x", @x_buffer*2) - .attr("y", @y_buffer/2) - .attr("dx", "0em") - .attr("text-anchor", "middle") - .attr("font-family", "sans-serif") - .attr("font-size", "18px") - .attr("cursor", "pointer") - .attr("fill", "black") - .on("click", @return_to_full_view) + $("#return_to_full_view").show().click => @return_to_full_view() add_path: () -> line_function = d3.svg.line() @@ -281,9 +270,10 @@ class Chr_Lod_Chart ) return_to_full_view: () -> + $("#return_to_full_view").hide() $('#topchart').remove() $('#chart_container').append('
') - create_manhattan_plot() + create_lod_chart() show_marker_in_table: (marker_info) -> console.log("in show_marker_in_table") diff --git a/wqflask/wqflask/static/new/javascript/chr_lod_chart.js b/wqflask/wqflask/static/new/javascript/chr_lod_chart.js index 95dbb4e2..c060d9d7 100644 --- a/wqflask/wqflask/static/new/javascript/chr_lod_chart.js +++ b/wqflask/wqflask/static/new/javascript/chr_lod_chart.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.8.0 +// Generated by CoffeeScript 1.9.2 var Chr_Lod_Chart; Chr_Lod_Chart = (function() { @@ -38,28 +38,28 @@ Chr_Lod_Chart = (function() { } Chr_Lod_Chart.prototype.get_max_chr = function() { - var key, _results; + var key, results; this.max_chr = 0; - _results = []; + results = []; for (key in js_data.chromosomes) { console.log("key is:", key); if (parseInt(key) > this.max_chr) { - _results.push(this.max_chr = parseInt(key)); + results.push(this.max_chr = parseInt(key)); } else { - _results.push(void 0); + results.push(void 0); } } - return _results; + return results; }; Chr_Lod_Chart.prototype.filter_qtl_results = function() { - var result, this_chr, _i, _len, _ref, _results; + var i, len, ref, result, results, this_chr; this.these_results = []; this_chr = 100; - _ref = this.qtl_results; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - result = _ref[_i]; + ref = this.qtl_results; + results = []; + for (i = 0, len = ref.length; i < len; i++) { + result = ref[i]; if (result.chr === "X") { this_chr = this.max_chr; } else { @@ -71,20 +71,20 @@ Chr_Lod_Chart = (function() { break; } if (parseInt(this_chr) === parseInt(this.chr[0])) { - _results.push(this.these_results.push(result)); + results.push(this.these_results.push(result)); } else { - _results.push(void 0); + results.push(void 0); } } - return _results; + return results; }; Chr_Lod_Chart.prototype.get_qtl_count = function() { - var high_qtl_count, result, _i, _len, _ref; + var high_qtl_count, i, len, ref, result; high_qtl_count = 0; - _ref = this.these_results; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - result = _ref[_i]; + ref = this.these_results; + for (i = 0, len = ref.length; i < len; i++) { + result = ref[i]; if (result.lod_score > 1) { high_qtl_count += 1; } @@ -94,16 +94,16 @@ Chr_Lod_Chart = (function() { }; Chr_Lod_Chart.prototype.create_coordinates = function() { - var result, _i, _len, _ref, _results; - _ref = this.these_results; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - result = _ref[_i]; + var i, len, ref, result, results; + ref = this.these_results; + results = []; + for (i = 0, len = ref.length; i < len; i++) { + result = ref[i]; this.x_coords.push(parseFloat(result.Mb)); this.y_coords.push(result.lod_score); - _results.push(this.marker_names.push(result.name)); + results.push(this.marker_names.push(result.name)); } - return _results; + return results; }; Chr_Lod_Chart.prototype.create_svg = function() { @@ -189,7 +189,11 @@ Chr_Lod_Chart = (function() { }; Chr_Lod_Chart.prototype.add_back_button = function() { - return this.svg.append("text").attr("class", "back").text("Return to full view").attr("x", this.x_buffer * 2).attr("y", this.y_buffer / 2).attr("dx", "0em").attr("text-anchor", "middle").attr("font-family", "sans-serif").attr("font-size", "18px").attr("cursor", "pointer").attr("fill", "black").on("click", this.return_to_full_view); + return $("#return_to_full_view").show().click((function(_this) { + return function() { + return _this.return_to_full_view(); + }; + })(this)); }; Chr_Lod_Chart.prototype.add_path = function() { @@ -253,9 +257,10 @@ Chr_Lod_Chart = (function() { }; Chr_Lod_Chart.prototype.return_to_full_view = function() { + $("#return_to_full_view").hide(); $('#topchart').remove(); $('#chart_container').append('
'); - return create_manhattan_plot(); + return create_lod_chart(); }; Chr_Lod_Chart.prototype.show_marker_in_table = function(marker_info) { diff --git a/wqflask/wqflask/templates/marker_regression.html b/wqflask/wqflask/templates/marker_regression.html index 0cd004cd..d8f64c20 100755 --- a/wqflask/wqflask/templates/marker_regression.html +++ b/wqflask/wqflask/templates/marker_regression.html @@ -19,6 +19,7 @@ +
-- cgit v1.2.3