Crossfilter.js 按多个分类轴分组

Crossfilter.js group by multiple categorical axis

我遇到以下问题: 我的数据集如下所示:

[{
"id": 1542284,
"date": "2013-04-22",
"kilometer": 111179.364089776,
"country": "RU",
"ps": 100,
"model": "110A"
},
{
"id": 1542285,
"date": "2013-08-30",
"kilometer": 211963.649155722,
"country": "FR",
"ps": 110
"model": "110A"
},
{
"id": 1542286,
"date": "2013-03-07",
"kilometer": 163694.246231156,
"country": "DE",
"ps": 120
"model": "210B"}]

现在我想使用 dc.js 和 crossfilter.js 来制作一个热图 x 轴:国家和 y 轴:模型。 颜色属性将对应于组中的项目数:|(国家 x 型号)|

我现在的问题是如何用两个分类轴制作 crossfilter.js 组语句?!

var ndx = crossfilter(data);
var countryDimension = ndx.dimension(function (d){
    return d.country;
});

modelByCountryGroup = countryDimension.group().reduce(
    /* callback for when data is added to the current filter results */
    function (p, v) {
        ++p.count;
        //HOW DO I STORE/PROCESS v.model HERE
        return p;
    },
    /* callback for when data is removed from the current filter results */
    function (p, v) {
        --p.count;
        //HOW DO I STORE/PROCESS v.model HERE
        return p;
    },
    /* initialize p */
    function () {
        return {count: 0, WHATDOINEEDHERE};
    }
);

你能创建一个组合维度吗?

var dim = ndx.dimension(function(d) { return d.country + ":" + d.model; });
var group = dim.group();

这将为您提供按国家/地区 x 型号的计数,对吗?