Commit 13d0e1b3 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

js/scatterPlot.js: light refactor following previous commit

parent baaabcfa
...@@ -722,13 +722,10 @@ ScatterPlot.prototype = { ...@@ -722,13 +722,10 @@ ScatterPlot.prototype = {
var clone = this.barTab[i][j] var clone = this.barTab[i][j]
var cloneID = clone.index; var cloneID = clone.index;
if (this.includeBar(clone)){ if (this.includeBar(clone)){
height = 0;
height = clone.getSize()/bar_max; height = clone.getSize()/bar_max;
// Minimal height (does not affect y_pos) // Minimal height (does not affect y_pos)
// A clone without reads is not displayed var height_for_display = this.heightClone(height)
// A clone with a small number of reads is displayed and has a minimal height
var height_for_display = height === 0 ? 0 : Math.max(height, 0.01)
var y_pos_for_display = y_pos + height_for_display ; var y_pos_for_display = y_pos + height_for_display ;
y_pos += height; y_pos += height;
...@@ -1222,15 +1219,22 @@ ScatterPlot.prototype = { ...@@ -1222,15 +1219,22 @@ ScatterPlot.prototype = {
}, },
/** /**
* return the actual radius of the clone * return the actual radius (for MODE_GRID) or height (for MODE_BAR) of the clone
* @param {float} size - clone ratio size, between 0.0 and 1.0 * A clone without reads is not displayed
* A clone with a small number of reads is displayed and has a minimal size
* @param {float} size/height - clone ratio size, between 0.0 and 1.0
* @return {float} size - clone display size
* */ * */
radiusClone: function(size) { radiusClone: function(size) {
if (size === 0) if (size === 0)
return 0 ; return 0 ;
//Math.pow(x,y) -> x**y
return this.resizeCoef * Math.pow((size + this.resizeMinSize), (1 / 3)) / 25 return this.resizeCoef * Math.pow((size + this.resizeMinSize), (1 / 3)) / 25
}, },
heightClone: function(height) {
if (height === 0)
return 0 ;
return Math.max(height, 0.01)
},
/** /**
......
Supports Markdown
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