I am working on a dataviz with dc.js (http://edouard-legoupil.github.io/3W-Dashboard/)
The main limitation is that when users find a specific fact while they explore the data, it is not easy to reproduce the exact filters they used in order to share their findings with other users (and initiate a discussion). A solution could be to have permalinks for each filter state.
dc.js has already the "dc.redrawAll();" to reset all filter but is there any capacity to freeze a certain filters state and pass it to a #href?
Ideally such href would be then shared through a share button or through the regular facebook/twitter sharing function.
Any code snippet or examples would really help!
Thanks in advance, Edouard
Here are the key methods that you will want to use:
From there it's just a matter of serializing and deserializing the objects.
Here is one way to do that by stringifying a JSON object:
Here is the reverse process of parsing the JSON string and applying the filters:
Connecting the two steps will depend on your scenario. You could perhaps save the string to the database or append it as a url param.
This code might be missing some edge cases, but it seems to work for the basic dc.js examples.