Google Chart not showing in IE

60 views
Skip to first unread message

TheInnovator

unread,
Feb 6, 2014, 9:39:12 AM2/6/14
to google-visua...@googlegroups.com
Hi All,

I created a column chart and it's not showing in IE but it shows in Chrome and Firefox.  I've done this before and it worked in IE but not this time.  Any ideas?

Here's the error message:
Webpage error details
Message: 'dataValues[...].0' is null or not an object
Line: 714
Char: 3
Code: 0


Here's the site


Here's my code

<script type="text/javascript">
//The Google Visualization library implements several classes and methods that you'll need to manipulate all charts
google.load("visualization", "1", {packages:["corechart"]});

_spBodyOnLoadFunctionNames.push("buildColumnChartFunc");

function buildColumnChartFunc()
{
var Total = 0;
var under30 = 0;
var dataValues = [
['Oct', 0, 0],
['Nov', 0, 0],
['Dec', 0, 0],
['Jan', 0, 0],
['Feb', 0, 0],
['Mar', 0, 0],
['Apr', 0, 0],
['May', 0, 0],
['Jun', 0, 0],
['Jul', 0, 0],
['Aug', 0, 0],
['Sep', 0, 0],
];
var data = new google.visualization.DataTable();
data.addColumn('string', 'Month');
data.addColumn('number', 'Total');
data.addColumn('number', 'Over 30');
//Get Fiscal Year
var fiscalYear = (new Date).getFullYear();
var prevYear = fiscalYear - 1;
var beginFY = prevYear + "-10-01";//2013-10-01
var endFY = fiscalYear + "-09-30";//2013-09-30
<!-- Step 2 - Prepare your data -->
$().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) {
data.addRow([dataValues[index][0], dataValues[index][1], 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);  
}

</script>
<table>
<tr><td><div id="chart_div" style="width: 650px; height: 400px;"></div></td></tr>
</table>

Thomas Rybka

unread,
Feb 6, 2014, 10:27:36 AM2/6/14
to google-visua...@googlegroups.com
This is because IE handles trailing commas differently.

Your dataValues array has a trailing comma in it, leading to the last element (in IE) being undefined.

This causes the line in question to print this message. Remove the trailing comma, and you should be good to go.

Thomas Rybka | Software Engineer | try...@google.com | Google


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Isaac Sogunro

unread,
Feb 6, 2014, 12:22:02 PM2/6/14
to google-visua...@googlegroups.com
Hi,

What do you mean remove the trailing commas?
Is this what you meant?
$.each (dataValues, function(index, value) {
data.addRow([dataValues[index][0] Number(dataValues[index][1]) Number(dataValues[index][2])]);
});

That did not work.


--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/WHM1FpIlv4E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.



--
-Isaac-

http://twitter.com/#!/feedy0urmind
You are today where your thoughts have brought you; you will be tomorrow where your thoughts take you.
- James Allen

asgallant

unread,
Feb 6, 2014, 12:59:10 PM2/6/14
to google-visua...@googlegroups.com
No, it's this part here:

var dataValues = [
    ['Oct', 0, 0],
    ['Nov', 0, 0],
    ['Dec', 0, 0],
    ['Jan', 0, 0],
    ['Feb', 0, 0],
    ['Mar', 0, 0],
    ['Apr', 0, 0],
    ['May', 0, 0],
    ['Jun', 0, 0],
    ['Jul', 0, 0],
    ['Aug', 0, 0],
    ['Sep', 0, 0], <-- this comma needs to be removed
];
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/WHM1FpIlv4E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Isaac Sogunro

unread,
Feb 6, 2014, 1:52:43 PM2/6/14
to google-visua...@googlegroups.com
Ahh.....that worked!  Thanks!


To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages