Commit 8423b53f authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-c/2363-axes-logarithmes-et-0' into 'dev'

Feature c/2363 axes logarithmes et 0, inversion des axes

Closes #4396 and #2363

See merge request !767
parents 65752d2e a42ab748
Pipeline #159712 passed with stages
in 7 minutes and 49 seconds
......@@ -214,7 +214,7 @@ AXIS_DEFAULT = {
"size" : {
doc: "ratio of the number of reads of each clone to the total number of reads in the selected locus",
name: "size",
fct : function(clone,t){return clone.getSizeZero(t)},
fct : function(clone,t){return clone.getSize(t)},
scale: { mode: "log"},
autofill: true,
pretty: function(size) {return createClassedSpan("sizeBox sixChars", (self.m ? self.m : self).getStrAnySize(undefined, size)) }
......@@ -222,11 +222,11 @@ AXIS_DEFAULT = {
"size (other sample)" : {
doc: "ratio of the number of reads of each clone to the total number of reads in the selected locus, on a second sample",
name: "size (other sample)",
fct : function(clone){
var size = clone.getSizeZero(m.tOther) ;
return (typeof size == "undefined") ? self.m.min_size : size
fct : function(clone){return clone.getSize(m.tOther)},
scale: {
mode: "log",
reverse: true
},
scale: { mode: "log"},
autofill: true
},
"number of samples" : {
......
......@@ -267,15 +267,19 @@ Axis.prototype = {
//add labels
if (this.scale.reverse){
for (var k = this.scale.nice_min; k < this.scale.nice_max+1; k=k*10){
if (this.scale.min == 0 && this.labels[0] == undefined)
this.labels[0] = {text: "0", type:"slim", side: "right"}
for (var k = this.scale.nice_max; k >= this.scale.nice_min; k=k/10){
this.addScaleLabel(k, "logScale")
labelCount++
}
}else{
for (var z = this.scale.nice_min; z < this.scale.nice_max+1; z=z*10){
for (var z = this.scale.nice_min; z <= this.scale.nice_max; z=z*10){
this.addScaleLabel(z, "logScale")
labelCount++
}
if (this.scale.min == 0 && this.labels[0] == undefined)
this.labels[0] = {text: "0", type:"slim", side: "left"}
}
}
this.scaledMargin = max/labelCount
......@@ -621,14 +625,14 @@ Axis.prototype = {
//return position of a given value
getValuePos: function(v){
//continuous value
if (this.scale && typeof v == "number" && !isNaN(v))
return this.scale.fct(v)
//discret value
if (v in this.labels)
return this.labels[v].position
//continuous value
if (this.scale && typeof v == "number" && !isNaN(v))
return this.scale.fct(v)
return undefined
},
......
......@@ -105,7 +105,23 @@ class TestScatterplot < BrowserTest
end
def test_04_axis_order_in_compare
$b.clone_in_list("0").click
$b.update_icon.wait_while(&:present?)
$b.send_keys 9
$b.update_icon.wait_while(&:present?)
axis_container_Y = $b.element(:id => "visu_axis_y_container")
axis = axis_container_Y.elements(:class => "sp_legend")
assert ( axis.length == 4 ), ">> incorrect number of axis, got (" + axis.length.to_s + "), expected (4)"
assert ( axis[0].text == "0" ), ">> incorrect first legend, got '" + axis[0].text + "', expected '0'"
assert ( axis[1].text == "1" ), ">> incorrect second legend, got '" + axis[1].text + "', expected '1'"
assert ( axis[2].text == "0.1" ), ">> incorrect third legend, got '" + axis[2].text + "', expected '0.1'"
assert ( axis[3].text == "0.01" ), ">> incorrect fourth legend, got '" + axis[3].text + "', expected '0.01'"
end
# Not really a test
def test_zz_close
close_everything
......
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