score:2

Accepted answer

the reason they are not working the same way is because you have to pass x and y coordinates when you use "mappoint".

your "goblin" data:

{
    "name": "adam",
    "x": 1751,
    "y": -9500
}

your "ghost" data (no "x" and "y"):

{
    name: "liège",
    code: "se",
    z: 1
}

if you give the "ghost" data some "x" and "y" properties, it will work. please see this example.

the other thing that you can try if you want to insert images into the map without specifying any "x" and "y" is to do it via the datalabels. in this example here, i have created a map of the usa. each state that has the population density smaller than 7 people per square metre will display a ghost. if you want to go this way, there are two properties that you need to use this way:

  1. usehtml: true so you can have html <img> tags as data labels
  2. use formatter instead of format, but please note you have to pass a function to formatter

var ghostelem = '<img src="https://cdn1.iconfinder.com/data/icons/momentum_matteentireset/32/ghost.png"/>';


datalabels: {
    enabled: true,
    usehtml: true,
    color: 'white',
    formatter: function() { return (this.point.value <7)? ghostelem: null}
}


Related Query

More Query from same tag