Multi-dimensional comparator function generator for D3