switching frome linechart to corechart : c is null error

822 views
Skip to first unread message

tomsoft

unread,
Jan 30, 2011, 1:03:15 PM1/30/11
to Google Visualization API
Everything is in the title: when I try to switch from linechart to
corechart , I've got a "c is null" error after the json data has been
loaded, while no error appears on the linechart version.



The code is very simple:

google.load('visualization', '1', {'packages':['corechart']});
google.setOnLoadCallback(drawVisualization);

var query;

function drawVisualization() {
query = new google.visualization.Query('/stats/data');
query.send(handleQueryResponse);
}

function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}

var data = response.getDataTable();
var formatter_short = new google.visualization.DateFormat({pattern:
'H:mm'});
formatter_short.format(data, 0);
document.debug=data;
visualization = new
google.visualization.LineChart(document.getElementById('chart_div'));
var options={width: 900, height: 300, smoothLine: false,pointSize:
2,vAxis:{minValue:0,maxValue:100}};
visualization.draw(data,options );
}

and is live in http://tvtweet.fr

There was other javascript libs here, but I've test with a simple on
line created corechart that verything works. It seems that the issue
appears when I try to load my data using the json version....

Viz Kid

unread,
Jan 31, 2011, 3:48:41 AM1/31/11
to google-visua...@googlegroups.com

Hi

Can you provide a simple json example that cause this error for you? Alternatively, can you specify where in your page you see the error?

  Viz Kid


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


Thomas Landspurg

unread,
Jan 31, 2011, 8:20:44 AM1/31/11
to google-visua...@googlegroups.com
Hello,


To see the libnchart version

http://www.tvtweet.fr/stats

To see the corechart version:

http://www.tvtweet.fr/stats?lib=corechart


To see the json used for both examples:

http://www.tvtweet.fr/stats/data

Hope this help, I am going crazy with this.... :(

tomsoft

unread,
Feb 2, 2011, 2:48:28 AM2/2/11
to Google Visualization API
So any vizualisation gourou that could help here? :(

On Jan 31, 2:20 pm, Thomas Landspurg <thomas.landsp...@gmail.com>
wrote:
>   Hello,
>
> To see the libnchart version
>
> http://www.tvtweet.fr/stats
>
> To see the corechart version:
>
> http://www.tvtweet.fr/stats?lib=corechart
>
> To see the json used for both examples:
>
> http://www.tvtweet.fr/stats/data
>
>  Hope this help, I am going crazy with this.... :(
>
> On Mon, Jan 31, 2011 at 9:48 AM, Viz Kid <viz...@google.com> wrote:
>
> > Hi
> > Can you provide a simple json example that cause this error for you?
> > Alternatively, can you specify where in your page you see the error?
> >   Viz Kid
>
> >> and is live inhttp://tvtweet.fr

Viz Kid

unread,
Feb 2, 2011, 3:54:02 AM2/2/11
to google-visua...@googlegroups.com

It seems that the data you are passing is not in the proper format (and the error message we provide is obviously not very informative).
What are you trying to show in the chart?

Thomas Landspurg

unread,
Feb 2, 2011, 4:50:24 AM2/2/11
to google-visua...@googlegroups.com
What I am trying to show in the shart, is the a graph where each
line represent a tv channel the horizontal axis is the time, the
vertical axis is the number of tweet related to this channel.
here is a shorten version of the return format:

google.visualization.Query.setResponse({"status":"ok","reqId":"0","table":{"rows":[{"c":[{"v":"0:0"},{"f":"Pr\u00e8s
de chez vous(56)","v":270},{"f":"L'oeil en
coulisses(11)","v":18},{"f":"Ce soir (ou jamais
!)(14)","v":22},{"f":"Les herbes
folles(13)","v":19},{"f":"M\u00e9decins de
demain(2)","v":9},{"f":"Cin\u00e9mas-magazine()","v":2},{"f":"D&CO,
une semaine pour tout changer(30)","v":21},{"f":"Enqu\u00eates
criminelles : le magazine des faits divers(1)","v":2},{"f":"Nuits
blanches \u00e0 Seattle(6)","v":1},{"f":"Stargate
Atlantis(3)","v":2}]},{"c":[{"v":"8:0"},{"f":"TFou(115)","v":134},{"f":"T\u00e9l\u00e9matin(11)","v":39},{"f":"Ludo(20)","v":53},{"f":"La
matinale(2)","v":9},{"f":"Age sensible()","v":7},{"f":"Lucie raconte
l'histoire des sciences()","v":1},{"f":"Disney Kid
Club(3)","v":6},{"f":"Wake
Up(1)","v":4},{"f":"T\u00e9l\u00e9-achat()","v":0},{"f":"T\u00e9l\u00e9-achat(2)","v":3}]},{"c":[{"v":"16:0"},{"f":"L'h\u00f4pital()","v":0},{"f":"Comment
\u00e7a va bien !()","v":0},{"f":"Questions au
gouvernement()","v":0},{"f":"Le
globe-cooker()","v":0},{"f":"Ludo()","v":0},{"f":"La
corde()","v":0},{"f":"90210 Beverly Hills : nouvelle
g\u00e9n\u00e9ration()","v":0},{"f":"Fan de
stars()","v":0},{"f":"Maigret()","v":0},{"f":"Les anges de la
t\u00e9l\u00e9-r\u00e9alit\u00e9, Best of
Before()","v":0}]}],"cols":[{"type":"Date","label":"Hour","id":0},{"type":"String","label":"TF1","id":1},{"type":"String","label":"France2","id":2},{"type":"String","label":"France3","id":3},{"type":"String","label":"Canal","id":4},{"type":"String","label":"France4","id":5},{"type":"String","label":"France5","id":6},{"type":"String","label":"M6","id":7},{"type":"String","label":"W9","id":8},{"type":"String","label":"Direct8","id":9},{"type":"String","label":"NRJ12","id":10}]},"version":"0.6"});

--
Get the ALL NEW Webwag Mobile - http://webwag.com/mobile
Thomas Landspurg -  Webwag  CTO and Co-founder
http://www.webwag.com Tel: +33 6 32 29 42 16

Viz Kid

unread,
Feb 2, 2011, 5:47:34 AM2/2/11
to google-visua...@googlegroups.com

Notice that the columns types in your response are Date followed by many String columns and no numeric columns.

Thomas Landspurg

unread,
Feb 2, 2011, 6:29:01 AM2/2/11
to google-visua...@googlegroups.com
Cool, you saved my life! The data type was string instead of number!
this worked fine for linechart version, but not corechart ones!

Thanks again

Morar Ioan

unread,
Sep 15, 2015, 6:19:05 AM9/15/15
to Google Visualization API, tho...@webwag.com
I have also this problem. Sometimes appear "c is null", sometimes not. What can be? What can I do?

Sergey Grabkovsky

unread,
Sep 15, 2015, 10:36:01 AM9/15/15
to Google Visualization API, tho...@webwag.com
Hi, that's not enough information to help with your issue. Please reproduce the issue on jsfiddle and link to that, or if you're unable to do that, please link to the page on which you're seeing the issue.

--
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.
Reply all
Reply to author
Forward
0 new messages