Exploring the world of crossfilter is a new adventure for me as I am just starting out and have limited experience with handling data.
The data I am working with has a varying structure, as shown below:
const data = [
{_id: 001, a: 10, b: 11, c: 12},
{_id: 002, a: 11, c: 13},
{_id: 003, b: 12, c: 14},
{_id: 004, f: 102 },
{_id: 005, e:100, f:101, g: 102}
];
Not every object in the dataset shares the same set of keys, which is leading to incorrect values being returned when using
dimension.top(), dimension.bottom()
For instance:
const by_a = cf.dimension(function(d){return d.a};
const max_a = by_a.top(1)[0];
// The expected result is max_a = { _id: 002, a: 11, c: 13}
// However, a different object is returned.
const by_f = cf.dimension(function(d){return d.f};
const min_f = by_f.bottom(1)[0];
// The expected result should be min_f = { _id: 004, e:100, f:101, g: 102}
// Yet, a different object is returned once again.
Despite consulting the Crossfilter Gotchas to tackle this issue, I am still unable to decipher if any of those scenarios apply to my case or if a solution exists. I have not found a similar question elsewhere. Seeking assistance to successfully execute basic crossfilter queries. Your help is greatly appreciated. Thank you.