NewSignature / us-map

An interactive map of the United States using Raphaël
BSD 2-Clause "Simplified" License
280 stars 184 forks source link

show labels for all US states? #64

Closed kjrhody closed 8 years ago

kjrhody commented 8 years ago

I cannot get labels to appear. My current code is:

$(document).ready(function(){
    $('#map').usmap({
        showLabels: true,
        stateStyles: {
            fill: '#F0EFED',
            'stroke': '#60605f'
            },
        stateHoverStyles: {
            fill: '#d3e7fb'
            },
        stateSpecificHoverStyles: {
            'RI': {fill: 'red'},
            'MA': {fill: 'red'}
            },

         // The click action
        click: function(event, data) {
            window.open("https://someurl.com"+data.name);
        }
    });
});

Edit:

So it appears that the showLabels: true property actually refers to the block labels for the small northeastern states. By setting it to false, those labels disappear. Is there any way to show labels for the each state in the US?

kjrhody commented 8 years ago

Sorry, looks like there is a great patch for it here

https://github.com/DaddyMacCadillac/us-map/commit/db16541904ac5c5993d7ef040fc9053abba05c83#diff-90ecb4d62200685c1393e1ddf9e96373