@data-ui/histogram
Version:
React + d3 library for creating histograms
13 lines (12 loc) • 412 B
JavaScript
/* eslint no-magic-numbers: 0 */
/*
* Returns an Epanechnikov (parabolic) kernel function which takes a
* free smoothing parameter as input.
* code from https://gist.github.com/mbostock/4341954
* kernel info https://en.wikipedia.org/wiki/Kernel_(statistics)
*/
export default function kernelGaussian() {
return function (val) {
return 1 / Math.sqrt(2 * Math.PI) * Math.exp(-0.5 * (val * val));
};
}