From efee455a165c4e1839d2dd091eefd5eff160b281 Mon Sep 17 00:00:00 2001 From: Artem Tarasov Date: Sun, 21 Jun 2015 02:19:34 +0300 Subject: fix mapping results loading --- .../static/new/javascript/create_lodchart.coffee | 4 +- .../static/new/javascript/create_lodchart.js | 139 +++++++++++---------- .../new/javascript/show_trait_mapping_tools.coffee | 17 ++- .../new/javascript/show_trait_mapping_tools.js | 17 ++- wqflask/wqflask/templates/base.html | 32 +---- wqflask/wqflask/templates/base_macro.html | 28 +++++ wqflask/wqflask/templates/marker_regression.html | 33 +---- wqflask/wqflask/templates/show_trait.html | 12 +- 8 files changed, 137 insertions(+), 145 deletions(-) create mode 100644 wqflask/wqflask/templates/base_macro.html diff --git a/wqflask/wqflask/static/new/javascript/create_lodchart.coffee b/wqflask/wqflask/static/new/javascript/create_lodchart.coffee index 76be5490..f1da65d7 100644 --- a/wqflask/wqflask/static/new/javascript/create_lodchart.coffee +++ b/wqflask/wqflask/static/new/javascript/create_lodchart.coffee @@ -44,8 +44,8 @@ create_manhattan_plot = -> d3.select(this) .transition().duration(500).attr("r", r*3) .transition().duration(500).attr("r", r) - -create_manhattan_plot() + +root.create_manhattan_plot = create_manhattan_plot $("#export").click => #Get d3 SVG element diff --git a/wqflask/wqflask/static/new/javascript/create_lodchart.js b/wqflask/wqflask/static/new/javascript/create_lodchart.js index f61f05bd..546d7c18 100644 --- a/wqflask/wqflask/static/new/javascript/create_lodchart.js +++ b/wqflask/wqflask/static/new/javascript/create_lodchart.js @@ -1,73 +1,76 @@ -// Generated by CoffeeScript 1.8.0 -var create_manhattan_plot; +// Generated by CoffeeScript 1.9.2 +(function() { + var create_manhattan_plot; -create_manhattan_plot = function() { - var additive, chrrect, data, h, halfh, margin, mychart, totalh, totalw, w; - h = 500; - w = 1200; - margin = { - left: 60, - top: 40, - right: 40, - bottom: 40, - inner: 5 - }; - halfh = h + margin.top + margin.bottom; - totalh = halfh * 2; - totalw = w + margin.left + margin.right; - if ('additive' in js_data) { - additive = js_data.additive; - } else { - additive = false; - } - console.log("js_data:", js_data); - mychart = lodchart().lodvarname("lod.hk").height(h).width(w).margin(margin).ylab("LOD score").manhattanPlot(js_data.manhattan_plot); - data = js_data.json_data; - d3.select("div#topchart").datum(data).call(mychart); - chrrect = mychart.chrSelect(); - chrrect.on("mouseover", function() { - return d3.select(this).attr("fill", "#E9CFEC"); - }).on("mouseout", function(d, i) { - return d3.select(this).attr("fill", function() { - if (i % 2) { - return "#F1F1F9"; - } - return "#FBFBFF"; + create_manhattan_plot = function() { + var additive, chrrect, data, h, halfh, margin, mychart, totalh, totalw, w; + h = 500; + w = 1200; + margin = { + left: 60, + top: 40, + right: 40, + bottom: 40, + inner: 5 + }; + halfh = h + margin.top + margin.bottom; + totalh = halfh * 2; + totalw = w + margin.left + margin.right; + if ('additive' in js_data) { + additive = js_data.additive; + } else { + additive = false; + } + console.log("js_data:", js_data); + mychart = lodchart().lodvarname("lod.hk").height(h).width(w).margin(margin).ylab("LOD score").manhattanPlot(js_data.manhattan_plot); + data = js_data.json_data; + d3.select("div#topchart").datum(data).call(mychart); + chrrect = mychart.chrSelect(); + chrrect.on("mouseover", function() { + return d3.select(this).attr("fill", "#E9CFEC"); + }).on("mouseout", function(d, i) { + return d3.select(this).attr("fill", function() { + if (i % 2) { + return "#F1F1F9"; + } + return "#FBFBFF"; + }); + }); + return mychart.markerSelect().on("click", function(d) { + var r; + r = d3.select(this).attr("r"); + return d3.select(this).transition().duration(500).attr("r", r * 3).transition().duration(500).attr("r", r); }); - }); - return mychart.markerSelect().on("click", function(d) { - var r; - r = d3.select(this).attr("r"); - return d3.select(this).transition().duration(500).attr("r", r * 3).transition().duration(500).attr("r", r); - }); -}; + }; -create_manhattan_plot(); + root.create_manhattan_plot = create_manhattan_plot; -$("#export").click((function(_this) { - return function() { - var filename, form, svg, svg_xml; - svg = $("#topchart").find("svg")[0]; - svg_xml = (new XMLSerializer).serializeToString(svg); - console.log("svg_xml:", svg_xml); - filename = "manhattan_plot_" + js_data.this_trait; - form = $("#exportform"); - form.find("#data").val(svg_xml); - form.find("#filename").val(filename); - return form.submit(); - }; -})(this)); + $("#export").click((function(_this) { + return function() { + var filename, form, svg, svg_xml; + svg = $("#topchart").find("svg")[0]; + svg_xml = (new XMLSerializer).serializeToString(svg); + console.log("svg_xml:", svg_xml); + filename = "manhattan_plot_" + js_data.this_trait; + form = $("#exportform"); + form.find("#data").val(svg_xml); + form.find("#filename").val(filename); + return form.submit(); + }; + })(this)); -$("#export_pdf").click((function(_this) { - return function() { - var filename, form, svg, svg_xml; - svg = $("#topchart").find("svg")[0]; - svg_xml = (new XMLSerializer).serializeToString(svg); - console.log("svg_xml:", svg_xml); - filename = "manhattan_plot_" + js_data.this_trait; - form = $("#exportpdfform"); - form.find("#data").val(svg_xml); - form.find("#filename").val(filename); - return form.submit(); - }; -})(this)); + $("#export_pdf").click((function(_this) { + return function() { + var filename, form, svg, svg_xml; + svg = $("#topchart").find("svg")[0]; + svg_xml = (new XMLSerializer).serializeToString(svg); + console.log("svg_xml:", svg_xml); + filename = "manhattan_plot_" + js_data.this_trait; + form = $("#exportpdfform"); + form.find("#data").val(svg_xml); + form.find("#filename").val(filename); + return form.submit(); + }; + })(this)); + +}).call(this); diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee index 9e070c97..29a637ee 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee @@ -76,14 +76,13 @@ do_ajax_post = (url, form_data) -> return false open_mapping_results = (data) -> - results_window = window.open() - $(results_window.document.body).html(data) - #$.colorbox( - # html: data - # href: "#mapping_results_holder" - # height: "90%" - # width: "90%" - #) + $.colorbox( + html: data + href: "#mapping_results_holder" + height: "90%" + width: "90%" + onComplete: => root.create_manhattan_plot() + ) showalert = (message,alerttype) -> $('#alert_placeholder').append('
- {{ second }} -
-+ {{ second }} +
+