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

image url #17

Closed
lironiz opened this issue Mar 20, 2020 · 1 comment
Closed

image url #17

lironiz opened this issue Mar 20, 2020 · 1 comment

Comments

@lironiz
Copy link

lironiz commented Mar 20, 2020

I have a flutter project using flutter_echarts.
I want to add icons to my yAxis, using rich text. the icons are in assets/images/imageName.png,
but when I use it like this in 'rich'

backgroundColor: {
                           image: './assets/images/imageName.png'
                           },
                      },

or like this

backgroundColor: {
                           image: 'assets/images/imageName.png'
                           },
                      },

the icon is not displayed.
is there another way?

@entronad
Copy link
Owner

@lironiz

Because this lib abstract web assets to strings, you could not directly handle imge files.
The solution is to use Data URL , Echarts image property allows all legal URL forms, so just transform your image asset to a Base64 Data URL string just like we often do in CSS.
If you are not familiar with CSS Base64 Data URL, please search for docs like: https://stackoverflow.com/questions/17090571/is-there-a-way-to-set-background-image-as-a-base64-encoded-image

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