Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8895405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:46:12+00:00 2026-06-14T23:46:12+00:00

I am using a jVectorMap to display country values via coloring (i.e. countries are

  • 0

I am using a jVectorMap to display country values via coloring (i.e. countries are different colors based on their values). Everything works fine, except when certain countries are included in the data set. Then the countries do not get colored like they should (indeed, they don’t get colored at all).

I have identified Bahrain (BH) and Singapore (SG) as 2 of the countries/city-states which break the map. It looks as though these countries are not included on the map. I am not surprised by them not being there. However, I wish the map wouldn’t fail.

The JavaScript error of 'this.elements[...].element' is null or not an object lies on the following (see comment about failure in code below).

jvm.DataSeries.prototype={
    //...
    setValues:function(e){
        var t=Number.MIN_VALUE,n=Number.MAX_VALUE,r,i,s={};
        if(!this.params.min||!this.params.max){
            for(i in e)
                r=parseFloat(e[i]),r>t&&(t=e[i]),r<n&&(n=r);
            this.params.min||this.scale.setMin(n),this.params.max||this.scale.setMax(t),this.params.min=n,this.params.max=t
        }
        for(i in e)
            //FAILS ON THE FOLLOWING LINE
            r=parseFloat(e[i]),r?s[i]=this.scale.getValue(r):s[i]=this.elements[i].element.style.initial[this.params.attribute];
        this.setAttributes(s),this.values=e
    },
    //...
},

Is there a way to fix this issue? I’d rather NOT change the jVectorMap code, or have to do things like the following in my Java code:

if (!countryCode.equals("BH") && !countryCode.equals("SG")) {
    countryValues.put(countryCode, countryValue);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:46:13+00:00Added an answer on June 14, 2026 at 11:46 pm

    If you want to ensure that your data only has country codes that are found in your map, you could filter the data using the map country codes as your filter criteria before setting the data for the map.

    You could define a method in which you pass in the data, iterate over each item and remove entries who’s country codes are not present in the map paths:

    function filterDataForMap(data, mapName){
        var filteredData = {};
        $.each(data,function(key, value){
           //Only add when the key (country code) exists in the map
           if(jvm.WorldMap.maps[mapName].paths[key]!==undefined) {
              filteredData[key] = value;        
           }                
        });
        return filteredData;
    }
    

    Applied to the creation of a map:

    $('#map').vectorMap({
            map: 'world_mill_en',
            series: {
              regions: [
                {
                  scale: colorScale,
                  attribute: 'fill',
                  normalizeFunction: 'polynomial',
                  values: filterDataForMap(mapData, 'world_mill_en') //filter data
                }]
            }
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the C# Facebook SDK 5.0.3 everything works fine whit the client.Get(/me). But when
Using Java,I have to fetch multiple sets of values from an XML file to
Using MVVM. I have a DataTemplate which I am using to display an expander
I'm using jVectorMap v1.1 and I've got this relevant piece of code: var america
Using C#, I want to format a decimal to only display two decimal places
Using jQuery UI Resizable I'm trying to prevent resizing based on various rules. The
I'm trying to create a map using JVectorMap that will put information to an
Using Meteor, I am trying to loop through and display a list of notes
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain
Using a populated Table Type as the source for a TSQL-Merge. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.