简体   繁体   中英

DataMaps - How to change the colour of the ocean

https://github.com/markmarkoh/datamaps has a very nice javascript vector map, but it doesn't seem to have an option to change the colour of the ocean. I do however see that some of the demos have a different colour for the ocean. How can I change the colour of the ocean?

You can change the background colour of the target element. For instance if your div has the id 'data-map':

<div id="data-map"></div>

And you initiate the map like:

var datamap = new Datamap({
  element: document.getElementById("data-map")
});

Because the svg is transparent you can change the background colour of the div. This will make the 'oceans' that colour:

#data-map {
    background-color: #F00; //red
}

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