mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-27 12:08:11 +08:00
Specify histogram thresholds in fixed-length array (#1086)
* Specify histogram thresholds in fixed-length array Fixes https://github.com/chanzuckerberg/cellxgene/issues/1082 For background, see the following: * https://github.com/d3/d3-array/issues/46 * https://stackoverflow.com/questions/15880058/d3-js-ticks-function-giving-more-elements-than-needed * Oops, off by one!
This commit is contained in:
@@ -43,3 +43,8 @@ export function range(start, stop, step) {
|
||||
const len = Math.max(Math.ceil((stop - start) / step), 0);
|
||||
return _doFill(new Array(len), start, step, len);
|
||||
}
|
||||
|
||||
export function linspace(start, stop, nsteps) {
|
||||
const delta = (stop - start) / (nsteps - 1).toFixed();
|
||||
return range(0, nsteps, 1).map(i => start + i * delta);
|
||||
}
|
||||
Reference in New Issue
Block a user