score:0

So after more research I write this code:

function(datamap) {
        d3.select('.datamap').call(
          d3
            .zoom()
            .scaleExtent([0.7, 6])
            .on('zoom', function() {
              datamap.svg.selectAll('g').attr('transform', d3.event.transform);
            })
        );
      }

It runs after the chart has loaded, and fortunately it works. For some reason when you call the zoom() function on the datamap.svg it cause an error while datamap.svg and d3.select('.datamap') creates a similar array but d3.select create a selection. If anyone know why it doesn't work the other way please explain it.


Related Query

More Query from same tag