-
Notifications
You must be signed in to change notification settings - Fork 19.7k
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
地图geojson中properties键值为大写时的问题 #11799
Comments
Hi! We've received your issue and please be patient to get responded. 🎉 In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer. If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical questions. If you are interested in the project, you may also subscribe our mail list. Have a nice day! 🍵 |
@yuanqiangxie 目前Echarts 中的 geojsonParser 只支持 properties.name 作为 key 去标识 region 对象,所以要么你批量修改下你的数据,改成小写name,或者我们改下 parseGeoJson.js 的一行,虽然我觉得没必要。你们觉得呢? @yufeng04 @Ovilia https://github.com/apache/incubator-echarts/blob/master/src/coord/geo/parseGeoJson.js#L139 |
@alex2wong 个人觉得还是开发者修改比较好! |
Geojson 的这个properties 是没有严格标准的,具体用户会提供 name,NAME,还是 Name 都不可预测。所以就怕过两天来个issue,说用的 nAME 怎么办? 倒是可以先把纯大写这种情况考虑下。 |
我觉得还是应该修改下parser好一些。我们现在用的是别人的wfs服务返回的json,服务端我们修改不了,现在只能是前端把key值替换成小写。我建议最好增加一个option配置项用户可自定义region标识@alex2wong |
这个问题我找到所在点了,
|
上面的大佬说过这块源码了,刚看到。看了一下geojson的文档,确实没有说properties的大小写要求,name和NAME都可以。如果echarts不修改这个地方,那使用NAME的geojson转换就很麻烦,而且不灵活(其他字段也无法像现在name字段这样的效果),优雅的方式应该是多添加一个参数,最少应该在目前的文档中注明使用时注意的地方(强制指定geojson 中properties中存在name)。 @alex2wong |
谢谢建议 @yafengstark 。geojson 对于 properties 里拥有的属性确实没有规范规定,感觉是应该兼容一下。 @alex2wong 可以按照你修改的思路提一个 PR 么?感谢~ |
我尝试修改了一下,pr在这里,纯新手。 |
在 #12156 中已修复,非常感谢 @yafengstark @alex2wong 的贡献~ |
@pissang 你好,请问geojson里的properties的数据,怎么在echarts的事件里获取到?比如click的时候,现在只能获取到上面说的name。但是 https://github.com/apache/incubator-echarts/blob/master/src/coord/geo/parseGeoJson.ts#L145 这行代码好像是把全部的值都带出来了。 |
Version
4.5.0
Steps to reproduce
地图加载的geojson如果properties中的键名为大写时,渲染出来的地图没有区分开,不能单个选中
What is expected?
地图中每个区域应该可以单独选中
What is actually happening?
只能选中整块地图
基于https://www.echartsjs.com/examples/en/editor.html?c=map-usa 这个示例我在codepen上做了一段重现bug代码的示例:
https://codepen.io/xyq/pen/XWJbGBd
The text was updated successfully, but these errors were encountered: