Replies: 1 comment
-
Currently Mosaic hasn't had careful design attention for charts that enter, leave, and re-enter a display. The simplest setup from Mosaic's perspective would be to preserve the original chart instances by hiding them rather than removing and reinstantiating them. Then the state should persist without issues. I think the current problem is that the prior selections persist within Mosaic's state, and they are then used to filter the newly instantiated versions. One needs to deregister clients. If you aren't doing so already, you can call Still, our current There is also a separate issue of serializing selections for reuse. Interactors maintain a I realize the above may be hard to follow if you don't know Mosaic internals. Sorry! Again, if possible, I think the easiest solution for now would to simply toggle the visibility of side charts without actually dropping charts and then adding completely new ones. |
Beta Was this translation helpful? Give feedback.
-
Hello wonderful Mosaic team!
I am trying to use Mosaic in a kind of a dashboard with charts rendered in panels which can be toggled on and off. I noticed that when displaying a filterable vgplot chart again after it had been hidden, it would not pick up the previous selection correctly. Instead, it represents the filtered data as if it was the whole unfiltered dataset and the brush selection is empty.
Is there a way to initialize the chart so that the selection is represented correctly?
And a related question: is there a way to serialize and deserialize
Selection
so that the filter state can be saved in the dashboard and displayed correctly on reload?Thanks in advance!
Kapture.2024-03-28.at.09.15.39.mp4
The chart specs I use look like below, where
filterSelection = Selection.crossfilter()
:And the wrapper React component I am using to render the charts:
Beta Was this translation helpful? Give feedback.
All reactions