Namespace: flat_group

dc_graph. flat_group

dc_graph.flat_group implements a "fake crossfilter group" for the case of a group which is 1:1 with the rows of the data array.

Although dc_graph can be used with aggregated or reduced data, typically the nodes and edges are rows of two data arrays, and each row has a column which contains the unique identifier for the node or edge.

Source:

Methods


<static> another(ndx, id_accessor)

Create a flat dimension and group from an existing crossfilter.

Parameters:
Name Type Description
ndx Object

crossfilter instance

id_accessor function

accessor function taking a row object and returning its unique identifier

Deprecated:
  • use .make() instead
Source:
Returns:

{crossfilter, dimension, group}

Type
Object

<static> make(source, id_accessor)

Create a crossfilter, dimension, and flat group. Returns an object containing all three.

  1. If source is an array, create a crossfilter from it. Otherwise assume it is a crossfilter instance.
  2. Create a dimension on the crossfilter keyed by id_accessor
  3. Create a group from the dimension, reducing to the row when it's filtered in, or null when it's out.
  4. Wrap the group in a fake group which filters out the nulls.

The resulting fake group's .all() method returns an array of the currently filtered-in {key, value} pairs where the key is id_accessor(row) and the value is the row.

Parameters:
Name Type Description
source Array

the data array for crossfilter, or a crossfilter

id_accessor function

accessor function taking a row object and returning its unique identifier

Source:
Returns:

{crossfilter, dimension, group}

Type
Object