Use dc.js seriesChart .seriesAccessor() to pick specific (not all) series -
i trying show detailed data 6 series. example http://dc-js.github.io/dc.js/examples/scatter-series.html need need small tweak. show 3 charts 2 items each.
can use single rungroup example somehow limit chart.seriesaccessor() display 2 specific series in 1 chart. use same rungroup in second chart , change .seriesaccessor() use 2 different series, etc., etc.
setting multiple separate dims , groups works fine seems overkill when have single crossfiltered dataset in not use single dimension , group drive different charts.
(the dataset has 40 series in need display specific ones, grouped in several charts).
this tufte calls "small multiple". i'm not sure adding dimensions , groups, because don't want charts affected each others' choose-series filters.
and seriesaccessor
function extracts subkey, doesn't have way filter.
looks yet case "fake groups". modifying scatter-series example:
function filter_keys(source_group, f) { return { all:function () { return source_group.all().filter(function(d) { return f(d.key); }); } }; } // in particular, take experiments 1 , 2 scatter-series.html: var frungroup = filter_keys(rungroup, function(k) { return k[0] < 3; // k[0] same part used seriesaccessor }); chart.group(frungroup)
you define 1 of these filtered groups each chart in multiple (or define them in loop). has minor cost of doing 1 filter on group each chart, whenever crossfilter changes, should negligible.
it nice generalize serieschart deal sort of thing, same calculation/post-filtering, tend argue need better data manipulation/filtering tools in between crossfilter , dc.js, not more features built-in.
Comments
Post a Comment