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 @@
max-height: 30%;
padding: 0 5px;
overflow-y:scroll;
bottom:0;
bottom:18px;
left:0;
border:solid 1px black;
background-color:white;
......
......@@ -97,11 +97,23 @@ function getHeatmapColors(nClasses) {
}
// 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 ) {
outColors.push(TW.gui.heatmapColorListToColdest[i])
// catching back one step from time to time
drift += delta
if (drift >= 1) {
i--
drift -= 1
}
}
// white
......
......@@ -410,9 +410,8 @@ function facetsBinning (valuesIdx) {
// same interval each time
let step = (vMax - vMin) / nBins
for (var k=vMin ; k < vMax ; k += step ){
legendRefTicks.push(k)
for (var i = 0 ; i < nBins ; i++) {
legendRefTicks.push(vMin + i*step)
}
// NB these ticks are *minimums* so we stop one step *before* vMax
// 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