0
votes

I run into a problem when I have multiple datasets in crossfilter. I create one crossfilter for each dataset. I want to filter my data in the pie chart when I select the Year dimension in the bubble chart. They are from different datasets, but they all have Year column.

Bubble chart:

var ndx = crossfilter(data);
var yearDimension = ndx.dimension(function (d) { return d.FiscalYear; });
var yearlyPerformanceGroup = yearDimension.group().reduceSum(return d.Value);

Pie chart

var ndxobi = crossfilter(obligation);
var yearDimension = ndxobi.dimension(function (d) { return d.FiscalYear; });
var obligationDimension = ndxobi.dimension(function (d) { return d.Type; });
var valueObligationSumGroup = obligationDimension.group().reduceSum(function (d) { return d.Value; });

Could some one tell me how to select the year in bubble chart and then pass it to the pie chart?

Thank you

1

1 Answers

0
votes

It is going to work better if they use a common crossfilter, but you can probably get something working just by listening to the filtered event on the bubble chart and filtering the pie chart when it fires:

bubbleChart.on('filtered', function(chart) {
    pieChart.filter(null)
        .filter([chart.filters()])
        .redrawGroup();
});

This removes the old filter on the pie chart, applies the new one, and then causes all the charts in the pie chart's crossfilter to redraw.

Docs: