从交叉过滤器中删除数据点时,我遇到性能问题。每次我都必须执行以下操作:
dimension.filter(tmpReportId);
var tmpReport = dimension.top(1)[0]; //Because after removal I have to modify the "report" (the data point) and add it back to the crossfilter
reportsVis.getCrossfilter().remove();
dimension.filter(null);
问题是,filter()在整个交叉过滤器上应用了两次,这使得在大型数据集上的操作非常昂贵
最佳答案
filter(null)
不是一个昂贵的操作,因为它只清除过滤器,不执行过滤器。 source probably makes things clear :
function crossfilter_filterAll(values) {
return [0, values.length];
}
filter(null)
和 filterAll()
是相同的操作,如您所见,它只是返回维度中的每个值。
关于javascript - 如何通过 ID 有效地从交叉过滤器中删除/修改数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28878838/