Commit ec794adf authored by Marc Duez's avatar Marc Duez

export.js : remove all hazardous asynchronous call (multiple graph can be...

export.js : remove all hazardous asynchronous call (multiple graph can be generated in a same report without conflict)
better faster stronger
parent 22b9b705
......@@ -15,6 +15,7 @@ Report.prototype = {
this.w.onload = function(){
self.addGraph(list)
.addScatterplot()
}
},
......@@ -28,10 +29,8 @@ Report.prototype = {
this.w.onload = function(){
for (var i=0; i<m.system_selected.length; i++){
setTimeout(function(i){
var system = m.system_selected[i]
self.addScatterplot(system, m.t)
},4000*i,i);
var system = m.system_selected[i]
self.addScatterplot(system, m.t)
}
}
},
......@@ -59,6 +58,7 @@ Report.prototype = {
//resize 791px ~> 21cm
graph.resize(791,300)
graph.draw(0)
//add graph container now
var w_graph = $('<div/>', {
......@@ -66,40 +66,37 @@ Report.prototype = {
class: 'container'
}).appendTo(this.w.document.body);
//but complete it asynchronously
setTimeout( function(){
svg_graph = document.getElementById(graph.id).cloneNode(true);
svg_graph = document.getElementById(graph.id).cloneNode(true);
for (var i = 0; i < m.clones.length; i++) {
var polyline = svg_graph.querySelectorAll('[id="polyline'+i+'"]')[0]
var tag = m.clone(i).getTag()
var color = tagColor[tag]
for (var i = 0; i < m.clones.length; i++) {
var polyline = svg_graph.querySelectorAll('[id="polyline'+i+'"]')[0]
var tag = m.clone(i).getTag()
var color = tagColor[tag]
//stack
if (polyline.getAttribute("d").indexOf("Z") != -1){
polyline.setAttribute("style", "stroke-width:0px");
polyline.setAttribute("fill", color);
}else{//line
if (list.indexOf(i) != -1){
polyline.setAttribute("style", "stroke-width:3px");
}else if (tag != 8){
polyline.setAttribute("style", "stroke-width:1.5px");
}else{
polyline.setAttribute("style", "stroke-width:0.5px; opacity:0.5");
}
polyline.setAttribute("stroke", color);
}
//remove "other" and disabled clones
if (m.clone(i).id == "other" || !m.clone(i).isActive()) {
polyline.parentNode.removeChild(polyline);
//stack
if (polyline.getAttribute("d").indexOf("Z") != -1){
polyline.setAttribute("style", "stroke-width:0px");
polyline.setAttribute("fill", color);
}else{//line
if (list.indexOf(i) != -1){
polyline.setAttribute("style", "stroke-width:3px");
}else if (tag != 8){
polyline.setAttribute("style", "stroke-width:1.5px");
}else{
polyline.setAttribute("style", "stroke-width:0.5px; opacity:0.5");
}
polyline.setAttribute("stroke", color);
}
w_graph.html(svg_graph.innerHTML)
graph.resize();
},200)
//remove "other" and disabled clones
if (m.clone(i).id == "other" || !m.clone(i).isActive()) {
polyline.parentNode.removeChild(polyline);
}
}
w_graph.html(svg_graph.innerHTML)
graph.resize();
return this;
},
......@@ -117,35 +114,32 @@ Report.prototype = {
//resize 791px ~> 21cm
sp.resize(791,250)
//sp.zap()
sp.fastForward()
//add sp container now
var w_sp = $('<div/>', {
id: 'scatterplot',
class: 'container'
}).appendTo(this.w.document.body);
//but complete it asynchronously
setTimeout(function(){
svg_sp = document.getElementById(sp.id).cloneNode(true);
//set viewbox (same as resize)
svg_sp.querySelectorAll('[id="'+sp.id+'_svg"]')[0].setAttribute("viewbox","0 0 791 250");
svg_sp = document.getElementById(sp.id).cloneNode(true);
//set viewbox (same as resize)
svg_sp.querySelectorAll('[id="'+sp.id+'_svg"]')[0].setAttribute("viewbox","0 0 791 250");
for (var i = 0; i < m.clones.length; i++) {
var circle = svg_sp.querySelectorAll('[id="circle'+i+'"]')[0]
var color = tagColor[m.clone(i).getTag()]
circle.setAttribute("stroke", color);
for (var i = 0; i < m.clones.length; i++) {
var circle = svg_sp.querySelectorAll('[id="circle'+i+'"]')[0]
var color = tagColor[m.clone(i).getTag()]
circle.setAttribute("stroke", color);
//remove "other" and disabled clones
if (m.clone(i).germline != system || m.clone(i).id == "other" || !m.clone(i).isActive()) {
circle.parentNode.removeChild(circle);
}
//remove "other" and disabled clones
if (m.clone(i).germline != system || m.clone(i).id == "other" || !m.clone(i).isActive()) {
circle.parentNode.removeChild(circle);
}
w_sp.html(svg_sp.innerHTML)
sp.resize();
},3000)
}
w_sp.html(svg_sp.innerHTML)
sp.resize();
}
}
......
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