Crossfilter going forward

Issue #842 resolved
Ghislain Hachey created an issue

According to https://square.github.io/crossfilter/ crossfilter is no longer actively maintained. The actively maintained one can be found at https://square.github.io/crossfilter/. Do we need to plan a move to crossfilter2?

Comments (4)

  1. Brian Lewis repo owner

    Biting the bullet to move to crossfilter2.

    In particular, there are a couple of potentially useful new APIs introduced in 1.4 - e.g.

    crossfilter.allFiltered() returns an array of the input records filtered according to all filters on the crosstab.

    This is potentially a more clean way to do e.g. this:

                this.toiletData = _(this.tables[2])
                    .filter(({ SurveyYear, DistrictCode, AuthorityCode, AuthorityGovtCode, SchoolTypeCode }) => {
                        return (SurveyYear == this.options.selectedYear)
                            && ((!this.options.selectedDistrict) || (DistrictCode == this.options.selectedDistrict))
                            && ((!this.options.selectedAuthority) || (AuthorityCode == this.options.selectedAuthority))
                            && ((!this.options.selectedAuthorityGovt) || (AuthorityGovtCode == this.options.selectedAuthorityGovt))
                            && ((!this.options.selectedSchoolType) || (SchoolTypeCode == this.options.selectedSchoolType))
                    })
                    .value();
    

    which becomes something like…

    let xf = crossfilter(toilets);
    //.... create dimensions on the crossfilter
    //.... apply filters on thse dimensions
    this.toiletData = xf.allFiltered();
    

  2. Brian Lewis repo owner

    2 major hangups implementing crossfilter2:

    1. it breaks the bundling and minification unless it is the last file in the bundle (took ages to figure out this workaround 😞 )
    2. Supplied index.d.ts as part of the distribution rather than in npm @types; but could not make this one work and ended up patching the old one to include the new interfaces.

  3. Log in to comment