Question

I have a problem with jVectorMap, I don't know how may I highlight the regions that have markers in them. Does anybody knows a way for doing this?

Thank you so much!

Was it helpful?

Solution

The library doesn't provide an automatic way of highlighting regions based on markers but you can use the series option to change behavior of regions / markers.

If you want to highlight regions on map initialization, you need to pass a list of objects with the code of your regions and a key color value.

Imagine you want to highlight following regions: BE, NL, DE. You need to pass this to the series values:

{ 'BE': '1', 'NL': '1', 'DE': '1' }

And the sample code where the value 1 is attributed to the color #4169E1 (as an example)

new jvm.WorldMap({
    map: '',
    container: $(''),
    series: {
        regions: [{
            scale: {
                '1': '#4169E1'
            },
            attribute: 'fill',
            values: { 'BE': '1', 'NL': '1', 'DE': '1' }
        }]
    }
});

Because you already have the list of markers, you can easily build this highlight region list.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top