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

  • Home
  • SEARCH
  • 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 8205101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:06:36+00:00 2026-06-07T08:06:36+00:00

I am currently working on a JavaScript application that creates heatmaps using the Google

  • 0

I am currently working on a JavaScript application that creates heatmaps using the Google Visualization API, but for some reason whenever I add my array of data to the heatmap the 2nd to last element always throws this error:

Invalid value at position X [object Object]' when calling method: [nsIDOMEventListener::handleEvent]

Can anyone explain this error to me? I have never seen it before and my search of SO and Google turned up nothing useful.

Any help would be appreciated.

var heatMapOptions =
    {
            data: weightedLocations,
            dissipating: false,
            map: this.googleMap,
            gradient: [
                      'rgba(0, 0, 0, 0)',       //black - transparent
                      'rgba(0, 0, 255, 1)',     //blue
                      'rgba(0, 255, 255, 1)',   //cyan
                      'rgba(0, 238, 0, 1)',     //green
                      'rgba(0, 255, 0, 1)',     //lime-green
                      'rgba(255, 255, 0, 1)',   //yellow
                      'rgba(255, 165, 0, 1)',   //orange
                      'rgba(255, 0, 0, 1)',     //red
                      'rgba(139, 0, 0, 1)'      //dark-red
                    ],
            maxIntensity: 150,
            opacity: 0.6,
            radius: 4 //4 pixels
    };

    //create a Heatmap overlay to sit on top of the google map, passing it the initialization object created above
    var heatmap = new google.maps.visualization.HeatmapLayer({ options: heatMapOptions});

Where the object is created

function Box(inBox, count)
{
    var box = inBox.toString();
    //strip off any sort keys if they exist
    if(box.indexOf("~") >= 0) {
        box = box.substr(0, box.indexOf('~'));
    }

    //split box into box number and coordinates of four corners
    var splitBox  = box.split("_");
    //console.log(splitBox);

    var boxNumber = splitBox[0];

    this.boxNumber = boxNumber.replace("count|", "");
    this.swlatlon = new google.maps.LatLng( splitBox[1], splitBox[2]);    // a Google LatLng object
    this.selatlon = new google.maps.LatLng( splitBox[3], splitBox[4]);    // a Google LatLng object
    this.nwlatlon = new google.maps.LatLng( splitBox[5], splitBox[6]);    // a Google LatLng object
    this.nelatlon = new google.maps.LatLng( splitBox[7], splitBox[8]);    // a Google LatLng object
    this.points   = [this.swlatlon, this.selatlon, this.nwlatlon, this.nelatlon] //store all points for easy access
    this.count    = count;         // number of ships in this box

    //calculate center of this box
    this.bounds = new google.maps.LatLngBounds(this.swlatlon, this.nelatlon);
    this.center = this.bounds.getCenter();
    this.weightedLocation = { location : this.center, weight : this.count }; // <-- object created here
}

Where the objects are pushed into an array

function parseJsonForModelData(json, datatype) {
    for(index in json) {
            obj = json[index];

            if (index == "Model Data") 
            {
                $j.each(obj, function(k, v) 
                {
                    if (datatype == 'heat') 
                    {
                        box = new Box(k, v);

                        // Check boxNumber.  If null, skip messes up world map!
                        if (box.boxNumber == 'null') 
                        {
                            badDataCnt++;
                        }
                        else 
                        {
                            modelData.push(box.weightedLocation); <<- pushed here
                        }
                    }
                });
            }
        }
return modelData;
}

WeightedLocations

327: {"location":{"$a":-35.5,"ab":172},"weight":"11"} object music.js:730
328: {"location":{"$a":-36.5,"ab":151},"weight":"1"} object music.js:730
329: {"location":{"$a":-37.5,"ab":151},"weight":"1"} object music.js:730
330: {"location":{"$a":-37.5,"ab":168},"weight":"3"} object music.js:730
331: {"location":{"$a":-37.5,"ab":169},"weight":"6"} object music.js:730
332: {"location":{"$a":-39.5,"ab":161},"weight":"4"} object music.js:730
333: {"location":{"$a":-39.5,"ab":162},"weight":"5"} object music.js:730
334: {"location":{"$a":-39.5,"ab":165},"weight":"6"} object music.js:730 
  • 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-07T08:06:37+00:00Added an answer on June 7, 2026 at 8:06 am

    I noticed the WeightedLocations you posted has strings for weight. When testing with hardcoded data, I did run into problems when weight is a string, so try using parseInt/float inside the function Box, hopefully this will make things work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an application that is using the google maps javascript API
I am currently working on rails3 application that uses jQuery. I have a javascript
I'm currently working on a table application heavily coded in javascript using jQuery. When
I'm currently working on a JavaScript project that uses the HTML5 canvas as a
I am currently working on a JAVA web application using JSF, Facelets, JSTL and
I am currently working on a application that will be implementing user customizable widgets
Currently, I am working on a web application that uses draw2d library to draw
I've been trying to make a JavaScript function for a Google Chrome web-application that
I'm currently working on a project using javascript and python with Jquery Datatables plugin
I have a site that I am currently working on in ASP.NET 2.0 using

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.