0
votes

I'm working on a visualization tool for time series with multiple dimensions. To simplify my case, each data-point has a dimension on type, clusterId and a set of months:

    {
    type: "green", 
    clusterId:42, 
    months:[1392185580000, 1394604780000, 1397279580000]
    }, {
    type: "red", 
    clusterId:43, 
    months:[1392185580000]
    }

Now I would like to show the dates in a dc.barChart, which shows the months of all datasets as keys(bars), and the number of observations of each month as value of the bar. In the given case, it would result in 3 bars, the first one with a height of 2, and the other with a height of 1.

How can I create this dimension and implement the grouping/reducing function?

You don't have to worry about filtering by this dimension, I already have a custom filter for this dimension. The only thing is displaying the bars on the barChart.

1
I found the answer for my question hereuser2440437

1 Answers

0
votes

If i get this correctly, you need some code, that outputs: 1392185580000: 2, 1394604780000: 1, 1397279580000:1?

arr.forEach(function(d) {
    d.months.forEach(function(month) {
        if (!store.hasOwnProperty(month)) {
            store[month]=0;
        }
        store[month]++;
    });
});

demo fiddle