【问题标题】:d3 Rickshaw Graph Disable Hover effectd3 Rickshaw Graph 禁用悬停效果
【发布时间】:2012-07-13 23:07:20
【问题描述】:

我在 d3 上使用人力车。当我将鼠标悬停在条形图上的条上时,我想显示 x 轴值,但我想禁用显示系列类型和 y 轴值的悬停效果。

有没有办法只显示一个而不显示另一个?我试过这样做,但它不起作用(我正在将此咖啡脚本编译为 javascript):

hoverDict =
  graph: graph
  xFormatter: (x) ->
    today = new Date()
    today.setDate(today.getDate()- x + 1)
    return today.toDateString()
  yFormatter: null
hoverDetail = new Rickshaw.Graph.HoverDetail(hoverDict)

【问题讨论】:

    标签: coffeescript d3.js


    【解决方案1】:

    我想通了。您必须为 .item.active 字段编辑 rickshaw.css:

    .rickshaw_graph .detail .item.active {
    opacity: 1;
    display:none;
    }
    

    制作 display:none 会使 yFormatter 不显示。

    【讨论】:

      猜你喜欢
      • 2015-01-01
      • 1970-01-01
      • 2013-08-17
      • 2016-08-31
      • 1970-01-01
      • 2019-01-20
      • 2017-12-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多