d3.jsdc.jscrossfilter

Original Data Display on chart after filtering (DC.js)


I'm trying to display original data on my DC.js chart (similar to this) once filtered by using a "fake group".

I followed the steps in this post, and haven't had luck. I'm wondering if it's because I'm using reductio?

Also, maybe it's because I'm using key/value accessor functions??:

.keyAccessor((d) => {
    return d.key;
})
.valueAccessor((d) => {
    return d.value.avg;
}),

Here's the stackblitz minimal implementation, interested to hear any insight!


Solution

  • It was in fact a reductio "problem" as it creates a more complicated group object

    e.g.

    key: foo
    value: {
      avg: bar,
      sum: baz,
      etc.
    }
    

    so the "deep copy" from the linked post

      function static_copy_group(group) {
          var all = group.all().map(kv => ({key: kv.key, value: kv.value}));
          return {
              all: function() {
                  return all;
              }
          }
      }
    

    is in fact still referencing. Fixed by using the clone library instead