.groupyby (columnName.value)
groupby value will split the data into bins based on the min and max of the column data. For example, if column data ranged from 1 to 20 and the query requests 4 bins, the bin ranges would be 1-5, 6-10, 11-15, 16-20. This is useful when creating histograms.
Aggregate functions can then be used to calculate interesting data about each bin. For example, how many records are in the 1-5 bin, or what is the max record in the 16-20 bin.
When a bin does not include any records, that bin is not returned from the query. For example, if a query requests 4 bins, but only 3 of those bins contain data, the data response will only have a length of 3. To match bins with the response data, the ".key" aggregate must be used.
When keys are missing it means there was no data in groups 4-8 to return. Groupby value takes the full range min and max and tries to split them evenly according to value.10 or value.100.
.groupby(columnName.value.count: string)
<html> <head> <script type="text/javascript" src="/JS"></script> <script type="text/javascript"> ml.onload(function () { var q = ml.query().from('maplarge/Donors'); q.select('Amount.count','Amount.min','Amount.max', 'Amount.key'); q.groupby('Amount.value.10'); q.orderby('Amount'); q.run(function (data, query) { var dataDiv = document.getElementById("dataDiv"); dataDiv.innerHTML = ml.util.JsonHighlight(data); }); }); </script> </head> <body> <div id="dataDiv"> </div> </body> </html>