Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

echarts.graphic.LinearGradient not working #10

Closed
andfanilo opened this issue Feb 12, 2021 · 3 comments
Closed

echarts.graphic.LinearGradient not working #10

andfanilo opened this issue Feb 12, 2021 · 3 comments

Comments

@andfanilo
Copy link
Owner

color: new echarts.graphic.LinearGradient(
                    0, 0, 0, 1,
                    [
                        {offset: 0, color: '#83bff6'},
                        {offset: 0.5, color: '#188df0'},
                        {offset: 1, color: '#188df0'}
                    ]
                )

doesn't work. I suppose the echarts namespace was minified and doesn't exist anymore?

https://echarts.apache.org/examples/en/editor.html?c=bar-gradient

@liunux4odoo
Copy link

yes, you are right, the global variable echarts does not exist anymore after webpacking, so the LinearGradient will not work with the built chunks.
variable echarts has lots of APIs that can be set to chart option in runtime. In webpack environment, you can only use them when developing , e.g. echarts.registerMap, in build chunks it does not exist either.

@andfanilo
Copy link
Owner Author

Yeah, which is too bad :(

I wanted to try referring back to the echarts instance through a ref but the Streamlit lifecycle makes it hard to go back and forth between Python and JS afterwards anyway (absolutely not easy to do streamlit_echarts.setOption or streamlit_echarts.registerMap after the component was set, everything must be done when initializing the component and then eventually rerunning the script by changing component arguments to animate between 2 states)

Thanks for your comment, it helped reinforce my thoughts about it :) I may close this soon as "Unresolved"

Fanilo

@andfanilo
Copy link
Owner Author

Actually I'll close this in favor of #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants