Kanaries / pygwalker

PyGWalker: Turn your pandas dataframe into an interactive UI for visual analysis
https://kanaries.net/pygwalker
Apache License 2.0
13.22k stars 688 forks source link

pygwalker 0.4.5 error: VM1227:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<html><tit"... is not valid JSON #429

Closed Renaldy002 closed 9 months ago

Renaldy002 commented 9 months ago

pygwalker 0.4.5 python 3.9.0 streamlit 1.30.0

I want to show chart only on streamlit so I used this code I found

renderer = get_pyg_renderer(chart_data,vis_spec)
renderer.render_pure_chart(0)

or

renderer = get_pyg_renderer(chart_data)
renderer.render_explore()

but it got error VM1227:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<tit"... is not valid JSON

when I try the different method of showing chart it works but I can't show chart only by using this method

pyg_html = pyg.to_html(chart_data,spec=vis_spec)
components.html(pyg_html,scrolling=True,height=500)

pygwalker 1 pygwalker 2 pygwalker 3

longxiaofei commented 9 months ago

add code:

from pygwalker.api.streamlit import init_streamlit_comm

init_streamlit_comm()

In the next version of pygwalker, init_streamlit_comm will be loaded implicitly.

Renaldy002 commented 9 months ago

okaay it works for me, thank you so much