-
It would be really useful to have an example (or some quick advice) on how to reset one of the Clauses in a cross-filter selection associated with a specific Chart. In the API it is mentioned that a Selection can be reset this way: This API sounds exactly right - except that I cannot seem to find in the documentation anywhere where to actually extract the source variable from a vgplot that I create that use this particular selection filter? Maybe I am somehow missing something really rudimental/simple here? Some generic and possibly common use cases related to this question:
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Adding some notes here for future references to others who are looking to do the same thing. This is likely not the best-practice approach to achieve this, but it works. In order to match the plot to remove the selection from programmatically, I was able to set a unique ID in the attributes setting, that I could match knowing this unique ID in a wrapper component (or some other type of stateful object which is used to generate the vgplot. I would match the unique ID with any source objects that match this ID in the Selection object's source arrays, [object]._value.active as well as all the index references [object]._value[x] (if any). For discussion - the name() attribute is not listed in the attributes array in internal data structures (for example when reading out a Selection object through [object]._value[x].mark.plot.attributes.name), so using vg.name("my_unique_plot_id") can not be used in the approach above to identify the source associated with the plot to be cleared from a prior selection. Also, feel free to share the recommended best-practice approach for above, if any. |
Beta Was this translation helpful? Give feedback.
-
Hi @Unemyr - I'm trying to address the same issue... This is my
I call this This works fine when I have a single plot, but if I have multiple plots based on the same I have a tiny example at https://deploy-preview-58--parade-crossfilter.netlify.app/ (this doesn't include my When I filter by the chart on the left, then I change the axes for that chart, using Any ideas how I would do that? |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response. This causes a problem in this scenario... I have 2 plots: So, the only solution I can see is to also recreate
But then I don't think that
|
Beta Was this translation helpful? Give feedback.
-
@will-moore I agree that What might be of use is the |
Beta Was this translation helpful? Give feedback.
-
@jheer Thanks for that - it's got me most of the way there! I don't see My commit to add this is at The only issue remaining is this... If I have e.g. 2 plots with clauses: ![]() and I remove the clause from the one on the left. Initially I pass this to However, that seems to remove BOTH the clauses. Console.log looks like this: ![]() And the plots now show no filtering (although the selection rectangle is still visible on the other plot): ![]() Any ideas what's going on here? That change is currently deployed at https://deploy-preview-58--parade-crossfilter.netlify.app/ if you want to try it (just click the Thanks for your help |
Beta Was this translation helpful? Give feedback.
Adding some notes here for future references to others who are looking to do the same thing. This is likely not the best-practice approach to achieve this, but it works.
In order to match the plot to remove the selection from programmatically, I was able to set a unique ID in the attributes setting, that I could match knowing this unique ID in a wrapper component (or some other type of stateful object which is used to generate the vgplot. I would match the unique ID with any source objects that match this ID in the Selection object's source arrays, [object]._value.active as well as all the index references [object]._value[x] (if any).
For discussion - the name() attribute is not listed in…