Hi all. First off- I love observable and I really enjoy all the wonderful creative work on here. Thanks so much!
Now, I do have a question.
- I made a bar chart (barchart with x-axis timescale) with click events.
- Once a bar is clicked, I would like to add/remove the start-end date of this bar to/from another chart for reference.
The notebook is here: https://observablehq.com/@thijsschouten/dsp-geddash
Im trying to solve this by:
- Adding a click event to the bars
- Once the bars are clicked, I add/remove the data entry to/from an array (mutable)
- Look for changes in the array, and add/remove my second chart accordingly.
However, I can’t get this approach working so far. Pushing to a mutable doesn’t seem to work in a reactive way- the dependent cells don’t get the update. I can see that the data is added by clicking on my mutable array, but it doesn’t do this by itself.
I narrowed it down in this notebook:
Two questions:
- How can I get this approach to work?
- Is there a better (cleaner) way to do this?
Thanks in advance!
T