javascript - Initial Range selection in DC.js chart -


i make initial range selection in dc.js charts (bar , line).
add example:

.filter([7,10]) 

and range appears on chart, apparently 0 observations selected.
expected few thousands observations selected. when select range [7,10] manually brush.

any hint on i'm missing here?

part of code:

    var chart_globalscore = dc.barchart('#chart_globalscore'); (...)     var ndx = crossfilter(data_movies)         ,all = ndx.groupall() (...)         ,globalscoredimension = ndx.dimension(function(d) { if ( !isnan(d.globalscore) ) {return math.round(d.globalscore*10)/10 ;} else {return -1;} })         ,globalscoregroup = globalscoredimension.group() (...)         ; (...)     chart_globalscore         .width(width001)         .height(height001)         .margins(margins)         .dimension(globalscoredimension)         .group(globalscoregroup)         .round(function(val){return math.round(val*10)/10;})         .x(d3.scale.linear().domain([0, 10.1]))         .filter([7,10])         .centerbar(false)         .transitionduration(transitionduration)         .elasticy(true)         .gap(1)         .xunits(function(){return 100;})         .renderhorizontalgridlines(true)         .yaxis().ticks(2)         ; 

the filter code bit tricky in dc.js. if specify array of values, not interpret array range. (it either interpret array single value, or if array contains array, it filter on values inside array.)

try specifying ranged filter object instead:

    .filter(dc.filters.rangedfilter(7, 10)) 

Comments