0

I want to create a numberdisplay chart for my dashboard.The problem is : I can't display the value. It displays 'NAN'

var byWomen = cf.dimension(function (d) { return d.Women; });
var byWomenGroup = byWomen.groupAll().reduceSum(function (d) { return d.Women; })

dc.numberDisplay("#totalwom")
                    .valueAccessor(function (d) { return +d })
                    .group(byWomenGroup)
                    .formatNumber(d3.format(".g"));
Fuzzzzel
  • 1,733
  • 3
  • 23
  • 37
BARIK FATI
  • 29
  • 9
  • you've got return d.Women in the dimension and then in the group as well, on reduceSum? Is that right? Or should it be reduceCount? – Kevin Jun 14 '17 at 14:10
  • Yes, I want to display the total of women so I use reduceSum for the group byWomenGroup and byWomen dimension. The reduceCount works with this code but I want to Sum the values. – BARIK FATI Jun 14 '17 at 15:00
  • Try changing your group to: cf.groupAll().reduceSum(function (d) { return d.Women; }) – Kevin Jun 14 '17 at 19:08
  • 1
    Maybe `.Women` is arriving as a string and you need to convert it to a number in `reduceSum`. I agree with @Kevin that using `.Women` as the key and also the reduction is highly unusual. Posting a sample of your data could help. – Gordon Jun 16 '17 at 14:49

0 Answers0