reactjs - 如何在高图表中的折线图上结束x与y相交的十字线
解决方案
您可以使用mosueOver
点的事件并使用Highcharts.SVGRenderer
类创建自定义十字准线。
point: {
events: {
mouseOver: function() {
const chart = this.series.chart,
x = this.plotX + chart.plotLeft,
y1 = this.plotY + chart.plotTop,
y2 = chart.plotHeight + chart.plotTop
if (!chart.customcrosshair) {
chart.customcrosshair = chart.renderer.path().attr({
'stroke-width': 1,
'stroke-dasharray': '8,3',
stroke: 'red'
}).add();
}
chart.customcrosshair.attr({
d: ['M', x, y1, 'L', x, y2]
});
}
}
}
现场演示:http: //jsfiddle.net/BlackLabel/osphtxjg/
API 参考: https ://api.highcharts.com/class-reference/Highcharts.SVGRenderer#path
推荐阅读
- r - R:ARIMA 模型和残差之间的自相关
- ada - 从大端数据中提取记录
- apache-spark - 无法使用 Spark 2.4.3 写入 Redshift
- wordpress - WP_QUERY 返回所有帖子(无论权限如何)
- sql - BigQuery:加入 Firestore 集合及其子集合
- docker-compose - jhipster-registry容器启动过程中出现“Your JWT secret key is not set, you will not be able to log into the JHipster”的解决方法
- java - 如何创建搜索嵌入值的存储库方法?
- machine-learning - 初始 kmeans 点如何在 BigQuery ML 中起作用?
- c# - 当用户选择上下文菜单项时,使上下文菜单忽略右键单击
- python - 如何修复我的代码 - KeyError 但我的代码以前可以工作?