Solved

Google Chart Error (null or not an object)

Posted on 2014-02-05
3
833 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

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…
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
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…

691 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