javascript - Sum by category in Piechart (Dc.js & Crossfilter) -


i try use dc.js , crossfilter have problem adding values having same category.

i explain : have demo 3 columns (project, amount, action). create amount categories code:

   var amount = d.amount;         if (amount<=10) {             return '< 10';         } else if (amount >10 && amount < 50) {             return '<50';         } else if (amount >= 50 && amount <= 80) {             return '< 80';         } else {             return '> 80';         } 

all want : if it's same project, add amount , create these categories.

so in < 10 category there redaction. in >10 , <50 category there'll design , website hosting... , if >50 there'll website design.

here jsfiddle : http://jsfiddle.net/nicart/179n4bfg/6/

thank help, i'm totally lost.

so want dynamically calculate category? example, if "design" project had "stuff" action value of 5, , filter applied show "stuff", "design" fall "<10" category? or want each project categorized according it's overall value no matter filters applied?

if former, you're going have create group wrapper create "fake" group , re-aggregate standard group on project dimension categorical values @ run-time. see here, talks creating "fake group": https://github.com/dc-js/dc.js/wiki/faq

if latter, should pre-calculation step , add category dimension underlying data each record.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -