simple-linear-scale

barebones linear scale

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
simple-linear-scale
1801.0.17 years ago7 years agoMinified + gzip package size for simple-linear-scale in KB

Readme

linearScale

build status
Bare-bones equivalent for the functionality of d3.scale.linear

Parameters

  • domain Array<number>
  • range Array<number>

Examples

var linearScale = require('simple-linear-scale');

var scaleFunction = linearScale([0, 1], [0, 100]);
scaleFunction(0.5); // 50

// clamp option ensures that output is within range
var scaleFunction = linearScale([0, 1], [0, 10], true);
scaleFunction(100); // 10

Returns Function scale function