Javascript Highcharts同步不工作:point.highlight
我对Highcharts非常陌生,我正在尝试同步我的Highcharts,如中所示,但是我遇到了一个与以下部分有关的问题 在链接中,第一部分如下Javascript Highcharts同步不工作:point.highlight,javascript,vue.js,highcharts,vuejs2,Javascript,Vue.js,Highcharts,Vuejs2,我对Highcharts非常陌生,我正在尝试同步我的Highcharts,如中所示,但是我遇到了一个与以下部分有关的问题 在链接中,第一部分如下 $('#container').bind('mousemove touchmove touchstart', function (e) { var chart, point, i, event; for (i = 0; i < Highcharts.charts.length; i
$('#container').bind('mousemove touchmove touchstart', function (e) {
var chart,
point,
i,
event;
for (i = 0; i < Highcharts.charts.length; i = i + 1) {
chart = Highcharts.charts[i];
event = chart.pointer.normalize(e.originalEvent); // Find coordinates within the chart
point = chart.series[0].searchPoint(event, true); // Get the hovered point
if (point) {
point.highlight(e);
}
}
});
错误是:
Uncaught TypeError: _point.highlight is not a function
以下是我的Vue.js代码:
$(`#vue-multi-charts-${self._uid}`).bind('mousemove touchmove touchstart', function (e) {
console.log('fired'); // THIS PART WORKS
let point,
chartRefs = Object.keys(self.$refs).filter((k) => k.startsWith('highchartComponent-'));
for (let i = 0; i < chartRefs.length; i++) {
let chart = self.$refs[chartRefs[i]][0].chart,
event = chart.pointer.normalize(e.originalEvent), // Find coordinates within the chart
point = chart.series[0].searchPoint(event, true); // Get the hovered point
if (point) {
point.highlight(e);
}
}
});
$(`vue多图表-${self.\u uid}').bind('mousemove touchtmove touchtstart',函数(e){
console.log('fired');//这部分有效
让我指出,
chartRefs=Object.keys(self.$refs).filter((k)=>k.startsWith('highchartComponent-');
for(设i=0;i
我使用了Highcharts API,但找不到“highlight”方法的文档。e、 g.没有突出显示方法
如果有人能提供帮助,我将不胜感激
提前非常感谢。请注意,在中,作者将突出显示
定义为自定义方法:
Highcharts.Point.prototype.highlight = function (event) {
this.onMouseOver(); // Show the hover marker
this.series.chart.tooltip.refresh(this); // Show the tooltip
this.series.chart.xAxis[0].drawCrosshair(event, this); // Show the crosshair
};
请注意,在中,作者将高亮显示定义为自定义方法:
Highcharts.Point.prototype.highlight = function (event) {
this.onMouseOver(); // Show the hover marker
this.series.chart.tooltip.refresh(this); // Show the tooltip
this.series.chart.xAxis[0].drawCrosshair(event, this); // Show the crosshair
};