How to set background color for JVector Map?
Asked Answered
C

2

7

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?

Chieftain answered 2/5, 2013 at 5:17 Comment(2)
Did you try to enclose #FFFFFF in quotes, like '#FFFFFF'? :)Wharf
@Denis Malinovsky thanks you that works!Chieftain
C
8

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

Chieftain answered 3/5, 2013 at 14:11 Comment(0)
I
0

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;
}
Incombustible answered 15/12, 2015 at 16:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.