【问题标题】:R plotly, normal cursor when mouse over the plotR plotly,鼠标悬停在绘图上时的正常光标
【发布时间】:2017-08-11 12:27:29
【问题描述】:

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

【问题讨论】:

    标签: r cursor plotly


    【解决方案1】:

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

    【讨论】:

    • 谢谢。仅作记录:如果有人需要指针光标,请使用 .style('cursor', 'pointer')
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    • 2017-08-14
    • 1970-01-01
    • 2012-09-22
    • 2013-03-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多