Code Monkey home page Code Monkey logo

Comments (10)

plainheart avatar plainheart commented on July 21, 2024

从一开始都支持 2.0。高德这个区域搜索 DistrictSearch 需要单独引入插件,参考官方文档

from echarts-extension-amap.

schzh avatar schzh commented on July 21, 2024

应该不是这个问题,因为开始用v=1.4.15的时候就在初始连接上用plugin=AMap.DistrictSearch参数引入了,一直也是正常的,现在只是v=1.4.15改成v=2.0,其他的任何地方都没改,就出错了

from echarts-extension-amap.

plainheart avatar plainheart commented on July 21, 2024

我在示例基础上改成 2.0 使用此插件没有出现问题。如果可以,建议提供下能复现的示例,我具体看下。

from echarts-extension-amap.

schzh avatar schzh commented on July 21, 2024
<title></title> <style>html,body,#container{margin:0;height:100%}</style>
<script src="echarts.js"></script> <script src="echarts-extension-amap.min.js"></script> <script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=your key&plugin=AMap.DistrictSearch"></script> <script type="text/javascript"> var district = null; var polygons=[]; if(!district){ var opts = {subdistrict: 0,extensions: 'all', level: 'district'}; district = new AMap.DistrictSearch(opts);} option = { amap: {viewMode: '3D',center: [108.39, 39.9],zoom: 4}, series: [{type: 'scatter',coordinateSystem: 'amap',data: [[120, 30, 8], [120.1, 30.2, 20]],encode: {value: 2}}] }; var chart1=document.getElementById('charts1');echarts.dispose(chart1);chart=echarts.init(chart1);chart.setOption(option,true); </script>

from echarts-extension-amap.

schzh avatar schzh commented on July 21, 2024

其实就是你的那个示例+他的那个示例的两句。那个2.0换成1.4.15则没有任何问题

from echarts-extension-amap.

schzh avatar schzh commented on July 21, 2024

IE11的错误是:SCRIPT438: 对象不支持“assign”属性或方法
eval code (60) (1,1318)

Chrome的错误是:maps?v=2.0&key=&plugin=AMap.DistrictSearch:1 Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame.
at HTMLIFrameElement.t.onload (https://webapi.amap.com/maps?v=2.0&key= &plugin=AMap.DistrictSearch:1:501896)

from echarts-extension-amap.

plainheart avatar plainheart commented on July 21, 2024

IE 这个应该是语法兼容性问题 不支持 Object.assign 函数 可以自行添加或者引入三方 polyfill 解决。另外高德地图2.0用了 webgl 和 worker,对浏览器要求会高些。
Chrome 那个错误应该是因为是从本地文件直接打开的,缺失 origin,起一个 http server 去运行就不会报这个错误了。

from echarts-extension-amap.

schzh avatar schzh commented on July 21, 2024

IE 这个应该是语法兼容性问题 不支持 Object.assign 函数 可以自行添加或者引入三方 polyfill 解决。另外高德地图2.0用了 webgl 和 worker,对浏览器要求会高些。 Chrome 那个错误应该是因为是从本地文件直接打开的,缺失 origin,起一个 http server 去运行就不会报这个错误了。

谢谢,Chrome 用 http server可以解决。
IE11引入polyfill确实可以解决不兼容Object.assign的问题,但是很快后面还是会出别的错误,例如
buildingLayer=new AMap.Buildings();amap.add(buildingLayer);
会出错:SCRIPT5007: 无法获取未定义或 null 引用的属性“Ha”
maps (1,545996)

from echarts-extension-amap.

plainheart avatar plainheart commented on July 21, 2024

这应该是高德地图2.0的兼容性问题了。2.0对浏览器版本要求较高,IE 下有些插件如果他们官方没有作兼容处理的话,肯定会有这类问题。建议用 Edge 或 Firefox、Chrome 运行。一定要兼容IE的话,我想只能保持用1.4.15版的了。

from echarts-extension-amap.

schzh avatar schzh commented on July 21, 2024

IE 这个应该是语法兼容性问题 不支持 Object.assign 函数 可以自行添加或者引入三方 polyfill 解决。另外高德地图2.0用了 webgl 和 worker,对浏览器要求会高些。 Chrome 那个错误应该是因为是从本地文件直接打开的,缺失 origin,起一个 http server 去运行就不会报这个错误了。

放弃兼容IE了,太繁琐,另外Chrome不使用http server也可以解决,只要加上参数"disable-web-security",Chrome也可以打开本地的html文件不出跨域错误

from echarts-extension-amap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.