Solved

Google Chart Error (null or not an object)

Posted on 2014-02-05
3
814 Views
Last Modified: 2014-02-07
I am trying to create a column chart and not sure why I get the following error:
Message: 'dataValues[...].0' is null or not an object
Line: 718
Char: 3
Code: 0
URI: http://isaac.issharepoint.com/Shared%20Documents/ReportDashboard.aspx


It shows up in firefox and chrome but not IE 8
Here's a snippet of my code:

$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Log",
	CAMLViewFields: "<ViewFields><FieldRef Name='AssignToAnalyst'></FieldRef><FieldRef Name='Days'></FieldRef></ViewFields>",
	//CAMLRowLimit: 0,
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() { 
		  var monthProjectedIndex = fyMonthIndex($(this).attr("ows_AssignToAnalyst"));
		  dataValues[monthProjectedIndex][1]++;
		  //alert("Days: "+valSplit($(this).attr("ows_Days")));
		  
		  if (valSplit($(this).attr("ows_Days")) > 30)
		  {
			//alert("Over 30");
			 dataValues[monthProjectedIndex][2]++;
		  }
		  
      });
     }
  });
		
		
	$.each (dataValues, function(index, value) {
	//alert("Month: "+dataValues[index][0]);
	//alert("Month: "+dataValues[index][1]);
	//alert("Month: "+dataValues[index][2]);
	
		data.addRow([dataValues[index][0], Number(dataValues[index][1]), Number(dataValues[index][2])]);
});
<!-- Customize your chart using Options -->
      var options = {
          title: 'Days',
          hAxis:  {title: 'Month', titleTextStyle: {color: 'red'}}
        };	

<!-- Instantiate the Chart class -->
      var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); 	

<!-- Call chart.draw() function, passing in 'data' and 'options'	-->	
        chart.draw(data, options); 	  
}

Open in new window



Any ideas?
0
Comment
Question by:Isaac
  • 2
3 Comments
 
LVL 11

Expert Comment

by:Amar Bardoliwala
ID: 39838583
Hello TheInnovator,

I am not 100% sure but IE seems to have problem with following line

data.addRow([dataValues[index][0], Number(dataValues[index][1]), Number(dataValues[index][2])]);

Following is error

SCRIPT5007: Unable to get property '0' of undefined or null reference
File: ReportDashboard.aspx, Line: 682, Column: 3

Look at following link for error description.

http://msdn.microsoft.com/query/dev12.query?appId=Dev12IDEF1&l=EN-US&
k=k(VS.WebClient.Help.SCRIPT5007)

It says following



You attempted to invoke the Object.prototype.toString or Object.prototype.valueOf method on an object of a type other than Object. The object of this type of invocation must be of type Object.
To correct this error

    Only invoke the Object.prototype.toString or Object.prototype.valueOf methods on objects of type Object.



see if this helps you.

Thank you.

Amar Bardoliwala
0
 
LVL 5

Author Comment

by:Isaac
ID: 39838892
I don't think that's the issue because when I hard coded values, my chart showed.
data.addRow(['March', 5, 23]);
0
 
LVL 11

Accepted Solution

by:
Amar Bardoliwala earned 500 total points
ID: 39839263
Hello TheInnovator,

if it runs fine in IE with hard coded values, that means some dynamic value is creating problems for you in IE. You might need to check all dynamic values to find the problem.

Hope this will help you.

Thank you.

Amar Bardoliwala
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question