How to use the simple-statistics/src/extent function in simple-statistics

To help you get started, weâ€™ve selected a few simple-statistics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

jacomyal / sigma.js / examples / animations.js View on Github
``````import {UndirectedGraph} from 'graphology';
import WebGLRenderer from '../src/renderers/webgl';
import circularLayout from 'graphology-layout/circular';
import {animateNodes} from '../src/animate.js';
import {scaleLinear} from 'd3-scale';
import extent from 'simple-statistics/src/extent';
import miserables from './resources/les-miserables.json';

const nodeSizeExtent = extent(miserables.nodes.map(n => n.size));
const xExtent = extent(miserables.nodes.map(n => n.x));
const yExtent = extent(miserables.nodes.map(n => n.y));

const nodeSizeScale = scaleLinear()
.domain(nodeSizeExtent)
.range([3, 15]);

const xScale = scaleLinear()
.domain(xExtent)
.range([0, 1]);

const yScale = scaleLinear()
.domain(yExtent)
.range([0, 1]);

const graph = new UndirectedGraph();``````
jacomyal / sigma.js / examples / animations.js View on Github
``````import {UndirectedGraph} from 'graphology';
import WebGLRenderer from '../src/renderers/webgl';
import circularLayout from 'graphology-layout/circular';
import {animateNodes} from '../src/animate.js';
import {scaleLinear} from 'd3-scale';
import extent from 'simple-statistics/src/extent';
import miserables from './resources/les-miserables.json';

const nodeSizeExtent = extent(miserables.nodes.map(n => n.size));
const xExtent = extent(miserables.nodes.map(n => n.x));
const yExtent = extent(miserables.nodes.map(n => n.y));

const nodeSizeScale = scaleLinear()
.domain(nodeSizeExtent)
.range([3, 15]);

const xScale = scaleLinear()
.domain(xExtent)
.range([0, 1]);

const yScale = scaleLinear()
.domain(yExtent)
.range([0, 1]);

const graph = new UndirectedGraph();

miserables.nodes.forEach((node, i) => {``````
jacomyal / sigma.js / examples / animations.js View on Github
``````import {UndirectedGraph} from 'graphology';
import WebGLRenderer from '../src/renderers/webgl';
import circularLayout from 'graphology-layout/circular';
import {animateNodes} from '../src/animate.js';
import {scaleLinear} from 'd3-scale';
import extent from 'simple-statistics/src/extent';
import miserables from './resources/les-miserables.json';

const nodeSizeExtent = extent(miserables.nodes.map(n => n.size));
const xExtent = extent(miserables.nodes.map(n => n.x));
const yExtent = extent(miserables.nodes.map(n => n.y));

const nodeSizeScale = scaleLinear()
.domain(nodeSizeExtent)
.range([3, 15]);

const xScale = scaleLinear()
.domain(xExtent)
.range([0, 1]);

const yScale = scaleLinear()
.domain(yExtent)
.range([0, 1]);

const graph = new UndirectedGraph();``````

simple-statistics

Simple Statistics

ISC