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

echarts3.x 还能像echarts2.x那样,支持svg的地图扩展吗? #4537

Closed
gjn0314 opened this issue Nov 22, 2016 · 6 comments
Closed

echarts3.x 还能像echarts2.x那样,支持svg的地图扩展吗? #4537

gjn0314 opened this issue Nov 22, 2016 · 6 comments

Comments

@gjn0314
Copy link

gjn0314 commented Nov 22, 2016

问题简述 (One-line summary)

echarts3.x 还能像echarts2.x那样,支持svg的地图扩展吗?
例如2.x中的人体图,足球场的svg扩展

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):3.x
  • 浏览器类型和版本 (Browser version):IE
  • 操作系统类型和版本 (OS Version):windowsXP

重现步骤 (Steps to reproduce)

期望结果 (Expected behaviour)

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

option = {

}

其他信息 (Other comments)

@partical
Copy link

我们公司有时候需要定制一些地图,比如包括一些经济开发区的,现在的解决办法是自己写了一个工具,将svg的图片转成echarts支持的地图json.你可以参考这个思路自定义地图。

@pissang pissang closed this as completed Nov 25, 2016
@pissang
Copy link
Contributor

pissang commented Nov 25, 2016

@partical 方便的话可否贡献转换工具作为 echarts 的周边工具链?

@partical
Copy link

@pissang OK,有时间将这个工具剥离,公布出来。

@stsshenwei
Copy link

@pissang 现在这个工具剥离出来了吗?能方便贡献一下怎么将svg图片转换为echarts支持的json吗

@webLoginjun
Copy link

请问能方便贡献一下怎么将SVG图片转换成json么?

@plainheart
Copy link
Member

plainheart commented Oct 6, 2020

目前似乎可以通过 echarts.registerMap 注册所需的 svg 扩展地图,然后在 series.map 中使用即可。

$.get('football.svg', function (svg) {
  echarts.registerMap('football', {
     svg: svg
  }
});

image

mapbox 也提供了一个 svg 转 geoJSON 的插件:svg-to-geojson
不过转换出来只是结构,不包含样式。

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

6 participants