-
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
series chart example: zooming causes the buttons to display incorrect data #1536
Comments
Confirmed, thanks @joergplewe! This is weird behavior. This example is trying to replace all the data, so all of it does need to be removed. Zooming implicitly sets a filter, and So that explains why your workaround works. Another workaround is ndx.remove(() => true); This is slightly safer because the crossfilter state remains consistent with the chart state. It uses the "remove with predicate" feature of crossfilter 1.4 (crossfilter/crossfilter#6). I'm having trouble explaining the observed behavior, with the new lines coming in below everything else. The old lines do steadily get taller and taller, which makes sense with points being added too many times. But why not just parts of those lines? I hope to take another look. In any case, you are right that the example needs to be fixed. Thanks for the report! |
Strange enough, even when removing filter, the zoom (=== the filter) is re-established after loading new data? |
dc.js keeps track of the zoom and filters separately from crossfilter. In fact, crossfilter doesn't provide very many getters, so everyone downstream is forced to keep track of this stuff on their own (and keeping it in sync, which is why I recommend manipulating filters through the charts only). So if you remove the filter, dc.js doesn't know about it and will happily go along thinking the filter is how it left it. If there were other charts on the page, you'd see some inconsistencies, because the filter will be reapplied whenever the chart is zoomed. |
I'm updating the replacing data example to use crossfilter 1.4: function resetData(ndx) {
ndx.remove(() => true);
} Should be much more reliable. 😉 Will update the area example when I do the next release. |
In the series chart example:
Use mouse to zoom into the chart. From now on the buttons [1][2][3] no longer display the correct data.
A workaround is to clear filter in function
load_it()
. I suppose that hints to a bug somewhere else?The text was updated successfully, but these errors were encountered: