INNER CODE UNIT · JavaScript
power
oncologylab/fp-tools · src/fp_tools/resources/static_browser/app.js:83
power = 10 ** Math.floor(Math.log10(number)),
scaled = number / power;
return (scaled <= 1 ? 1 : scaled <= 2 ? 2 : scaled <= 5 ? 5 : 10) * power;
}
function niceTicks(min, max, count = 5) {
if (!Number.isFinite(min) || !Number.isFinite(max) || min === max)
return [min || 0];
const step = niceStep(max - min, count - 1),
start = Math.ceil(min / step) * step,
end = Math.floor(max / step) * step,
out = [];
for (let value = start; value <= end + step * 0.25; value += step)
out.push(Math.abs(value) < step / 1e6 ? 0 : value);
return out.length ? out : [min, max];
}
function colorFor(motif) {
if (!motif.significant) return state.colors.neutral;
return motif.effect >= 0 ? state.colors.first : state.colors.second;