neveldo / jQuery-Mapael

jQuery plugin based on raphael.js that allows you to display dynamic vector maps
https://www.vincentbroute.fr/mapael/
MIT License
1.01k stars 196 forks source link

attrs text-anchor #420

Open KVAnton-WEB opened 3 years ago

KVAnton-WEB commented 3 years ago

I have code like this, but the text-anchor has no effect, although I can change it in the dev tools of browser

plots: {
   // Plot positioned by area name of the map
   myplot_with_area_name: {
      plotsOn: "cr",
      width: 30,
      height: 30,
      text: {
         content: "Some Text",
         position: "inner",
         attrs: {
            "text-anchor": "start",
            "font-size": 10,
            fill: "#004a9b",
            opacity: 0.6,
         },
      },
   },
},

I need to get this: image

But now I get this ("text-anchor": "middle" by default): image

neveldo commented 3 years ago

Hi, I think you sould rather set the option text.position to the value "right" instead of "inner", and don't use the raphael.js text-anchor. I hope it will help you !

KVAnton-WEB commented 3 years ago

I used "margin", it worked, albeit in a weird way. This is a bug anyway. (does not match the documentation)