-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect filtering when using a Dimension that returns a Date from the accessor #497
Comments
So a fix for this, update the filter handler to use a valueOf comparison (like the one used in Crossfilter's quicksort) From Crossfilter.js: An updated Fiddle showing off the fix: The changed baseMixin _filterHandler:
A diff patch:
|
Also to add, and this was out of curiosity from Crossfilter's code, using:
is 98% faster in Firefox and 88% faster in Chrome than using:
Based on this jsperf: |
Fixed via #555 - thanks @mtraynham! |
There is some weirdness when using a Crossfilter dimension that has an accessor function that returns a Date object. It seems to work fine when using Bar Charts with brushing and range filtering, but not Row or Pie. The chart works fine when the accessor returns Date.getTime() (as this is now numeric), but then the labeling is hard to read.
It looks like too many things are being filtered (i.e. dc's baseMixin _filterHandler could improve the value checking, maybe using filter.valueOf()).
Here is a JSFiddle showing most of the weirdness:
http://jsfiddle.net/SjT8E/1/
In the Fiddle, charts 3 and 5 both use the date dimension accessor. Charts 4 and 6 are their Date.getTime() counterparts, respectively. Notice the differences in the other charts when filtering on 3 vs. 4 and 5 vs. 6.
The text was updated successfully, but these errors were encountered: