本文介绍了在Highstock中鼠标悬停时绘制多个系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以我之前的问题为基础, SO
Building upon my previous question here SO
我想达到这种期望的效果.这样画多个系列
I want to reach this desired affect on mouse hove. Draw multiple series like so
您能推荐同样的高库存最佳做法吗?
Could you please recommend highstock best practice for the same?
谢谢
推荐答案
您可以在第一个mouseOver
事件中添加其他系列,然后更新其数据.例如:
You can add an additional series in the first mouseOver
event and then update its data. For example:
series: [{
data: [...],
point: {
events: {
mouseOver: function() {
var chart = this.series.chart;
if (!chart.series[1]) {
chart.addSeries({
data: additionalData[this.index].slice()
});
} else {
chart.series[1].setData(
additionalData[this.index].slice()
);
}
}
}
}
}]
实时演示: http://jsfiddle.net/BlackLabel/ufa2ygvm/
API参考:
https://api.highcharts.com/class-reference/Highcharts .Chart#addSeries
https://api.highcharts.com/class-reference/Highcharts .Series#setData
这篇关于在Highstock中鼠标悬停时绘制多个系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!