在交叉过滤器中筛选多个离散值 [英] Filter for multiple discrete values in crossfilter
本文介绍了在交叉过滤器中筛选多个离散值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有人可以在多个值上筛选 crossfilter 物件维度?像
.filterExact([cash,visa])
或
.filter ,visa])
...但不是范围形式...
或
.filterAll([cash,visa] )
...但没有清算部分。
或不使用
的等效解决方法/方法 .filterRange([cash,visa])
in the API?
谢谢!
Larry
解决方案
我面临着类似的问题。我解决的方式是,我写了一个过滤器函数,将检查维度是否在一个特定的数组或
//要过滤的事物数组
var f = [cash,visa];
//假设dim是我们的维度
dim.filter(function(d){
return f.indexOf(d)> -1;
}
这将检查值是否在该数组中并相应地过滤。
希望这有助于。
Does anyone have an approach to filtering a crossfilter object dimension on multiple values? Something like
.filterExact(["cash","visa"])
or
.filter(["cash","visa"])
...but not the range form of it...
or
.filterAll(["cash","visa"])
...but without the clearing part.
or an equivalent workaround/approach not using
.filterRange(["cash","visa"])
??
Or am I missing something in the API?
Thanks!
Larry
解决方案
I was facing a similar problem. The way I solved it was that I wrote a filter function that would check whether the dimension lies in a particular array or not.
// Array of things you want to filter
var f = ["cash", "visa"];
// Assuming "dim" is our dimension
dim.filter(function(d){
return f.indexOf(d) > -1;
});
This will check if the value lies in that array and filter accordingly.
Hope this helps.
这篇关于在交叉过滤器中筛选多个离散值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文