jsvectormap icon indicating copy to clipboard operation
jsvectormap copied to clipboard

Marker label color

Open dgillier opened this issue 3 years ago • 1 comments

Hello,

I'm trying to change the marker label text color with

            markers: [
                {
                    name: "Paris",
                    coords: [48.8566, 2.3522],
                    style: { fill: 'orange' , color:'white'} // Add style for this particular marker
                }
            ],

Tried also text:'white' with no result either...

Wondering if it's possible ? Thanks ! Denis

dgillier avatar Jul 28 '22 16:07 dgillier

Hello @dgillier

Changing a particular marker's label style is not possible currently.

But you can change all markers labels style with:

const map = new jsVectorMap({ 
  markerLabelStyle: {
    initial: {
      fill: '#35373e',
    },
    // You can control the hover and selected state for labels as well.
    hover: {
      fill: 'red'
    },
    selected: {
      fill: 'blue'
    }
  },
})

However, if you need to change a particular marker's label, you can use CSS as a workaround.

#jvm-markers-labels-group .jvm-element[data-index="2"] {
  fill: red;
}

themustafaomar avatar Jul 28 '22 17:07 themustafaomar