gpt4 book ai didi

R plotly,鼠标悬停在绘图上时的正常光标

转载 作者:行者123 更新时间:2023-12-02 00:47:13 25 4
gpt4 key购买 nike

默认情况下,当鼠标悬停在 plotly 中时,图形光标变为“指针”,知道如何保持正常光标吗?

最佳答案

有点棘手的解决方案,但您可以使用 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')
}
")

关于R plotly,鼠标悬停在绘图上时的正常光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42900008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com