d3 zoom is throwing cannot read property button of null error

1.7k Views Asked by At

Following is the exact error,

Uncaught TypeError: Cannot read property 'button' of null
    at SVGSVGElement.defaultFilter (zoom.js:12)
    at SVGSVGElement.wheeled (zoom.js:213)
    at SVGSVGElement.__onwheel.zoom (d3.js:1667)

Since I am using React.js with datamaps I am utilizing done function to handle the zoom event

These are my import statements,

import {zoom} from 'd3-zoom';
import {event as d3Event} from 'd3-selection';

following is the done function of datamap,

done: function(datamap) {
        datamap.svg.call(zoom().on("zoom", function() {
          console.log("Zoome event");
          datamap.svg.selectAll("g").attr("transform", "translate(" + d3Event.translate + ")scale(" + d3Event.scale + ")");
        }));
      },

I am using D3 version 4 and please find me a way to resolve this issue

0

There are 0 best solutions below