holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.78k stars 518 forks source link

Events support for Panel Echarts #2147

Closed JackDapid closed 3 months ago

JackDapid commented 3 years ago

As a big fan of https://awesome-panel.org/echarts by @MarcSkovMadsen and https://panel.holoviz.org/reference/panes/ECharts.html I am using echarts a lot and got frustrated that they seemed to have dropped events / JS callback support from pyecharts? - see https://github.com/pyecharts/pyecharts/issues/1671 Without 'interactivity" the nice echarts are only half useful.

Clearly forking an pyecharts with bringing in that support is a n option, but I am looking for a discussion if there are some other ideas that could benefit other Panel echarts users.

MarcSkovMadsen commented 3 years ago

One thing is that you could turn this into a feature request for events support for the Panel Echarts pane :-)

Additional Context

Regarding the api for adding support for events inspiration could be drawn from the panel-highcharts package I recently made. There are lots of event but I setup a "clever" mechanism to subscribe to the ones I need.

For example for the Network example you subscribe using

image

and get something like shown here

https://twitter.com/i/status/1378418244978106374

JackDapid commented 3 years ago

Hi @MarcSkovMadsen thank you. panel-highcharts is really nice, I didn't see it on awesome-panel webpage before, but learned now to follow you on twitter for such news :-). Ok I see I was misinterpreting: https://github.com/holoviz/panel/blob/cc1548550b6375f69d0c9bc7e58207c0dd2af84c/panel/pane/echarts.py#L18 that Panel Echarts pane is using pyecharts, but now (awake!) I see it is not and I really like your subscription mechanism. WIll have some time hopefully over the weekend to look in details to panel-highcharts and Panel Echarts pane to see if I can build a minimal demo following the mechanism.

JackDapid commented 3 years ago

I checked panel-highcharts - really nice @MarcSkovMadsen - can't use it for the current project, but sure I will find a good use for one of the next projects.

For events in panel.Echarts happy to try to implement something similar, but I am a liitle stuck with panel model logic (see below), so currently I use a workaround inspired by @nghenzi from: https://github.com/holoviz/panel/issues/1883

Workaround

  1. create a Tree via pyecharts 'tree = Tree(...)'
  2. get a html vis pyecharts 'html = tree.render_embed()'
  3. adding the JS to the Githubissues.
  4. Githubissues is a development platform for aggregating issues.