I use d3's scaleLinear. I want to filter values that are outside of the scale's domain.
var arr = [0, 1, 15, 60, 700];
var scaleX = d3.scaleLinear()
.domain([10, 100])
.range([0, 200]);
// I need something like this:
scaleX.filter(arr) // I want to get: [1, 15, 60]
My best solution is foreach all the values and check that the domain's min/max is less/greater than the given value. Like this.
Is there any more compact solution?