apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.44k stars 19.61k forks source link

Support inline svg #13460

Closed Hunlongyu closed 4 years ago

Hunlongyu commented 4 years ago

Support inline svg

const svg = '<svg role="img" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-labelledby="stopIconTitle"><rect width="14" height="14" x="5" y="5"></rect></svg>'

...
series: [
 {
    type:  'scatter',
    coordinateSystem: 'geo',
    symbol: `image://${svg}`
  }
]
...

When will we support it

base64 image string is too long

Hunlongyu commented 4 years ago

It's OK

svg path

const path = '<path d="M512 0a341.312 341.312 0 0 0-341.312 341.312c0 140.672 189.952 490.688 286.4 651.52a63.936 63.936 0 0 0 109.824 0c96.448-160.832 286.4-510.848 286.4-651.52A341.312 341.312 0 0 0 512 0z m0 512a170.688 170.688 0 1 1 0-341.312A170.688 170.688 0 0 1 512 512z" fill="#ffe400" p-id="1159"></path>'

...
series: [
 {
    type:  'scatter',
    coordinateSystem: 'geo',
    symbol: `path://${path}`
  }
]
...