Version
5.5.0
Link to Minimal Reproduction
暂无,里面有些geo数据无法展示
Steps to Reproduce
发现一个问题,我想实现地图下钻的功能,代码实现如下,先加载了默认地图数据【map】,然后绑定了点击事件,处理点击事件时,切换map为map2, 然后调用goback重置options时,效果不符合预期
var options = {
tooltip: {},
geo: {
map: 'map',
regions: [],
},
series:[
{
type: "map",
geoIndex: 0,
data: [],
}
],
};
onMounted(async () => {
mapData = ...;
mapData2 = ...;
mapDom = document.getElementById('map');
myChart = echarts.init(mapDom);
mapData = await util.getGeoData();
echarts.registerMap("map", mapData);
myChart.setOption(options);
myChart.on('click', e => {
echarts.registerMap("map2", mapData2);
options.geo.map = "map2";
myChart.setOption(options);
})
})
function goback() {
echarts.registerMap("map", mapData);
options.geo.map = "map";
myChart.setOption(options);
}
Current Behavior
goback触发后,出现以下问题
- 发现第一次点击的区域没被选中,但是当我鼠标滑过上次点击的区域时又被选中了,并且离开该区域后,选中状态不会消失
- 后来我试了下设置options时,指定notMerge为true,当我返回上一步时,重复1步骤都同样不会被选中,但是滑过选中区域时也不会被选中
- options里面没有series时,不会出现以上情况,也不会记录被选中的区域
Expected Behavior
- 返回上一步时能选中上次点击的区域
Environment
- OS:
- Browser:
- Framework:
Any additional comments?
No response
2条答案
按热度按时间mi7gmzs61#
@guanzongjiang It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED
TITLE
[Bug] The selected area echoes abnormally
BODY
Version
5.5.0
Link to Minimal Reproduction
None at the moment, some geo data cannot be displayed.
Steps to Reproduce
I found a problem. I want to implement the map drill-down function. The code is implemented as follows. First, the default map data [map] is loaded, and then the click event is bound. When processing the click event, switch the map to map2, and then call goback to reset the options. When, the effect is not as expected
var options = {
tooltip: {},
geo: {
map: 'map',
regions: [],
},
series:[
{
type: "map",
geoIndex: 0,
data: [],
}
],
};
onMounted(async () => {
mapData = ...;
mapData2 = ...;
})
function goback() {
echarts.registerMap("map", mapData);
options.geo.map = "map";
myChart.setOption(options);
}
Current Behavior
After goback is triggered, the following problems occur
Expected Behavior
Environment
Any additional comments?
No response
g6ll5ycj2#
🚩 Please note that "how to", usage or debugging questions are not supposed to be answered here.
Adhere to Official posting recommendations:
The issue list is reserved exclusively for bug reports and feature requests.
For usage questions, please use the following resources:
Another good resource is website makeapie.cn with map drill examples like this , this , this .