user3338098
user3338098

Reputation: 874

google charts "is not a function" in every browser except chrome

a[jc] is not a function

Firefox, safari, safari on ios, IE, ... all of them behave the same way.

no matter what I do, this error is only avoidable on the chrome browser.

Note that it is not a date formatting issue as I use

var rows = [
    [new Date(Date.UTC(x,y,z,...)), ...],
    ...
  ];
var table = new google.visualization.DataTable();
table.addColumn('datetime', 'Time');
table.addColumn(...);
...
table.addRows(rows);

i've done

<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['corechart']}]}"></script>

as per https://stackoverflow.com/a/29777575/3338098

and i've done

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script>
  var googleChartLoaded = false;
  google.load('visualization', '1', {packages: ['corechart'], callback: function() {
    googleChartLoaded = true;
  }});
</script>

and even

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script>
  google.load('visualization', '1', {packages: ['corechart']});
  google.setOnLoadCallback(function() {
    googleChartLoaded = true;
  });
</script>

I have tried as per https://nealpoole.com/blog/2010/07/jquery-getjson-firefox-and-google-visualization-madness/

window.setTimeout(function() {
  try {chart.draw(table, chartOptions);}catch(err) {
    console.err(err);
  }
}, 1000);

our issue is identical to https://developer.appcelerator.com/question/148481/how-i-make-line-graph-on-android-device

how do I go about diagnosing this issue... I assumed a google product would of been cross-browser compatible...

Upvotes: 3

Views: 9050

Answers (3)

alextouzel
alextouzel

Reputation: 238

I don't know if you've managed this problem or used something else, but I had the same problem and solved it by using this "new Date()" formatting that is proper to google charts :

new Date(Year, Month, Day, Hours, Minutes, Seconds, Milliseconds)

Try declaring your date this way and see if it solves your error.

Upvotes: 0

user5706356
user5706356

Reputation: 1

I had the same issue when by mistake the data on xAxis was wrong:

2015-12-22T01:10:02,1 2015-12-22:01:15:01,1

My script saving the values because of my mistake was using : instead of T on the date string.

Fixing the value to YYYYMMDDTHH:MM:SS solved my issue

Upvotes: 0

shinoymm
shinoymm

Reputation: 335

I had the same issue with exact this error message. Here, the issue is with options object that is passed to draw function.

In my case, I had two options : vAxis.ticks and hAxis.viewWindow The documentation says these options are only for continuous axis and my axes were continuous. However these were the problem. I took them out, and its working perfectly.

Upvotes: 3

Related Questions