From 321d8e544f1765845b7cb31bceff7c4d3929d394 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 10 Jan 2013 17:13:44 -0600 Subject: Checking in before trying to put manhattan plot sections closer together --- .../wqflask/static/new/css/marker_regression.css | 2 +- .../static/new/javascript/marker_regression.coffee | 47 +++++++++++++------ .../static/new/javascript/marker_regression.js | 54 ++++++++++++++-------- 3 files changed, 71 insertions(+), 32 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/css/marker_regression.css b/wqflask/wqflask/static/new/css/marker_regression.css index 7bfb10fb..58da563c 100644 --- a/wqflask/wqflask/static/new/css/marker_regression.css +++ b/wqflask/wqflask/static/new/css/marker_regression.css @@ -16,4 +16,4 @@ height: 400px; width: 900px; clear: both; -} +} \ No newline at end of file diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.coffee b/wqflask/wqflask/static/new/javascript/marker_regression.coffee index 6a5e4d77..655c8d1a 100644 --- a/wqflask/wqflask/static/new/javascript/marker_regression.coffee +++ b/wqflask/wqflask/static/new/javascript/marker_regression.coffee @@ -88,13 +88,16 @@ $ -> #console.log("max_lrs is", max_lrs) + x_axis_max = Math.ceil(@max_mb/25) * 25 x_axis_ticks = [] x_tick = 0 while (x_tick <= x_axis_max) x_axis_ticks.push(x_tick) x_tick += 25 - $.jqplot(div_name, [@plot_points], + + + plot_options = title: @name seriesDefaults: showLine: false @@ -115,15 +118,29 @@ $ -> showGridline: false formatString: '%d' label: "Megabases" - yaxis: - min: 0 - max: Math.floor(max_lrs + 0.1 * max_lrs) - tickInterval: 1 - label: "LRS" - tickOptions: - formatString: '%d' - showGridline: false - ) + + + + if @name == "1" + plot_options.axes.yaxis = + min: 0 + max: Math.floor(max_lrs + 0.1 * max_lrs) + tickInterval: 1 + label: "LRS" + tickOptions: + formatString: '%d' + showGridline: false + else + plot_options.axes.yaxis = + show: false + min: 0 + max: Math.floor(max_lrs + 0.1 * max_lrs) + tickInterval: 1 + tickOptions: + formatString: '%d' + showGridline: false + + $.jqplot(div_name, [@plot_points], plot_options) class Manhattan_Plot constructor: -> @@ -133,8 +150,7 @@ $ -> @build_chromosomes() @display_graphs() - - + build_chromosomes: -> for result in js_data.qtl_results #if result.locus.chromosome == '1' @@ -165,11 +181,16 @@ $ -> console.log("keys are:", keys) for key in keys - html = """
""" + this_class = "manhattan_plot_segment" + if key != "1" + this_class += " no_y_axis" + html = """
""" console.log("html is:", html) $("#manhattan_plots").append(html) @chromosomes[key].display_graph(@max_lrs) + $(".jqplot-yaxis").hide() + $(".jqplot-yaxis-tick").hide() #process_data: -> diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.js b/wqflask/wqflask/static/new/javascript/marker_regression.js index fce31f79..6f4a33e7 100644 --- a/wqflask/wqflask/static/new/javascript/marker_regression.js +++ b/wqflask/wqflask/static/new/javascript/marker_regression.js @@ -88,7 +88,7 @@ }; Chromosome.prototype.display_graph = function(max_lrs) { - var div_name, x_axis_max, x_axis_ticks, x_tick; + var div_name, plot_options, x_axis_max, x_axis_ticks, x_tick; div_name = 'manhattan_plot_' + this.name; console.log("div_name:", div_name); x_axis_max = Math.ceil(this.max_mb / 25) * 25; @@ -98,7 +98,7 @@ x_axis_ticks.push(x_tick); x_tick += 25; } - return $.jqplot(div_name, [this.plot_points], { + plot_options = { title: this.name, seriesDefaults: { showLine: false, @@ -123,19 +123,33 @@ formatString: '%d' }, label: "Megabases" - }, - yaxis: { - min: 0, - max: Math.floor(max_lrs + 0.1 * max_lrs), - tickInterval: 1, - label: "LRS", - tickOptions: { - formatString: '%d', - showGridline: false - } } } - }); + }; + if (this.name === "1") { + plot_options.axes.yaxis = { + min: 0, + max: Math.floor(max_lrs + 0.1 * max_lrs), + tickInterval: 1, + label: "LRS", + tickOptions: { + formatString: '%d', + showGridline: false + } + }; + } else { + plot_options.axes.yaxis = { + show: false, + min: 0, + max: Math.floor(max_lrs + 0.1 * max_lrs), + tickInterval: 1, + tickOptions: { + formatString: '%d', + showGridline: false + } + }; + } + return $.jqplot(div_name, [this.plot_points], plot_options); }; return Chromosome; @@ -173,7 +187,7 @@ /* Call display_graph for each chromosome */ - var extra_keys, html, key, keys, numbered_keys, _i, _len, _results; + var extra_keys, html, key, keys, numbered_keys, this_class, _i, _len; numbered_keys = []; extra_keys = []; for (key in this.chromosomes) { @@ -187,15 +201,19 @@ extra_keys.sort(); keys = numbered_keys.concat(extra_keys); console.log("keys are:", keys); - _results = []; for (_i = 0, _len = keys.length; _i < _len; _i++) { key = keys[_i]; - html = "
"; + this_class = "manhattan_plot_segment"; + if (key !== "1") { + this_class += " no_y_axis"; + } + html = "
"; console.log("html is:", html); $("#manhattan_plots").append(html); - _results.push(this.chromosomes[key].display_graph(this.max_lrs)); + this.chromosomes[key].display_graph(this.max_lrs); } - return _results; + $(".jqplot-yaxis").hide(); + return $(".jqplot-yaxis-tick").hide(); }; return Manhattan_Plot; -- cgit v1.2.3