In plotly by default when the mouse is over the graph cursor changes to "pointer", any idea how to keep the normal cursor?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Bit of a hacky solution but you can use htmlwidgets
and Javascript to specify the cursor yourself.
Via d3.select
we get all elements where the cursor-crosshair
class is used and overwrite the cursor setting to default, therefore all other cursors are untouched, e.g. the resize cursor for the axes.
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')
}
")