mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
24 lines
473 B
TypeScript
24 lines
473 B
TypeScript
// Inspired by http://bl.ocks.org/mbostock/4061502
|
|
|
|
function iqr(k: number) {
|
|
return function(d: any) {
|
|
var q1 = d.quartiles[0],
|
|
q3 = d.quartiles[2],
|
|
iqr = (q3 - q1) * k;
|
|
let i = -1,
|
|
j = d.length;
|
|
while (d[++i] < q1 - iqr);
|
|
while (d[--j] > q3 + iqr);
|
|
return [i, j];
|
|
};
|
|
}
|
|
|
|
var chart = d3.box()
|
|
.whiskers(iqr(1.5))
|
|
.width(100)
|
|
.height(100);
|
|
|
|
chart.domain([1, 30]);
|
|
|
|
d3.selectAll("sth.").call(chart.duration(1000));
|