I'm trying to add a dc-count-widget but I need to get around the default dimension/ group being all data/groupAll. My data looks like this:
`[{"subjId":"subj1", "temp":"37"},
{"subjId":"subj1", "temp":"38"},
{"subjId":"subj2", "temp":"36.5"},
{"subjId":"subj2", "temp":"37.3"},
{"subjId":"subj3", "temp":"39"}
]`
I want to add a dimension on temp "temperature" and a dc-count to reflect the count of unique subjects when I filter on ranges in temp.
EDIT I tried:
subjectColumnName = 'subjId'
subjectDim = cfData.dimension(function(d) {return d[subjectColumnName]})
chart.dimension(subjectDim.group())
chart.group(subjectDim.groupAll())
but when filtering I get the duplicates count not unique counts of subjects.
Thanks
Thanks @Gordon The solution in dataCount graph filtered by a dimension would work, but the widget would not update if other charts are filtered so I had to create a custom group function to only count unique subjects.
I am not sure yet if the reduceRemoveSubj function is correct. And it looks like it's a very detoured solution!
Here it is: