am new to dc.js and if any one can help would be really appreciated. I have the following data:
Store year earnings
A 2011 1000
A 2012 2000
A 2013 2000
A 2014 3000
B 2012 200
B 2012 300
B 2012 500
B 2014 3000
B 2015 4000
C 2013 2000
C 2013 200
C 2015 1200
C 2016 4000
What i would like to do is to use dc.js to get cumulative sum per store per year and display it in a series chart. the cumulative sum per store per year would be
Store year earnings
A 2011 1000
A 2012 3000
A 2013 5000
A 2014 8000
B 2012 1000
B 2014 4000
B 2015 8000
C 2013 2200
C 2015 3400
C 2016 7400
I have searched around and saw that this can be done for one dimention using functions like
function createCumulativeGroup(source_group) {
return {
all:function () {
var cumulate = 0;
return source_group.all().map(function(d) {
cumulate += d.value;
return {key:d.key, value:cumulate};
});
}
};
}
But the above doesn't work , can you give me a hint?
check also the jsfiddle: https://jsfiddle.net/thyfoubq/10/
--
You received this message because you are subscribed to the Google Groups "dc-js user group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dc-js-user-gro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dc-js-user-group/c688d8a9-bcc8-4c5d-b4ca-67ccca843d9e%40googlegroups.com.