Comments (6)
这是一个bug,dom图层添加这块处理的有问题,没有考虑地图容器,本周我会处理一下
from ol3echarts.
请问这个问题解决了吗?项目上很着急
from ol3echarts.
@a24576946 可能需要稍等两天,有兴趣可以处理一下 问题定位 给我发个 pr。
from ol3echarts.
@sunday60004 @a24576946 稍后请升级 v1.3.6再试下 🍶
from ol3echarts.
年后换服务器发现几个月前的代码全挂了,看了源代码 v1.3.6 的处理方式是有 bug 的,getTarget 支持 id,className,TagName 和 querySelectorAll 查找 dom,但是 v1.3.6 只考虑了 className,TagName 两种情况,ol 的 getViewport() 返回的是 HTMLElement,HTMLElement 是没有 getElementById 和 querySelectorAll 方法的。
我简单处理了一下,用 getElementById 和 querySelectorAll 时指定为 docment :
const getTarget = (selector, doc = document) => {
let dom = (function () {
let found;
return doc && /^#([\w-]+)$/.test(selector)
? (found = document.getElementById(RegExp.$1)) // eslint-disable-line
? [found]
: [] // eslint-disable-line
: Array.prototype.slice.call(
/^\.([\w-]+)$/.test(selector)
? doc.getElementsByClassName(RegExp.$1)
: /^[\w-]+$/.test(selector)
? doc.getElementsByTagName(selector)
: document.querySelectorAll(selector)
);
})();
return dom;
};
我之前的处理方式是创建完 map,找到 dom 给它设置 id,getTarget 就会走 getElementById 这条途径,不至于走 getElementsByClassName 导致所有图全在一张图上。
document.getElementById("mid_map").firstChild.children[1].id = "mid_map_id";
from ol3echarts.
@kyleinfo 是的确实会有这个问题,但是现在整体的处理方式还是有点不完美,如果有更好的解决方案可以发个Pull Request。另外一个就是建议锁定一下版本,因为现在的整体测试用例没有完全覆盖,有些时候的大问题的修复对之前版本的兼容考虑的还不够 😢
from ol3echarts.
Related Issues (20)
- echarts导入问题 HOT 2
- 在EchartsLayer上叠加openlayer图层是否可行 HOT 1
- coordinateSystem的问题
- lines飞线投影 HOT 1
- ECharts 5 support
- 大佬,文档是看不了吗,怎么没有参数和api介绍呢 HOT 1
- 请教~ new EChartsLayer 报错怎么回事 HOT 8
- appendTo方法报错 HOT 1
- ol-echarts V4.0.0添加GEO坐标系后,拖动全球地图后,坐标点散点消失 HOT 1
- ol8+ol-echarts4无法显示热力图,有大佬帮忙看下么🤗
- bug - map 销毁问题 HOT 1
- 使用北京地方坐标系,画lines图(航线图),看不见 HOT 1
- 有没有可能把L7封装到ol里面呢? HOT 1
- 似乎不支持 series.map 类型? HOT 1
- 拖动地图后数据没有完全加载 HOT 1
- mapBrowserPointerEvent HOT 1
- Cannot set property 'disposed' of null HOT 2
- Uncaught TypeError: EChartsLayer__default.default is not a constructor HOT 2
- Cannot read properties of undefined (reading 'transform') MapDraw.draw (MapDraw.js:210:32) HOT 5
- echarts geo maps are not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ol3echarts.