Any plan to add Pyecharts?

Pyecharts is a python version of echarts js, which is also a popular open source charting package originally developed by search engine giant Baidu.com

I’m wondering if there is any plan to added it into the charting library in the future.

Chart examples

Pyecharts website

Thank you very much!

Hi @yalunren and welcome to the forum! :wave:

Thanks for the proposal. I created a feature request on GitHub (https://github.com/streamlit/streamlit/issues/1199). You can help design this feature or follow its progress over there.

Let me know if there is anything else I can help you with.

Awesome! Thanks a lot! :grinning:

Hi @yalunren -

This functionality now exists for Streamlit >= 0.63 as part of our Components functionality:

4 Likes

Great. Can’t wait to use it. Thanks a lot!

1 Like

Hey @yalunren, don’t hesitate to ping me if you have any issues with the Component, there’s still probably some rough edges :slight_smile: (like not all maps working, maybe 3D plots don’t work either, sometimes pyecharts theme doesn’t work for no reason…)

1 Like

I did encounter a few strange problems.

  1. I tried to run the example. It doesn’t work in Safari. Then I open in Chrome, it seems fine. Is there any setting I have to do with Safari browser?

I attached a picture for the testing. Left side is in Safari browser, right side is Chrome.

  1. The terminal shows a warning message, which says

PendingDeprecationWarning: pyecharts All charts will start to use ChartItem for data setting starting v1.9.0
super().init(init_opts=init_opts)

Not sure if it will affect the graph display.

  1. I also tried the st.html example.

When I run it, it show the following error.

Traceback (most recent call last):
File “q.py”, line 249, in
st.html(c, width=1000, height=1000)
AttributeError: module ‘streamlit’ has no attribute ‘html’

Thanks a lot!

Eheh thanks for testing my component

Owww…could you check your Safari Developer tools, in the Console tab, for any JS errors ?

I got this error when I upgraded Pyecharts. It should not change anything for now. I need to learn pyecharts more to understand how it’s structured

Oops that’s on me, it’s an artifact from the beta…the correct code is

import streamlit.components.v1 as components
from pyecharts import options as opts
from pyecharts.charts import Bar

c = (Bar()
     .add_xaxis(["Microsoft", "Amazon", "IBM", "Oracle", "Google", "Alibaba"])
     .add_yaxis('2017-2018 Revenue in (billion $)', [21.2, 20.4, 10.3, 6.08, 4, 2.2])
     .set_global_opts(title_opts=opts.TitleOpts(title="Top cloud providers 2018", subtitle="2017-2018 Revenue"),
                      toolbox_opts=opts.ToolboxOpts())
     .render_embed()  # generate a local HTML file
     )
components.html(c, width=1000, height=1000)

I pushed the fix on Github, thanks for catching that

Fanilo

1 Like

Thanks for the quick fix!

I checked both Safari and Chrome. I attached the pictures. The red warning is from Safari and yellow is from Chrome. They all have some errors. Seems missing some js file. However, Chrome still runs fine and Safari just doesn’t show the graph.

Those source maps shouldn’t matter for the rendering :wink:

I don’t know about the Safari problem though. Are you able to run other Streamlit components from the Gallery on Safari, like streamlit-embedcode or Drawable canvas ?

Streamlit embed graph has similar error messages, but it shows fine.