Search code examples
javascriptjvectormap

Can't render region labels with Jvectormap


I try to follow this simple example where labels are rendered into the regions of the map. http://jvectormap.com/examples/region-labels/

I boiled my code down to a small fiddlehttp://jsfiddle.net/V8dyd/189/, but I cannot see what I'm doing wrong.

http://jsfiddle.net/V8dyd/188/

$(function()
{
    var map = $('#map')
        .vectorMap(
        {
            map: 'us_aea_en',
            regionLabelStyle:
            {
                initial:
                {
                    fill: '#B90E32'
                },
                hover:
                {
                    fill: 'black'
                }
            },
            labels:
            {
                regions:
                {
                    render: function (code)
                    {
                        return "label";
                    }
                }
            }
        });
});

Solution

  • You are using an old version of jVectorMap. Region static labels are supported starting version 2.0. Here is an updated fiddle.

    jquery-jvectormap-2.0.1.min.js