NVD3 cursor pointer does not update position after updating chart data

I use the NVD3 library to draw a graph. I use the online manual and for some reason, after updating the data graph + graph, the help pointers remain in the old position.

hint pointer in the wrong position

When I update the data, I do this:

chartData.datum (data) .call (chart);

Everything updates perfectly, except for the position of the tooltip pointers. They seem to be stuck in the old position. I also tried calling it:

chart.update ();

I noticed that when I resize my window and call chart.update (), the pointers are set to the correct position.

Does anyone know how to fix this?

+4
source share
2

! , , (). Duration (500);

, , :

chartData.datum()                 .transition(). (500)                 .call();

+2

... Becuase .., nvd3

`this._nvctp = nv.tooltip.calcTooltipPosition;
 nv.tooltip.calcTooltipPosition = this.calcTooltipPosition;

calcTooltipPosition : function() {
this.findTotalOffsetTop = function(a, b) {
                return 0;
            };
this.findTotalOffsetLeft = function(a, b) {
                return 0;
            };
arguments[0] = [ window.event.pageX, window.event.pageY ];
var p = nvk.tooltip._nvctp.apply(this, arguments);

            p.style.left = (window.event.clientX - (p.clientWidth / 2))
                    + 'px';
            p.style.top = (window.event.clientY - (p.clientHeight * 1.2))
                    + 'px';
            p.style.opacity = 1;
            p.style.position = 'fixed';
            return p;
        }
0

All Articles