Closed srh-ocean1991 closed 6 years ago
0 down vote favorite I'm trying to change onclick event in d3-geomap from zoom to another function. How can I do this ?
Thanks
my code is here :
var map = d3.geomap.choropleth() .geofile('json/IRN2.json') .unitId('fips') .projection(function(){return d3.geo.albers().center([51,35]);}) .column('point') .scale(2000) .rotate([-40, 0]) .translate([1.25*width ,-200 ]) .colors(['green','yellow' , 'pink' ,'red']) .domain([0, 20 , 50,100]) //.clicked(function(){console.log("hiiiiiiiiiiiiiiii");}) .legend(true); d3.select('#map') .datum(mydata) .call(map.draw, map);
You can try something like this after creating the map object:
map.svg.selectAll('.unit').on('click', function() {console.log('test')})
I just tested this in the browser console for this map. It logs 'test' to the console and removes the zoom behavior.
0 down vote favorite I'm trying to change onclick event in d3-geomap from zoom to another function. How can I do this ?
Thanks
my code is here :