Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using crossfilter, is it possible to destroy / remove it once its be instantiated?

Im referring square crossfilter plugin for javascript

https://github.com/square/crossfilter

In my app, users are be able to select specific date ranges and each time the date is changed, an ajax request creates a json object which is fed into crossfilter.

I want to be able to remove the existing crossfilter (objects on screen as well as events) and start a new with the newly created json object.

like image 769
wootwoot Avatar asked Dec 01 '25 14:12

wootwoot


2 Answers

According to the documentation, you should be able to undo a filter either by applying

.filter(null)

or

.filterAll()

to your object.

However, I have found this does not necessarily work, so perhaps the better thing to do would be to apply a fresh filter to a new crossfilter object.

If you can provide some code for better context that would be helpful.

like image 134
alphaG77 Avatar answered Dec 04 '25 06:12

alphaG77


You need to reset the filters on all dimensions derived from the crossfilter to reset it. For example, if you have applied the following filters

payments_by_quantity.filter([1, Infinity]);
payments_by_total.filter(90);
payments_by_tip.filter(0);
payments_by_type.filter("tab");

you need to reset each single one to return to the original state:

payments_by_quantity.filter(null);
payments_by_total.filter(null);
payments_by_tip.filter(null);
payments_by_type.filter(null);

This makes sense, as it allows you to selectively activate/deactivate filters on the dimensions you have defined.

like image 33
atomictag Avatar answered Dec 04 '25 07:12

atomictag



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!