I had a simple line chart that had been working fine for months, but has
recently stopped working. This may be related to the new API update, but I
am not sure. The page it is on is infrequently accessed.
In Safari, the API’s red error message reports the obtuse error “'undefined'
is not a function (evaluating 'a[sc](je)')”, and in Chrome the error reads
“Object 2012 has no method 'split'”. Firefox reports “a[sc] is not a
function” I have traced the source of the error to the chart.draw() call.
Again this code had been working fine for months prior and recently stopped
working. Any help would be appreciated. It is hard to debug with such
opaque error messages. It seems something changed in the API that broke
this code. M
Here’s the code:
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
var chosenYears = [2012,2013];
var dataArr = /* JSON blob in the form
[[1,113,"Label",2,352,"Label",…],[1,142,"Label"]…] */;
function drawChart() {
var data = new google.visualization.DataTable();
// Build the columns
data.addColumn('number', 'Week');
for (var y = 0; y < chosenYears.length; y++) {
data.addColumn('number', chosenYears[y]);
data.addColumn({type:'string', role:'tooltip', 'p': {'html': true}});
}
data.addRows(dataArr);
var options = {
backgroundColor: "transparent",
interpolateNulls: true,
tooltip: {isHtml: true},
chartArea: {
width: "90%",
height:"80%",
top: 10
},
hAxis: {
title: "Week Number",
},
vAxis: {
title: "Attendance"
},
legend: {
position: "bottom"
}
};
var chart = new
google.visualization.LineChart(document.getElementById("attendance-chart"));
chart.draw(data, options);
}
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.