diff options
author | zsloan | 2020-01-07 14:05:23 -0600 |
---|---|---|
committer | zsloan | 2020-01-07 14:05:23 -0600 |
commit | 73b6f1241a04b76837dccb9e801ecdde635843a8 (patch) | |
tree | 241b5816d794747e559ca333b8d0fcf019cc4f93 | |
parent | 6b229c45d56b87848e772c42ccea2bc23fbc1a19 (diff) | |
download | genenetwork2-73b6f1241a04b76837dccb9e801ecdde635843a8.tar.gz |
Added SVG export to corr scatterplot and generally made the top modebar the same as the trait page stats figures
-rw-r--r-- | wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index 9ab0727c..a0a88773 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -117,6 +117,25 @@ var sr_layout = { ] } +var modebar_options = { + modeBarButtonsToAdd:[{ + name: 'Export as SVG', + icon: Plotly.Icons.camera, + click: function(gd) { + Plotly.downloadImage(gd, {format: 'svg'}) + } + }, + { + name: 'Export as JPEG', + icon: Plotly.Icons.disk, + click: function(gd) { + Plotly.downloadImage(gd, {format: 'jpeg'}) + } + }], + modeBarButtonsToRemove:['toImage', 'sendDataToCloud', 'hoverClosest', 'hoverCompare', 'hoverClosestCartesian', 'hoverCompareCartesian', 'lasso2d', 'toggleSpikelines'], + displaylogo: false +} + cofactor1_dict = {} ranked_cofactor1_dict = {} //cofactor1_values = [] @@ -155,7 +174,7 @@ function drawg() { } } - Plotly.newPlot('scatterplot2', [trace2, trace1], layout) + Plotly.newPlot('scatterplot2', [trace2, trace1], layout, modebar_options) } @@ -177,7 +196,7 @@ function srdrawg() { hoverinfo: "text+x+y" } - Plotly.newPlot('srscatterplot2', [trace1], sr_layout) + Plotly.newPlot('srscatterplot2', [trace1], sr_layout, modebar_options) } function getdata() { @@ -611,10 +630,10 @@ function chartupdatewh() { width: width } - Plotly.newPlot('scatterplot2', getdata(), layout) + Plotly.newPlot('scatterplot2', getdata(), layout, modebar_options) Plotly.relayout('scatterplot2', width_height_update) - Plotly.newPlot('srscatterplot2', srgetdata(), sr_layout) + Plotly.newPlot('srscatterplot2', srgetdata(), sr_layout, modebar_options) Plotly.relayout('srscatterplot2', width_height_update) } @@ -689,9 +708,9 @@ function chartupdatedata() { title: "Spearman Rank Correlation Scatterplot" } - Plotly.newPlot('scatterplot2', getdata(), layout) + Plotly.newPlot('scatterplot2', getdata(), layout, modebar_options) Plotly.relayout('scatterplot2', pearson_title_update) - Plotly.newPlot('srscatterplot2', srgetdata(), sr_layout) + Plotly.newPlot('srscatterplot2', srgetdata(), sr_layout, modebar_options) Plotly.relayout('srscatterplot2', spearman_title_update) if ($('#cofactor1_type option:selected').val() == "color"){ |