D3.js nvd3 angularjs固定工具提示

D3.js nvd3 angularjs固定工具提示,d3.js,angularjs-directive,nvd3.js,D3.js,Angularjs Directive,Nvd3.js,我试图修复图形,但是工具提示没有修复,并且有奇怪的行为,工具提示开始在窗口周围浮动 我尝试将nvd3.css中的位置设置为固定位置,但不起作用: .nvtooltip { **position: fixed;** background-color: rgba(255,255,255,1.0); padding: 1px; border: 1px solid rgba(0,0,0,.2); z-index: 10000; font-family: A

我试图修复图形,但是工具提示没有修复,并且有奇怪的行为,工具提示开始在窗口周围浮动

我尝试将nvd3.css中的位置设置为固定位置,但不起作用:

.nvtooltip {
    **position: fixed;**
    background-color: rgba(255,255,255,1.0);
    padding: 1px;
    border: 1px solid rgba(0,0,0,.2);
    z-index: 10000;
    font-family: Arial;
    font-size: 13px;
    text-align: left;
    pointer-events: none;
    white-space: nowrap;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

有什么建议吗?

尝试使用
nv.models.tooltip
model的
fixedTop
选项。这在
interactiveLayer
图表选项中。因此,您可以将其设置为:

nv.addGraph(function() {
    var chart = nv.models.lineChart()
        .useInteractiveGuideline(true) //required                      
        ...

    //shoud be separated
    chart.interactiveLayer.tooltip.fixedTop(100) //fixed distance from top  

    ...
})
这是一个


其他
工具提示
选项(来源):


你如何修正这个图表?需要更多信息。我设置了一个覆盖图形的div,并将其设置为position:fixed;谢谢你的评论,我尝试过但没有成功,我已经读到这个案例在d3中没有实现,所以我认为我不能做一个简单的方法。@krispo nvd3将来会支持触摸事件吗?我正在用ionic框架构建一个应用程序,但在智能手机上,触摸事件的行为类似于onmouseover事件
content = null    //HTML contents of the tooltip.  If null, the content is generated via the data variable.
data = null     // Tooltip data. If data is given in the proper format, a consistent tooltip is generated.
gravity = 'w'   //Can be 'n','s','e','w'. Determines how tooltip is positioned.
distance = 50   //Distance to offset tooltip from the mouse location.
snapDistance = 25   //Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)
fixedTop = null //If not null, this fixes the top position of the tooltip.
classes = null  //Attaches additional CSS classes to the tooltip DIV that is created.
chartContainer = null   //Parent DIV, of the SVG Container that holds the chart.
tooltipElem = null  //actual DOM element representing the tooltip.
position = {left: null, top: null}      //Relative position of the tooltip inside chartContainer.
enabled = true  //True -> tooltips are rendered. False -> don't render tooltips.