From 81205be9a657c3fb350fe797ecefe615c0b9a4b7 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 18 May 2020 11:48:14 -0500 Subject: Fixed issue with phenotype correlation table and added Plotly Chart Studio link to correlation scatterplots --- wqflask/wqflask/correlation/show_corr_results.py | 2 ++ .../static/new/javascript/draw_corr_scatterplot.js | 2 ++ wqflask/wqflask/templates/correlation_page.html | 34 +++++++++++++++------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index cc74c8e4..b099b83d 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -609,6 +609,7 @@ def get_header_fields(data_type, corr_method): if corr_method == "spearman": header_fields = ['Index', 'Record', + 'Abbreviation', 'Description', 'Authors', 'Year', @@ -621,6 +622,7 @@ def get_header_fields(data_type, corr_method): else: header_fields = ['Index', 'Record', + 'Abbreviation', 'Description', 'Authors', 'Year', diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index a0a88773..956e0467 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -132,6 +132,8 @@ var modebar_options = { Plotly.downloadImage(gd, {format: 'jpeg'}) } }], + showEditInChartStudio: true, + plotlyServerURL: "https://chart-studio.plotly.com", modeBarButtonsToRemove:['toImage', 'sendDataToCloud', 'hoverClosest', 'hoverCompare', 'hoverClosestCartesian', 'hoverCompareCartesian', 'lasso2d', 'toggleSpikelines'], displaylogo: false } diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 23136257..1c84239c 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -82,6 +82,7 @@
+ {% if target_dataset.type != "Publish" %}

@@ -107,6 +108,7 @@

+ {% endif %}
Show/Hide Columns: @@ -162,9 +164,9 @@ {% if trait.abbreviation %} {% if trait.abbreviation|length > 20 %}{{ trait.abbreviation[:20] }}...{% else %}{{ trait.abbreviation }}{% endif %} {% else %} - N/A + N/A {% endif %} - {{ trait.description_display }} + {% if trait.description_display|length > 50 %}{{ trait.description_display[:50] }}...{% else %}{{ trait.description_display }}{% endif %} {{ trait.authors }} @@ -192,7 +194,7 @@ {% endblock %} {% block js %} - + @@ -239,8 +241,7 @@ return ((x < y) ? 1 : ((x > y) ? -1 : 0)); }; - //$.fn.dataTableExt.afnFiltering.push( - + {% if target_dataset.type != "Publish" %} $.fn.dataTable.ext.search.push( function( settings, data, dataIndex ) { var r_column = {{ filter_cols[0] }}; var r_greater = parseFloat($('input[name=r_greater_select]').val()) @@ -280,6 +281,7 @@ } return true }); + {% endif %} $(document).ready( function () { @@ -303,7 +305,6 @@ $(button).prop("disabled", false); } } - //}); if ($(this).is(":checked")) { if (!$(this).closest('tr').hasClass('selected')) { $(this).closest('tr').addClass('selected') @@ -382,8 +383,15 @@ {% elif target_dataset.type == "Publish" %} table_conf = { - "paging": false, - buttons: [ + "drawCallback": function( settings ) { + $('#trait_table tr').click(function(event) { + if (event.target.type !== 'checkbox') { + $(':checkbox', this).trigger('click'); + } + }); + $('.trait_checkbox:checkbox').on("change", change_buttons); + }, + "buttons": [ { extend: 'columnsToggle', columns: function( idx, data, node ) { @@ -426,10 +434,14 @@ $('td', row).eq(4).text($('td', row).eq(4).text() + '...') } }, - "order": [[8, "asc" ]], + "order": [[9, "asc" ]], "sDom": "Btir", + "iDisplayLength": -1, "autoWidth": false, - "bDeferRender": true + "deferRender": true, + "bSortClasses": false, + "paging": false, + "orderClasses": true, } {% elif target_dataset.type == "Geno" %} table_conf = { @@ -468,7 +480,7 @@ } {% endif %} - var the_table = $('#trait_table').DataTable(table_conf); + the_table = $('#trait_table').DataTable(table_conf); console.timeEnd("Creating table"); -- cgit v1.2.3