Commit 3eb36527 authored by Mikaël Salson's avatar Mikaël Salson Committed by Mathieu Giraud

js/: Replaces the former exportSVG solution.

Fixes #3240
parent 6f54a4b9
Pipeline #39815 passed with stages
in 4 minutes and 38 seconds
......@@ -130,8 +130,8 @@
</div>
<div class="menu_box">
<a class="buttonSelector" id="export_analysis" onclick="javascript:m.saveAnalysis()">export analysis</a>
<a class="buttonSelector" id="export_svg1" onclick="javascript:graph.resize(1400,800);m.exportSVG('visu2_svg')">export SVG graph</a>
<a class="buttonSelector" id="export_svg2" onclick="javascript:sp.resize(1400,800);sp.fastForward();m.exportSVG('visu_svg')">export SVG plot</a>
<a class="buttonSelector" id="export_svg1" onclick="javascript:exportD3ToPNG(document.querySelector('#visu2_svg'))">export top graph</a>
<a class="buttonSelector" id="export_svg2" onclick="javascript:exportD3ToPNG(document.querySelector('#visu_svg'))">export bottom graph</a>
<a class="buttonSelector" id="export_csv" onclick="javascript:m.exportCSV()">export csv (visible clones)</a>
<a class="buttonSelector" id="export_fasta" onclick="javascript:m.exportFasta()">export fasta (selected clones)</a>
</div>
......
......@@ -14,7 +14,8 @@ require(["jquery",
"tsne",
"jstree.min",
"jquery.caret",
"jquery.atwho"], function() {
"jquery.atwho",
"svgExport"], function() {
// Then config file (needed by Vidjil)
require(['../conf'], function() {
loadAfterConf()
......
......@@ -2089,41 +2089,7 @@ changeAlleleNotation: function(alleleNotation) {
saveAs(textFileAsBlob, filename + ".csv");
},
/**
* save a svg file of the selected svg element.
* @return {file} svg
* */
exportSVG: function (elementID) {
var self = this;
var element = document.getElementById(elementID);
$(document).ready(function() {
$.when($.get("css/svg.css"))
.done(function(css) {
var textToWrite = '<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">';
textToWrite += "<style>";
css = css.replace(/\/\*.+?\*\/|\/\/.*(?=[\n\r])/g, '');
textToWrite += css;
textToWrite += "</style>";
textToWrite += element.innerHTML;
textToWrite += "</svg>";
var textFileAsBlob = new Blob([textToWrite], {
type: 'text'
});
var filename = self.getPrintableAnalysisName().replace(/[ \/\\:]/,'_')
saveAs(textFileAsBlob, filename + ".svg");
self.resize();
});
})
},
/**
* save a csv file of the currently visibles clones.
* @return {string} csv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment