ipyvizzu
ipyvizzu copied to clipboard
support calling back to the Python kernel from events
It would be a common use-case to handle Vizzu's click event from the Python side. E.g. for triggering another animation. Example code:
def filter(event):
filter1 = Data.filter("record['Joy factors'] === event.marker.categories['Joy factors']")
chart.animate(filter1)
chart.on('click', filter)
chart.animate(
Config.column(
{
"x": "Joy factors",
"y": "Value 2 (+)",
"title": "Column Chart",
}
)
)
In the background we would need to do something like this in the Javascript side:
chart.on('click', event => IPython.notebook.kernel.execute(`filter(${JSON.serialize(event)})`));