R情节,当鼠标悬停在图上时正常光标

问题描述 投票:0回答:1

在默认情况下,当鼠标结束时,图形光标变为“指针”,任何想法如何保持正常光标?

r cursor plotly
1个回答
3
投票

一个hacky解决方案,但你可以使用htmlwidgets和Javascript自己指定光标。

通过d3.select,我们获得了使用cursor-crosshair类的所有元素,并将光标设置覆盖为默认值,因此所有其他游标都不受影响,例如轴的调整大小光标。

library(plotly)
library(htmlwidgets)

plot_ly(type='bar', 
             x = c(1, 2), 
             y = c(3, 5)) %>% onRender("
function(el, x) {
  Plotly.d3.select('.cursor-crosshair').style('cursor', 'default')
}
")
© www.soinside.com 2019 - 2024. All rights reserved.