Grouping an array using lodash _.groupBy.
Creates an object composed of keys generated from the results of running each element of collection through iteratee. The corresponding value of each key is an array of the elements responsible for generating the key. The iteratee is bound to thisArg and invoked with three arguments: (value, index|key, collection).
xxxxxxxxxx
<html lang="en">
<head>
<meta charset="utf-8">
<title>d3 | keypress keyboard events</title>
<meta name="author" content="Sundar Singh | eesur.com">
<link rel="stylesheet" href="main.css">
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.4.6/mousetrap.js" charset="utf-8"></script>
</head>
<header>
<p>using lodash _.groupBy to group an array of float numbers: </p>
</header>
<section id='vis'></section>
<footer>
<p>Original data array: [ <span id="original-array"></span> ]</p>
</footer>
<script src="d3_code_lodash_groupby.js" charset="utf-8"></script>
</body>
</html>
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js
https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js
https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.4.6/mousetrap.js