Last week I implemented the multiple panes interactivity to the front-end of Nyaplot. You can see the demo on this notebook.
Skip over single pane demo, and have a look at the paragraph ‘Multiple
panes demo’ at the bottom. In this example, the histogram and bar chart are
created individually, and then thrown into one instance of
Nyaplot::Frame. After running
frame.show, both of the diagrams
appear in one out-put box on the notebook. When you click the
histogram, bar chart refrects that and change its height.
In this article I will explain about the event handler of Nyaplot, which allows for interactivity among panes.
The trick is actually hidden in Nyaplot::DataFrame. In this example,
both of the two diagrams are generated from columns in one DataFrame.
When Nyaplot receives a column object (instance of
internally find its source data frame and remembers its location.
Consequently, Nyaplot can find that histogram and bar chart are sharing their data source, and allows them to interact with each other.
As you can see, Nyaplot’s inner workings are fairly simple; and these workings are common to all diagrams supported by Nyaplot. So not only the histogram and bar chart, but other diagrams as well, can behave interactively (e.g., histogram, bar, and Venn example).
Nyaplot and its back-end library Nyaplotjs are being developed on GitHub.
If you are interesed, feel free to try it and raise issues or send pull-requests.