Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Highcharts删除批注时抛出类型错误_Javascript_Highcharts - Fatal编程技术网

Javascript Highcharts删除批注时抛出类型错误

Javascript Highcharts删除批注时抛出类型错误,javascript,highcharts,Javascript,Highcharts,我正在使用highcharts,并试图通过调用chart.removeAnnotation(chart.currentAnnotation)删除当前选定的注释,该操作正常,但会导致应用程序抛出 Uncaught TypeError: Cannot read property 'forEach' of undefined at g.setControlPointsVisibility 以下是代码的相关部分: 选择权 chart:{ events:{ load : func

我正在使用highcharts,并试图通过调用
chart.removeAnnotation(chart.currentAnnotation)
删除当前选定的注释,该操作正常,但会导致应用程序抛出

Uncaught TypeError: Cannot read property 'forEach' of undefined at g.setControlPointsVisibility
以下是代码的相关部分:

选择权

chart:{
    events:{
        load : function(){
            var chart = this;
            document.querySelectorAll('.my-toolbar-classname .dbtn')[0]
                 .addEventListener('click',function(){
                     chart.removeAnnotation(chart.currentAnnotation)
                 })
        }
    }
},
navigation:{
    //other events are skipped here
    events: {
        showPopup: function(event){
            if (!this.annotationsPopupContainer) {
                this.annotationsPopupContainer=them.toolbarPopup.current;
            }
            if (event.formType === 'annotation-toolbar') {
                this.chart.currentAnnotation = event.annotation;
            }
        }
    }
}

上述配置正确地删除了注释,但当我尝试向图表添加另一个注释时,错误就会弹出。

Hi@saeed ghotb,你能在一些在线代码编辑器中创建一些问题的实例吗?Hi@ppotaczek。谢谢你的回复。我看了更多,发现这似乎正是我陷入的困境。这里提供的例子可能足够了。不知道是否需要做一些额外的工作来执行注释删除。您使用哪个Highcharts版本?您提供的问题已解决,因此该问题不应出现在当前版本中。react包装器不应影响该问题。github版本的演示没有显示最新版本中的错误:由您创建一些实时示例将非常有帮助。@ppotaczek我非常抱歉回复太晚,这里是周末!!因此,我以全新的眼光查看错误并调用chart.navigationBindings.deselectAnnotation()解决了这个问题;就在调用chart.removeAnnotation(currentAnntin)之前,是answerHi@saeed ghotb,你能在一些在线代码编辑器中创建一些问题的实例吗?Hi@ppotaczek。谢谢你的回复。我看了更多,发现这似乎正是我陷入的困境。这里提供的例子可能足够了。不知道是否需要做一些额外的工作来执行注释删除。您使用哪个Highcharts版本?您提供的问题已解决,因此该问题不应出现在当前版本中。react包装器不应影响该问题。github版本的演示没有显示最新版本中的错误:由您创建一些实时示例将非常有帮助。@ppotaczek我非常抱歉回复太晚,这里是周末!!因此,我以全新的眼光查看错误并调用chart.navigationBindings.deselectAnnotation()解决了这个问题;就在调用chart.removeAnnotation(currentAnntin)之前,答案是