简体   繁体   中英

How to set background color for JVector Map?

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?

感谢@Denis Malinovsky,我终于想通了答案是: backgroundColor: "#FFFFFF"

You can also set backgroundColor to be empty, eg "", 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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM