How to set background color for JVector Map?

强颜欢笑 提交于 2019-12-06 00:30:35

问题


I have the following code to initialize JVector map:

      map = new jvm.WorldMap({
          map: 'us_aea_en',
          // backgroundColor:  #FFFFFF, //Only this line does not work.
          container: $('#map'),
          series: {
            regions: [{
              attribute: 'fill'
            }]
          }
        });

The above line: backgroundColor: #FFFFFF does not execute. I read the API documentation, it seems to have correct syntax. The code works perfect except for that line. How to set the background? Are there any other ways to set the background color?


回答1:


Thanks to @Denis Malinovsky, I finally figured out that The answer is: backgroundColor: "#FFFFFF"




回答2:


You can also set backgroundColor to be empty, e.g. "", and then specify the background color in css by specifying it in the .jvectormap-container class:

Javascript:

var mapObject = $(map).vectorMap({
    map: 'us_aea',
    backgroundColor: ""
});

Css:

.jvectormap-container {
    background-color: navy;
}


来源:https://stackoverflow.com/questions/16330789/how-to-set-background-color-for-jvector-map

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!