dc-js / dc.js

Multi-Dimensional charting built to work natively with crossfilter rendered with d3.js
Apache License 2.0
7.42k stars 1.81k forks source link

Serialize / deserialize filter status #1778

Closed kum-deepak closed 3 years ago

kum-deepak commented 3 years ago

Ability to do so at the chart and chart group level. This will allow saving / restoring state (in terms of filters) for the entire chart group. Can be used as undo/redo, or to even save in secondary storage across user sessions.

One challeneg remains - how do we identify charts (or dimenions) across sessions. One approach can be chart anchors. @gordonwoodhull any ideas?

gordonwoodhull commented 3 years ago

Agree, if we are composing an object of all filters, .anchorName() would be a good choice: it is guaranteed to be a unique identifier for the chart.

It is not sufficiently documented, but it checks if the anchor is an element, if so uses its id; if it's a string selector it removes #; otherwise it creates a string based on the chart's unique integer id.

Therefore it will work in all cases, and work optimally in the most common case, where unique #id selectors are used.

I suppose if we wanted we could have another level of customization over that, but it's a great default.

kum-deepak commented 3 years ago

Thanks, Gordon! That is helpful. Initial changes are same as needed for #1777. I will make a merge than diverege.

kum-deepak commented 3 years ago

Implemented in #1795