nvd3.js tooltip position with multiple charts

前端 未结 3 1873
眼角桃花
眼角桃花 2020-12-20 18:28

I\'m usinging v1.7.1 of nvd3. I have a page in which I render rows of charts with the same configuration but different data. I\'m using interactive tooltip option on the m

3条回答
  •  旧巷少年郎
    2020-12-20 18:38

    I discovered a similar bug in 1.8.6-dev just today and fixed it by adding window.scrollY to top on line 742 by changing this block:

        var positionTooltip = function() {
        nv.dom.read(function() {
            var pos = position(),
                gravityOffset = calcGravityOffset(pos),
                left = pos.left + gravityOffset.left,
                top = pos.top + gravityOffset.top;
    

    To:

        var positionTooltip = function() {
        nv.dom.read(function() {
            var pos = position(),
                gravityOffset = calcGravityOffset(pos),
                left = pos.left + gravityOffset.left,
                top = pos.top + gravityOffset.top+window.scrollY;
    

    In this case, it was not that there's a bug with multiple charts so much as there is a bug with scrolling, which is usually implied when one page has multiple charts.

提交回复
热议问题