export function binPerName(data, name) { const nameIds = nameId(data, name); const histogram = d3.layout.histogram() .bins(nameIds.range()) .value(d => nameIds(name(d))); return histogram(data); }
d3.layout.stack() .offset("silhouette") .values(function(d) { return d.values; }) .x(function(d) { return d.date; }) .y(function(d) { return d.value; })
constructor(props) { super(props); const { width, height, } = props; this.force = d3.layout.force() .charge(-300) .linkDistance(50) .size([width, height]); }
d3.layout.tree() .size([360, diameter / 2 - 120]) .separation(function(a, b) { return (a.parent == b.parent ? 1 : 2) / a.depth; })
getInitialState() { var nodes = d3.range(n).map(() => { return { radius: Math.random() * 12 + 4, x: Math.random() * width, y: Math.random() * height, }; }); var force = d3.layout.force() .gravity(normal ? 0.05 : 0.01) .friction(normal ? 0.9 : 0.6) .charge((d, i) => i ? 0 : -2000) .nodes(nodes) .size([width, height]); var root = nodes[0]; root.radius = 10; root.fixed = true; return {nodes, force, root}; }
createForceElements() { const that = this; if (this.force === undefined) { this.force = d3.layout.force();