UNPKG

d2b

Version:

A d3-based reusable chart library.

13 lines (8 loc) 277 B
import { mean, extent } from 'd3-array'; import functor from '../util/functor'; function midpoint(arr, value) { value = functor(value || function(d){return d;}); if(arr.length) return mean(extent(arr, value)); } midpoint.tendancy = 'midpoint'; export default midpoint;