Solved

Google Chart Error (null or not an object)

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
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 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)
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now