Commit 68357451 authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-c/conversion_D3V5' into 'dev'

Feature c/conversion d3 v5

See merge request !561
parents 400c513c 10c8211f
Pipeline #117018 passed with stages
in 6 minutes and 26 seconds
......@@ -29,4 +29,6 @@ dep.mk
/browser/cgi/align.cgi
/browser/js/conf.js
node_modules/
cypress/
\ No newline at end of file
cypress/
server/web2py/applications/vidjil/errors
*.bak
......@@ -190,7 +190,7 @@ line {
fill: #000000;
}
.graph_line {
stroke-width: 2.5px;
stroke-width: 1.5px;
cursor: pointer;
stroke: #839496;
}
......@@ -204,7 +204,7 @@ line {
opacity: 0.8;
}
.graph_inactive {
stroke-width: 1.5px;
stroke-width: 0.5px;
cursor: pointer;
display: none;
}
......@@ -247,10 +247,12 @@ line {
#resolution1 {
fill: #000000;
opacity: 1;
pointer-events: none;
}
#resolution5 {
fill: #333333;
fill: #000000;
opacity: 0.6;
pointer-events: none;
}
.graph_time {
fill: #839496;
......
......@@ -190,7 +190,7 @@ line {
fill: #ffffff;
}
.graph_line {
stroke-width: 2.5px;
stroke-width: 1.5px;
cursor: pointer;
stroke: #657b83;
}
......@@ -204,7 +204,7 @@ line {
opacity: 0.8;
}
.graph_inactive {
stroke-width: 1.5px;
stroke-width: 0.5px;
cursor: pointer;
display: none;
}
......@@ -247,10 +247,13 @@ line {
#resolution1 {
fill: #ffffff;
opacity: 1;
pointer-events: none;
}
#resolution5 {
fill: #cccccc;
opacity: 0.6;
pointer-events: none;
}
.graph_time {
fill: #657b83;
......
......@@ -250,7 +250,7 @@ line {
}
.graph_line{
stroke-width : 2.5px;
stroke-width : 1.5px;
cursor:pointer;
stroke: @default;
}
......@@ -267,7 +267,7 @@ line {
}
.graph_inactive{
stroke-width : 1.5px;
stroke-width : 0.5px;
cursor:pointer;
display:none;
}
......@@ -317,11 +317,13 @@ line {
#resolution1{
fill : @background;
opacity : 1;
pointer-events: none;
}
#resolution5{
fill: @border;
fill: @background;
opacity: 0.6;
pointer-events: none;
}
.graph_time{
......
......@@ -4,13 +4,14 @@ requirejs.config({
baseUrl: 'js/lib',
paths: {
app: '',
jquery: 'jquery-3.3.1.min'
jquery: 'jquery-3.3.1.min',
d3: 'd3.v5.min',
}
});
// Load required libraries first
require(['d3'], function(d3) {window.d3 = d3;});
require(["jquery",
"d3.v3",
"jquery.form",
"file",
"tsne",
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -748,7 +748,7 @@ changeAlleleNotation: function(alleleNotation) {
clone.normalized_reads[time] != null &&
raw == undefined) {
return clone.normalized_reads[time] ;
} else if (clone.hasSizeDistrib()){
} else if (clone.hasSizeDistrib() && !isNaN(clone.current_reads[time])){
return clone.current_reads[time]
} else {
return clone.reads[time] ;
......@@ -820,34 +820,30 @@ changeAlleleNotation: function(alleleNotation) {
* compute min/max clones sizes and abundance color scale<br>
* clone size can change depending the parameter so it's neccesary to recompute precision from time to time
* */
update_precision: function () {
var min_size = 1
var max
update_precision: function () {
this.min_size = 1
this.max_size = 0
for (var i=0; i<this.samples.order.length; i++){
var t = this.samples.order[i]
var size = this.min_sizes[t]
size = this.normalize(this.min_sizes[t], t)
if (size < min_size) min_size = size
if (size < this.min_size) this.min_size = size
}
this.max_size = 1
this.min_size = min_size
if (this.normalization_mode != this.NORM_FALSE){
for (var j=0; j<this.samples.order.length; j++){
if(this.normalization.size_list[j]==0){
max = this.normalization.expected_size
}else{
max = this.normalization.expected_size/this.normalization.size_list[j]
}
if (max>this.max_size) this.max_size=max;
for (var j=0;j<this.clones.length;j++){
if (this.clone(j).isActive()) {
max_s = this.clones[j].getMaxSize()
if (max_s > this.max_size)
this.max_size = max_s
}
}
}
//*2 pour avoir une marge minimum d'un demi-log
// 1/0 == infinity
this.precision=(1/this.min_size)*2
this.scale_color = d3.scale.log()
this.scale_color = d3.scaleLog()
.domain([1, this.precision])
.range([250, 0]);
},
......@@ -1301,13 +1297,14 @@ changeAlleleNotation: function(alleleNotation) {
* display an icon in the top-container if a view has not finished an update
*/
updateIcon:function(){
var div = document.getElementById("updateIcon");
if (div==null) return
if (typeof (this.divUpdateIcon) == "undefined")
this.divUpdateIcon = document.getElementById("updateIcon");
if (this.divUpdateIcon==null) return
if (this.updateIsPending())
div.style.display = "flex";
this.divUpdateIcon.style.display = "flex";
else
div.style.display = "none";
this.divUpdateIcon.style.display = "none";
},
/**
......
......@@ -130,11 +130,11 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
var range = [0,1]
if (self.reverse) range = [1,0]
if (use_log){
this.sizeScale = d3.scale.log()
this.sizeScale = d3.scaleLog()
.domain([min, max])
.range(range);
}else{
this.sizeScale = d3.scale.linear()
this.sizeScale = d3.scaleLinear()
.domain([min, max])
.range(range);
}
......
This diff is collapsed.
......@@ -11,9 +11,10 @@ QUnit.test("svg path builder", function(assert) {
var graph = new Graph("visu",m)
graph.max_ratio_between_deltas = 1.0
graph.init()
graph.lineGenerator = d3.line().curve(d3.curveLinear);
assert.equal(graph.constructPath(0), " M 70.02,40.565412010323904 L 70.05,40.565412010323904 L 70.35,40.434587989676096 L 70.65,40.488884864051364 L 70.95,40.35806084340355 L 70.98,40.35806084340355")
assert.equal(graph.constructPathR(5), " M 70,41.1 L 70,40.69623603097172 L 70.05,40.69623603097172 L 70.35,40.565412010323904 L 70.65,40.69623603097172 L 70.95,40.565412010323904 L 71,40.565412010323904 L 71,41.1 Z ", "resolution curve 5 reads")
assert.equal(graph.constructPath(0), "M70.02,40.565L70.05,40.565L70.35,40.435L70.65,40.489L70.95,40.358L70.98,40.358")
assert.equal(graph.constructPathR(5), "M70,41.1L70,40.696L70.05,40.696L70.35,40.565L70.65,40.696L70.95,40.565L71,40.565L71,41.1")
var stack = new Stack(m)
stack.compute();
assert.equal(graph.constructStack(1, stack), " M 70.05,40.95 L 70.35,40.9 L 70.65,40.925 L 70.95,40.85 L 70.95,40.75 L 70.65,40.875 L 70.35,40.7 L 70.05,40.85 Z", "path stack clone 1")
......@@ -28,6 +29,7 @@ QUnit.test("init", function(assert) {
var graph = new Graph("visu",m)
graph.max_ratio_between_deltas = 1.0
graph.init()
graph.lineGenerator = d3.line().curve(d3.curveLinear);
graph.initData()
assert.deepEqual(graph.data_data[0], {"active": false,
......@@ -40,7 +42,7 @@ QUnit.test("init", function(assert) {
assert.deepEqual(graph.data_clone[0], {
"id": 0,
"name": "line0",
"path": " M 70.02,40.565412010323904 L 70.05,40.565412010323904 L 70.35,40.434587989676096 L 70.65,40.488884864051364 L 70.95,40.35806084340355 L 70.98,40.35806084340355"
"path": "M70.02,40.565L70.05,40.565L70.35,40.435L70.65,40.489L70.95,40.358L70.98,40.358"
},
"initClones")
......@@ -48,7 +50,7 @@ QUnit.test("init", function(assert) {
assert.deepEqual(graph.data_res[0], {
"id": 7,
"name": "resolution1",
"path": " M 70,41.1 L 70,41 L 70.05,41 L 70.35,40.869175979352185 L 70.65,41 L 70.95,40.869175979352185 L 71,40.869175979352185 L 71,41.1 Z "
"path": "M70,41.1L70,41L70.05,41L70.35,40.869L70.65,41L70.95,40.869L71,40.869L71,41.1"
},
"initRes")
......
......@@ -117,16 +117,16 @@ QUnit.test("speed", function(assert) {
//average
aAccessTime1 = 0
for (i = 0; i<accessTime1.length; i++) aAccessTime1+=accessTime1[i]
aAccessTime1 = (aAccessTime1*1000/accessTime1.length)
for (i = 100; i<accessTime1.length-100; i++) aAccessTime1+=accessTime1[i]
aAccessTime1 = (aAccessTime1*1000/(accessTime1.length-200))
aAccessTime2 = 0
for (i = 0; i<accessTime2.length; i++) aAccessTime2+=accessTime2[i]
aAccessTime2 = (aAccessTime2*1000/accessTime2.length)
for (i = 100; i<accessTime2.length-100; i++) aAccessTime2+=accessTime2[i]
aAccessTime2 = (aAccessTime2*1000/(accessTime1.length-200))
aAccessTime3 = 0
for (i = 0; i<accessTime3.length; i++) aAccessTime3+=accessTime3[i]
aAccessTime3 = (aAccessTime3*1000/accessTime3.length)
for (i = 100; i<accessTime3.length-100; i++) aAccessTime3+=accessTime3[i]
aAccessTime3 = (aAccessTime3*1000/(accessTime1.length-200))
assert.ok(aAccessTime1 > aAccessTime2, "dom access using indexed dom after first use are faster "+aAccessTime1.toFixed(5)+"ns > "+aAccessTime2.toFixed(5)+"ns"+
" ("+(((aAccessTime1/aAccessTime2)-1)*100).toFixed(0)+"% faster)" );
......
......@@ -170,7 +170,7 @@ QUnit.test("multiple selection", function(assert) {
test2();
done();
});
}, 1000);
function test1() {
sp.activeSelectorAt([sp_width*0.5, sp_height*0.5]);
......
......@@ -14,7 +14,7 @@
}
</style>
<script type="text/javascript" src='../../js/lib/d3.v3.js'></script>
<script type="text/javascript" src='../../js/lib/d3.v5.min.js'></script>
<script type="text/javascript" src="../../js/lib/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../js/lib/jquery.form.js"></script>
<script type="text/javascript" src='../../js/lib/file.js'></script>
......
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