ipyvizzu icon indicating copy to clipboard operation
ipyvizzu copied to clipboard

support calling back to the Python kernel from events

Open simzer opened this issue 2 years ago • 0 comments

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)})`));

simzer avatar Mar 23 '23 09:03 simzer