question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

geo can not display after hidden.

See original GitHub issue

Version

5.0.0

Steps to reproduce

                    var chart = echarts.init(document.getElementById('main'));

                    var option = {
                        aria: {
                            show: true
                        },
                        tooltip: {},
                        legend: {
                            orient: 'vertical',
                            left: 'left',
                            data:['categoryA','categoryB','categoryC']
                        },
                        visualMap: {
                            min: 0,
                            max: 1500,
                            left: 'left',
                            top: 'bottom',
                            text: ['High','Low'],
                            seriesIndex: [1, 2, 3],
                            inRange: {
                                color: ['#006edd', '#e0ffff']
                            },
                            calculable : true
                        },
                        geo: {
                            map: 'china',
                            roam: true,
                            label: {
                                normal: {
                                    show: true,
                                    textStyle: {
                                        color: 'rgba(0,0,0,0.4)'
                                    }
                                }
                            },
                            itemStyle: {
                                normal:{
                                    borderColor: 'rgba(0, 0, 0, 0.2)'
                                },
                                emphasis:{
                                    color: null,
                                    areaColor: null,
                                    shadowOffsetX: 0,
                                    shadowOffsetY: 0,
                                    shadowBlur: 20,
                                    borderWidth: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        },
                        series : [
                           {
                               name: 'pm2.5',
                               type: 'scatter',
                               coordinateSystem: 'geo',
                               data: convertData(data),
                               symbolSize: function (val) {
                                   return val[2] / 10;
                               },
                               label: {
                                   normal: {
                                       formatter: '{b}',
                                       position: 'right',
                                       show: false
                                   },
                                   emphasis: {
                                       show: true
                                   }
                               },
                               itemStyle: {
                                   normal: {
                                       color: '#ddb926'
                                   }
                               }
                            },

                            {
                                name: 'categoryA',
                                type: 'map',
                                geoIndex: 0,
                                // tooltip: {show: false},
                                markPoint: {
                                    data: [{
                                        coord: [115.97, 29.71]
                                    }]
                                },
                                data:[
                                    {name: '北京',value: Math.round(Math.random()*1000)},
                                    {name: '天津',value: Math.round(Math.random()*1000)},
                                    {name: '上海',value: Math.round(Math.random()*1000)},
                                    {name: '重庆',value: Math.round(Math.random()*1000)},
                                    {name: '河北',value: Math.round(Math.random()*1000)},
                                    {name: '河南',value: Math.round(Math.random()*1000)},
                                    {name: '云南',value: Math.round(Math.random()*1000)},
                                    {name: '辽宁',value: Math.round(Math.random()*1000)},
                                    {name: '黑龙江',value: Math.round(Math.random()*1000)},
                                    {name: '湖南',value: Math.round(Math.random()*1000)},
                                    {name: '安徽',value: Math.round(Math.random()*1000)},
                                    {name: '山东',value: Math.round(Math.random()*1000)},
                                    {name: '新疆',value: Math.round(Math.random()*1000)},
                                    {name: '江苏',value: Math.round(Math.random()*1000)},
                                    {name: '浙江',value: Math.round(Math.random()*1000)},
                                    {name: '江西',value: Math.round(Math.random()*1000)},
                                    {name: '湖北',value: Math.round(Math.random()*1000)},
                                    {name: '广西',value: Math.round(Math.random()*1000)},
                                    {name: '甘肃',value: Math.round(Math.random()*1000)},
                                    {name: '山西',value: Math.round(Math.random()*1000)},
                                    {name: '内蒙古',value: Math.round(Math.random()*1000)},
                                    {name: '陕西',value: Math.round(Math.random()*1000)},
                                    {name: '吉林',value: Math.round(Math.random()*1000)},
                                    {name: '福建',value: Math.round(Math.random()*1000)},
                                    {name: '贵州',value: Math.round(Math.random()*1000)},
                                    {name: '广东',value: Math.round(Math.random()*1000)},
                                    {name: '青海',value: Math.round(Math.random()*1000)},
                                    {name: '西藏',value: Math.round(Math.random()*1000)},
                                    {name: '四川',value: Math.round(Math.random()*1000)},
                                    {name: '宁夏',value: Math.round(Math.random()*1000)},
                                    {name: '海南',value: Math.round(Math.random()*1000)},
                                    {name: '台湾',value: Math.round(Math.random()*1000)},
                                    {name: '香港',value: Math.round(Math.random()*1000)},
                                    {name: '澳门',value: Math.round(Math.random()*1000)}
                                ]
                            },
                            {
                                name: 'categoryB',
                                type: 'map',
                                geoIndex: 0,
                                data:[
                                    {name: '北京',value: Math.round(Math.random()*1000)},
                                    {name: '天津',value: Math.round(Math.random()*1000)},
                                    {name: '上海',value: Math.round(Math.random()*1000)},
                                    {name: '重庆',value: Math.round(Math.random()*1000)},
                                    {name: '河北',value: Math.round(Math.random()*1000)},
                                    {name: '安徽',value: Math.round(Math.random()*1000)},
                                    {name: '新疆',value: Math.round(Math.random()*1000)},
                                    {name: '浙江',value: Math.round(Math.random()*1000)},
                                    {name: '江西',value: Math.round(Math.random()*1000)},
                                    {name: '山西',value: Math.round(Math.random()*1000)},
                                    {name: '内蒙古',value: Math.round(Math.random()*1000)},
                                    {name: '吉林',value: Math.round(Math.random()*1000)},
                                    {name: '福建',value: Math.round(Math.random()*1000)},
                                    {name: '广东',value: Math.round(Math.random()*1000)},
                                    {name: '西藏',value: Math.round(Math.random()*1000)},
                                    {name: '四川',value: Math.round(Math.random()*1000)},
                                    {name: '宁夏',value: Math.round(Math.random()*1000)},
                                    {name: '香港',value: Math.round(Math.random()*1000)},
                                    {name: '澳门',value: Math.round(Math.random()*1000)}
                                ]
                            },
                            {
                                name: 'categoryC',
                                type: 'map',
                                geoIndex: 0,
                                data:[
                                    {name: '北京',value: Math.round(Math.random()*1000)},
                                    {name: '天津',value: Math.round(Math.random()*1000)},
                                    {name: '上海',value: Math.round(Math.random()*1000)},
                                    {name: '广东',value: Math.round(Math.random()*1000)},
                                    {name: '台湾',value: Math.round(Math.random()*1000)},
                                    {name: '香港',value: Math.round(Math.random()*1000)},
                                    {name: '澳门',value: Math.round(Math.random()*1000)}
                                ]
                            }
                        ]
                    };

                    chart.setOption(option);

                    chart.on('click', function (param) {
                        alert('asdf');
                    });




                    setTimeout(function () {
                        option.geo.id = Math.random();
                        option.geo.show = false;
                        chart.setOption(option, { notMerge: true });

                        setTimeout(function () {
                            option.geo.id = Math.random();
                            option.geo.show = true;
                            chart.setOption(option, { notMerge: true });
                        }, 2000);
                    }, 2000);

What is expected?

2000ms later, map hide. 2000ms later, map display again.

What is actually happening?

2000ms later, map hide. 2000ms later, map still hidden.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Yikuncommented, Dec 16, 2020

I met the same question in v4.9.0, and solved it with workgroud:

option.geo.id=Math.random() + new Date().getTime()
myChart.setOption(option, {notMerge: true})

@JingyuanZhang @100pah Thanks for your help!

0reactions
echarts-bot[bot]commented, May 5, 2021

This issue is labeled with difficulty: easy. @100pah Would you like to debug it by yourself? This is a quicker way to get your problem fixed. Or you may wait for the community to fix.

Please have a look at How to debug ECharts if you’d like to give a try. 🤓

Read more comments on GitHub >

github_iconTop Results From Across the Web

AutoCAD: Maps Cannot Be Displayed
If you or anyone you know is running into the “Maps cannot be displayed” error when trying to use the Geographic Location (GEO)...
Read more >
AutoCAD: Maps Cannot Be Displayed - Ideate, Inc.
AutoCAD users are encountering a message stating “Maps Cannot be Displayed” when trying to access the Geographiclocation (GEO) command.
Read more >
Show Geo Viewer has no hide Geo Viewer option : DBE-15459
Show Geo Viewer has no hide Geo Viewer option · 1. Execute a query from a console (optional?) · 2. In the services...
Read more >
Troubleshooting Geo - GitLab Docs
Setting up Geo requires careful attention to details, and sometimes it's easy to miss a step. Here is a list of steps you...
Read more >
How to show or hide element based on Geo ip - Stack Overflow
@Groc I have posted an answer below. You can run the snippet. All should work just fine :) You do need to add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found