Solved

Google Chart Error (null or not an object)

Posted on 2014-02-05
3
817 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

685 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