如何在Jvector Map中获取国家/地区代码?

时间:2015-05-18 09:31:38

标签: javascript jvectormap

我正在使用Jvector Map。它现在正在使用onRegionTipShow功能。如何更改为onRegionClick

当我更改它时,它不起作用。如何在点击时获取jvectormap中的国家/地区代码?

jQuery.noConflict();
jQuery(function () {
    var $ = jQuery;
    $('#focus-single').click(function () {
        $('#map1').vectorMap('set', 'focus', {
            region: 'AU',
            animate: true
        });
    });
    $('#focus-multiple').click(function () {
        $('#map1').vectorMap('set', 'focus', {
            regions: ['AU', 'JP'],
            animate: true
        });
    });
    $('#focus-coords').click(function () {
        $('#map1').vectorMap('set', 'focus', {
            scale: 7,
            lat: 35,
            lng: 33,
            animate: true
        });
    });
    $('#focus-init').click(function () {
        $('#map1').vectorMap('set', 'focus', {
            scale: 1,
            x: 0.5,
            y: 0.5,
            animate: true
        });
    });
    $('#map1').vectorMap({
        map: 'world_mill_en',
        panOnDrag: true,
        focusOn: {
            x: 0.5,
            y: 0.5,
            scale: 1,
            animate: true
        },
        series: {
            regions: [{
                scale: ['#688FA0'],
                normalizeFunction: 'polynomial',
                values: {

                    //"DZ": 158.97,
                    // "AZ":1.1,
                    "AG": 1.1,
                    // "AE":7.54,
                    // "AO":5.6,
                    "AR": 351.02,
                    //"AM":3.96,
                    "AU": 1219.72,
                        "AT": 366.26,
                    //"AF":3.96,
                    // "AL":3.96,
                    //"BS": 7.54,
                    "BH": 21.73,
                    // "BI":4.45,
                    "BB": 3.96,
                    //"BY": 52.89,
                    "BE": 461.33,

                }
            }]
        },
        onRegionTipShow: function (e, label, code) {
            var code = label.html();

            switch (code) {
                case 'Argentina':
                    label.html("<div style='height:129px;width:296px;Length:98px'><b>Country</b>:&nbsp  Argentina<br/><b>Category</b>:&nbsp  Approved<br/><b>PDP GCO Region</b>:&nbsp  South America<br/><b>Comments</b>:&nbsp  Have had delays with regulatory submissions/approvals. As long as advanced planning is taken into consideration this country should be okay.</br><b>CCL</b>:&nbsp Mariana Bodmer</div>");
                    break;

0 个答案:

没有答案