javascript - Crossfilter filtering and displaying on array properties -


i have array of data objects this:

{   index: "m1",   first: "first",   last: "last",   distance: 5,   specialties: ["pediatrics", "internal"],   languages: ["english", "french"] } 

in addition filtering distance:

var cf = crossfilter(physicians); var bydistance = cf.dimension(function (d) {     return d.distance; }); 

i'd filter specialty. i've looked @ this question, gives me structure count of each specialty entire dataset.

ideally i'd display matching specialties based on distance filter, , use specialties further filter results.

is possible given structure of objects? there easier way represent data lend better filtering?

thanks. fiddle here: http://jsfiddle.net/colin_young/xrqjx/35/

support custom filter functions has been added in crossfilter-1.2.0. should able do:

var specialties = cf.dimension(function(d) {     return d.specialties; });  specialties.filterfunction(function(d) {     return d.indexof("specialty") >= 0; }); 

alternatively, can make dimension each possible specialty:

var pediatrics = cf.dimension(function(d) {     return d.specialties.indexof("pediatrics") >= 0; });  var internal = cf.dimension(function(d) {     return d.specialties.indexof("internal") >= 0; }); 

and run filters on (but supports , conditions).


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -