Commit ab41b407 authored by Romain Loth's avatar Romain Loth

fixed centering heatmap colors

(and other rounding issue with samerange)
parent 028ce16c
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
max-height: 30%; max-height: 30%;
padding: 0 5px; padding: 0 5px;
overflow-y:scroll; overflow-y:scroll;
bottom:0; bottom:18px;
left:0; left:0;
border:solid 1px black; border:solid 1px black;
background-color:white; background-color:white;
......
...@@ -97,11 +97,23 @@ function getHeatmapColors(nClasses) { ...@@ -97,11 +97,23 @@ function getHeatmapColors(nClasses) {
} }
// floor // floor
let skipStep = parseInt(listsLen / nHalfToPick) let exactStep = listsLen / nHalfToPick
let skipStep = parseInt(exactStep) // incrmt must be int (used for arr idx)
// cold colors // to compensate for the fractional part
let delta = exactStep - skipStep
let drift = 0
// cold colors, starting from deepest color
for (let i = listsLen-1 ; i > 0 ; i -= skipStep ) { for (let i = listsLen-1 ; i > 0 ; i -= skipStep ) {
outColors.push(TW.gui.heatmapColorListToColdest[i]) outColors.push(TW.gui.heatmapColorListToColdest[i])
// catching back one step from time to time
drift += delta
if (drift >= 1) {
i--
drift -= 1
}
} }
// white // white
......
...@@ -410,9 +410,8 @@ function facetsBinning (valuesIdx) { ...@@ -410,9 +410,8 @@ function facetsBinning (valuesIdx) {
// same interval each time // same interval each time
let step = (vMax - vMin) / nBins let step = (vMax - vMin) / nBins
for (var i = 0 ; i < nBins ; i++) {
for (var k=vMin ; k < vMax ; k += step ){ legendRefTicks.push(vMin + i*step)
legendRefTicks.push(k)
} }
// NB these ticks are *minimums* so we stop one step *before* vMax // NB these ticks are *minimums* so we stop one step *before* vMax
// and simply include it in last interval // and simply include it in last interval
......
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