nl_tokens: data within extents
pl_tokens: function selected ( ) { var actives = d3 . keys ( __ . dimensions ) . <mask> ( is_brushed ) , extents = actives . map ( function ( p ) { return brushes [ p ] . extent ( ) ; } ) ; // We don't want to return the full data set when there are no axes brushed. // Actually, when there are no axes brushed, by definition, no items are // selected. So, let's avoid the filtering and just return false. //if (actives.length === 0) return false; // Resolves broken examples for now. They expect to get the full dataset back from empty brushes if ( actives . length === 0 ) return __ . data ; // test if within range var within = { "date" : function ( d , p , dimension ) { if ( typeof __ . dimensions [ p ] . yscale . rangePoints === "function" ) { // if it is ordinal return extents [ dimension ] [ 0 ] <= __ . dimensions [ p ] . yscale ( d [ p ] ) && __ . dimensions [ p ] . yscale ( d [ p ] ) <= extents [ dimension ] [ 1 ] } else { return extents [ dimension ] [ 0 ] <= d [ p ] && d [ p ] <= extents [ dimension ] [ 1 ] } } , "number" : function ( d , p , dimension ) { if ( typeof __ . dimensions [ p ] . yscale . rangePoints === "function" ) { // if it is ordinal return extents [ dimension ] [ 0 ] <= __ . dimensions [ p ] . yscale ( d [ p ] ) && __ . dimensions [ p ] . yscale ( d [ p ] ) <= extents [ dimension ] [ 1 ] } else { return extents [ dimension ] [ 0 ] <= d [ p ] && d [ p ] <= extents [ dimension ] [ 1 ] } } , "string" : function ( d , p , dimension ) { return extents [ dimension ] [ 0 ] <= __ . dimensions [ p ] . yscale ( d [ p ] ) && __ . dimensions [ p ] . yscale ( d [ p ] ) <= extents [ dimension ] [ 1 ] } } ; return __ . data . filter ( function ( d ) { switch ( brush . predicate ) { case "AND" : return actives . every ( function ( p , dimension ) { return within [ __ . dimensions [ p ] . type ] ( d , p , dimension ) ; } ) ; case "OR" : return actives . some ( function ( p , dimension ) { return within [ __ . dimensions [ p ] . type ] ( d , p , dimension ) ; } ) ; default : throw new Error ( "Unknown brush predicate " + __ . brushPredicate ) ; } } ) ; }