I am trying to create a bar chart (cross filter and dc js) to show how many people (unique) participated in an event
[
{"Year: 2015" , "Name:Person1"},
{"Year: 2015" , "Name:Person2"},
{"Year: 2015" , "Name:Person3"},
{"Year: 2015" , "Name:Person1"},
{"Year: 2015" , "Name:Person1"},
{"Year: 2016" , "Name:Person4"},
{"Year: 2016" , "Name:Person4"},
{"Year: 2016" , "Name:Person1"},
]
I am plotting Year on X axis and Count on Y axis. Right now with Reduce count on Year I get
Year: 2015 Count:3 -> person 1,2,3
Year: 2016 Count:2 -> person 1,4
Sample code
yeardimension.group().reduceCount(function(d) { return d.year })
I want to get unique value and expected value
Year: 2015 Count:5
Year: 2016 Count:3
How can I achieve this in cross filter and dc js?
reduceCount
(which doesn't take a parameter btw) returns 5 and 3, no? – Gordon