Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery Jvectormap 1.2.2颜色问题_Jquery_Map_Colors_Country_Jvectormap - Fatal编程技术网

Jquery Jvectormap 1.2.2颜色问题

Jquery Jvectormap 1.2.2颜色问题,jquery,map,colors,country,jvectormap,Jquery,Map,Colors,Country,Jvectormap,我正在使用最新的Jvectormap(1.2.2),但找不到任何设置所有国家/地区颜色的示例。我相信在以前的版本中它只是简单的“颜色:”,但是现在它已经停止了吗 下面的代码有效,但颜色部分无效。我在我的网站上使用白色背景,因此希望所有国家默认使用不同的颜色。 <script> $(function(){ $('#world-map').vectorMap({ map: 'world_mill_en', color: '#000000',

我正在使用最新的Jvectormap(1.2.2),但找不到任何设置所有国家/地区颜色的示例。我相信在以前的版本中它只是简单的“颜色:”,但是现在它已经停止了吗

下面的代码有效,但颜色部分无效。我在我的网站上使用白色背景,因此希望所有国家默认使用不同的颜色。

 <script>
  $(function(){
        $('#world-map').vectorMap({
    map: 'world_mill_en',
    color: '#000000',
        backgroundColor: '#ffffff',
        series: {
       regions: [{
            values: {
                IN:'#33250B',
                US:'#003366'
        }
       }]
         }
     })
  });
 </script>

$(函数(){
$(“#世界地图”).vectorMap({
地图:“世界磨坊”,
颜色:'#000000',
背景颜色:“#ffffff”,
系列:{
区域:[{
价值观:{
在:“#33250B”中,
美国:“#003366”
}
}]
}
})
});

在jVectorMap的1.x.x分支中,可以通过使用
regionStyle
配置参数来实现所需的功能。请参阅文档中的更多信息。

在jVectorMap的1.x.x分支中,可以通过使用
regionStyle
配置参数来实现所需的功能。请参阅文档中的更多信息。

我不确定您的意思,但要设置您可以使用的所有国家/地区颜色:

var regionStyling = {initial: {fill: '#128da7'},hover: {fill: "#A0D1DC"}};

jQuery('#world-map').vectorMap({
    map: 'world_mill_en',
    normalizeFunction: 'polynomial',
    regionStyle:regionStyling,
    backgroundColor: '#383f47',
    series: {regions: [{values: {},attribute: 'fill'}]}
});
 jQuery('#world-map').vectorMap({
    map: 'world_mill_en',
    normalizeFunction: 'polynomial',
    backgroundColor: '#383f47',
    series: {regions: [{values: {"US" : "#000"},attribute: 'fill'}]}
});
这对我很有用,如果您想指定每个国家/地区可以使用:

var regionStyling = {initial: {fill: '#128da7'},hover: {fill: "#A0D1DC"}};

jQuery('#world-map').vectorMap({
    map: 'world_mill_en',
    normalizeFunction: 'polynomial',
    regionStyle:regionStyling,
    backgroundColor: '#383f47',
    series: {regions: [{values: {},attribute: 'fill'}]}
});
 jQuery('#world-map').vectorMap({
    map: 'world_mill_en',
    normalizeFunction: 'polynomial',
    backgroundColor: '#383f47',
    series: {regions: [{values: {"US" : "#000"},attribute: 'fill'}]}
});

我不太清楚你的意思,但要设置你可以使用的所有国家/地区颜色:

var regionStyling = {initial: {fill: '#128da7'},hover: {fill: "#A0D1DC"}};

jQuery('#world-map').vectorMap({
    map: 'world_mill_en',
    normalizeFunction: 'polynomial',
    regionStyle:regionStyling,
    backgroundColor: '#383f47',
    series: {regions: [{values: {},attribute: 'fill'}]}
});
 jQuery('#world-map').vectorMap({
    map: 'world_mill_en',
    normalizeFunction: 'polynomial',
    backgroundColor: '#383f47',
    series: {regions: [{values: {"US" : "#000"},attribute: 'fill'}]}
});
这对我很有用,如果您想指定每个国家/地区可以使用:

var regionStyling = {initial: {fill: '#128da7'},hover: {fill: "#A0D1DC"}};

jQuery('#world-map').vectorMap({
    map: 'world_mill_en',
    normalizeFunction: 'polynomial',
    regionStyle:regionStyling,
    backgroundColor: '#383f47',
    series: {regions: [{values: {},attribute: 'fill'}]}
});
 jQuery('#world-map').vectorMap({
    map: 'world_mill_en',
    normalizeFunction: 'polynomial',
    backgroundColor: '#383f47',
    series: {regions: [{values: {"US" : "#000"},attribute: 'fill'}]}
});

要为所有区域设置默认颜色,请设置
regionStyle.default.fill

以下是更改后的代码:

<script>
    $(function(){
        $('#world-map').vectorMap({
            map: 'world_mill_en',
            regionStyle: { initial: { fill: '#000000' } },  //Changed this line
            backgroundColor: '#ffffff',
            series: {
                regions: [{
                    values: {
                        IN:'#33250B',
                        US:'#003366'
                    }
                }]
            }
        })
    });
</script>

$(函数(){
$(“#世界地图”).vectorMap({
地图:“世界磨坊”,
regionStyle:{initial:{fill:'#000000'}},//更改了此行
背景颜色:“#ffffff”,
系列:{
区域:[{
价值观:{
在:“#33250B”中,
美国:“#003366”
}
}]
}
})
});

要设置所有区域的默认颜色,请设置
regionStyle.default.fill

以下是更改后的代码:

<script>
    $(function(){
        $('#world-map').vectorMap({
            map: 'world_mill_en',
            regionStyle: { initial: { fill: '#000000' } },  //Changed this line
            backgroundColor: '#ffffff',
            series: {
                regions: [{
                    values: {
                        IN:'#33250B',
                        US:'#003366'
                    }
                }]
            }
        })
    });
</script>

$(函数(){
$(“#世界地图”).vectorMap({
地图:“世界磨坊”,
regionStyle:{initial:{fill:'#000000'}},//更改了此行
背景颜色:“#ffffff”,
系列:{
区域:[{
价值观:{
在:“#33250B”中,
美国:“#003366”
}
}]
}
})
});