Closed 87265822 closed 3 years ago
@87265822 我也使用vue,使用npm install echarts
之后,在echarts/map/js
中是有地图相关的js,你可以直接
import echarts from 'echarts'
require('echarts/map/js/china.js')
export default {
...
mounted () {
let myChart = echarts.init(document.getElementById('graph'))
let option = {
...
}
myChart.setOption(option)
}
}
@MrChanLi2013 我很奇怪,为什么我require我自己下载的china.js
就报错“echart not loaded”
呢? 除了和echarts/map/js
路径不同以外,其他的完全相同
@imageslr 如果是自己单独引入的推荐使用加载json的方式:
// import echarts from './../../../static/echarts/echarts.js' 这里是引入echarts本地文件
echarts.registerMap('china', '你的china.json文件')
我遇到了和你一样的问题,暂时不知道如何解决。
这个咋解决的,求教
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.
This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!
One-line summary [问题简述]
在vue2.x中使用echarts,地图或者theme引入会有问题
不管是map还是theme,js类型的,import之后,都没有效果 我试了map的json格式,再用echarts.registerMap,地图就可以。 import china from 'echarts/map/json/china.json'; echarts.registerMap('china', china);
我查看了chian.js里面的代码,怀疑是echarts.registerMap这边有问题。
Expected behaviour [期望结果]
希望官网提供的js格式也没有问题。