1.0.1 • Published 9 years ago

pivot-crossfilter v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

pivot for crossfilter

This is a simple pivot function for crossfilter, written as an ES6 module. The lib folder contains ES5 code generated by Babel for UMD module system.

The function returns the counts for a given row and column; and the product of the row/col.

data = [{ product: "A", store: "B"},
        {product: "B", store: "A"},
	    {product: "C", store: "B"}]

fact = crossfilter(data);
		
pivot( facts, "product", "store")`

This code will yield the result:

{
	"product": {
		"A": 1,
		"B": 1,
		"C": 1
	},
	"store": {
		"A": 1,
		"B": 2
	},
	"product|store": {
		"A|B": 1,
		"B|A": 1,
		"C|B": 1
	}
}`