Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onClick event in d3-geomap #45

Closed
srh-ocean1991 opened this issue Feb 28, 2018 · 1 comment
Closed

onClick event in d3-geomap #45

srh-ocean1991 opened this issue Feb 28, 2018 · 1 comment

Comments

@srh-ocean1991
Copy link

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);
@yaph
Copy link
Owner

yaph commented Feb 28, 2018

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.

@yaph yaph closed this as completed Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants