javascript - Crossfilter can't filter one dimension by another -
I am trying to filter two dimensions in Crossfilter. I have an array which repeats a given object:
{ "bioguide_id": "O000167", "Prtham_nam": "Barack", "Last_Name": "Obama", " party ":" Democrat "," religion ":" United church of Christ "," Pisi_aidi ":" C -00404145 "," Pisi_nam ":" Mandokino county Democratic Central Committee "," Yogdan_kount ": 4," Yogdan_syuem " 1264, "Congress": 110}
I have the following query of a crossfilter working perfectly:
var yoga Dan = Data Dream (function (c) {return c. Contribution_user;}); Contribution (3) .for (function (p, i) {console.log (p.pac_name + "(" + p.congress + ")" + ": $" + p.contribution_sum);});
However, how can I get from Y Congress
to top X contribution_sum
? You have not taken any advantage:
var congress = data.dimension (function (c) {return c.congress;}); Congress.filter (111) Group () Order (function (c) {return c.contribution_sum;}) Top (3) .for Ika (function (P, I) {console.log (p.pac_name + "(" + P.congress + ")" + ": $" + p.contribution_sum);});
Any thoughts on why?
I believe that you want to filter your 'Congress' dimension and then Ask for top members like your 'contribution_asam' dimension:
var congress = data.dimension (function (c) {return + c.congress;}); Var Contribution = Data Dream (function (c) {return + c.contribution_sum;}); Congress.filter (111); Contribution (3) .for (function (p, i) {console.log (p.pac_name + "(" + p.congress + ")" + ": $" + p.contribution_sum);});
Full JSFiddle:
Comments
Post a Comment