如何在图表上的highcharts中绘制线条单击事件?

如何在图表上的highcharts中绘制线条单击事件?,highcharts,Highcharts,是否可以在图表的单击事件上绘制一条线 我最初在highcharts的点击事件中也做了同样的事情。现在,使用图表单击事件执行相同的操作?但无法获取xaxis系列对象。工作正常!必须阅读highcharts文档…:-) chart: { events: { click: function(event) { alert ('x: '+ event.xAxis[0].value +', y: '+

是否可以在图表的单击事件上绘制一条线


我最初在highcharts的点击事件中也做了同样的事情。现在,使用图表单击事件执行相同的操作?但无法获取xaxis系列对象。

工作正常!必须阅读highcharts文档…:-)

chart: {
        events: {
            click: function(event) {
                alert ('x: '+ event.xAxis[0].value  +', y: '+
                      event.chartY );
                 var chart = event.xAxis[0];
                            chart.removePlotLine('plot-line-1');
                            chart.addPlotLine({
                                value: event.chartX,
                                color: '#FF0000',
                                width: 2,
                                id: 'plot-line-1'
                            });
            }
        }        
    },
 chart: {
        events: {
            click: function (event) {
                var chart = this.xAxis[0];
                chart.removePlotLine('plot-line-1');
                chart.addPlotLine({
                    value: event.xAxis[0].value,
                    color: '#FF0000',
                    width: 2,
                    id: 'plot-line-1'
                });
            }
        }