Question

I have a lineChart with a somewhat complicated .valueAccessor function. I also have a barChart on the same dimension and group.

There are several other charts on the webpage but on other dimensions and groups.

When I filter using one of the other charts, the barChart updates correctly but not the lineChart. Could there be something explaining that behaviour ?

I would like to get feedback before setting up a jsFiddle as my data is quite heavy.

EDIT : here is the fiddle. It pulls 7MB of data in an ajax call so it takes a while to run. The answer provided by @DJMartin below should be the fix for me but it doesn't work.

Was it helpful?

Solution

From the crossfilter API reference: https://github.com/square/crossfilter/wiki/API-Reference

"Note: a grouping intersects the crossfilter's current filters, except for the associated dimension's filter. Thus, group methods consider only records that satisfy every filter except this dimension's filter. So, if the crossfilter of payments is filtered by type and total, then groupAll by total only observes the filter by type."

If you create a second dimension using the same property, the filtering will reflect across charts.

Here is an example of that: http://jsfiddle.net/djmartin_umich/nw8EV/.

teamMemberChart
        .width(270)
        .height(220)
        .dimension(teamMemberDimension)
        .group(teamMemberGroup)
        .valueAccessor(function (d) {
        return d.value.projectCount;
    })
        .elasticX(true);

    teamMemberChart2
        .width(270)
        .height(220)
        .dimension(teamMemberDimension)
        .group(teamMemberGroup)
        .valueAccessor(function (d) {
        return d.value.projectCount;
    })
        .elasticX(true);

    teamMemberChart3
        .width(270)
        .height(220)
        .dimension(teamMemberDimension2)
        .group(teamMemberGroup2)
        .valueAccessor(function (d) {
        return d.value.projectCount;
    })
        .elasticX(true);

The first two charts use the same dimension - picking one option does not reflect the other. The third chart uses a different dimension on the same property - choosing an option on this chart updates the other two charts.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top