Search code examples
jvectormap

jvectormap region with negative values


I am trying to create a map with a range of values that includes negative to positive. The negative numbers in my data file change my map to all black.

What can I do?

Thanks

$(function(){
  $('#world-map').vectorMap({
    map: 'world_mill_en',
    backgroundColor: "#FFFFFF",
    series: {
      regions: [{
        values: mapData,
        min: jvm.min(mapData),
        max: jvm.max(mapData), 
        scale: ['#C8EEFF', '#0071A4'],
        normalizeFunction: 'polynomial'
      }]
    },
    onRegionLabelShow: function (event, label, code) {
        label.html("<div class='tooltip'><div class='ttText'><div class='ttName'>" + label.html() + "</div><div class='ttState'>" + (mapData[code]) + "%</div></div></div>")
    },
    regionStyle: {
        initial: {
            fill: '#ccc'
        },
        hover: {
            fill: '#000'
        }
    }
  });
});

Solution

  • Change your normalize function to linear:

    normalizeFunction: 'linear'