Scatter Chart not displaying data

47 views
Skip to first unread message

tvladeck

unread,
Jul 23, 2010, 6:03:48 AM7/23/10
to Google Chart API
Hi,

Disclaimer: I am not a programmer, although I have done a very small
amount of amateur coding. I am trying to make a nice scatter plot for
my master's thesis that will display a ton of points in different
colors and different sizes. The google charts tool seems perfect for
this, although I have had a few problems getting it to work. My
dataset is simply too large to use a GET request as the URL will
inevitably be above 2k characters; I have not been able to figure out
how to do a POST request, although that may be for another time. I
tried using the Chart Wizard to automatically write the HTML that
would get me my scatter chart, but when I open the file containing the
text (below) the 'points' in the scatter chart aren't rendered. The
axes and everything else are, but not the points. The code below comes
straight from the Chart Wizard's default settings. I tried using it in
the Visualization playground and opening it in Firefox, with the same
result for both. Any help would be appreciated. Thanks so much.

Kind regards,
Tom


<html>
<head>
<title> Example Chart </title>
<script language="javascript" src="http://www.google.com/jsapi"></
script>
</head>
<body>

<div id="chart"></div>

<script type="text/javascript">
var queryString = '';
var dataUrl = '';

function onLoadCallback() {
if (dataUrl.length > 0) {
var query = new google.visualization.Query(dataUrl);
query.setQuery(queryString);
query.send(handleQueryResponse);
} else {
var dataTable = new google.visualization.DataTable();

draw(dataTable);
}
}

function draw(dataTable) {
var vis = new
google.visualization.ImageChart(document.getElementById('chart'));
var options = {
chxl: '',
chxp: '',
chxr: '',
chxs: '',
chxtc: '',
chxt: 'x,y',
chs: '300x150',
cht: 's',
chco: 'FF9900',
chd: 't:12,87,75,41,23,96,68,71,34,9|
98,60,27,34,56,79,58,74,18,76|84,23,69,81,47,94,60,93,64,54',
chdl: ''
};
vis.draw(dataTable, options);
}

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

google.load("visualization", "1", {packages:["imagechart"]});
google.setOnLoadCallback(onLoadCallback);

</script>
</body>
</html>

Arshia

unread,
Apr 12, 2012, 10:21:06 PM4/12/12
to google-c...@googlegroups.com
Hi Tom,

I'm facing the same problem. Just to add up to description here, I figured out if I view my code in chart wizard or copy and paste the link created by chart wizard, the points are perfectly rendered, but if I copy and paste the same code (Click the Embed with Visualization API and copy/Paste the HTML) in the google code playground or my php file, then the points disappear from the chart. Also I get this at the end of the Chart "google.setOnLoadCallback(drawVisualization); "
May anyone have already figured out why ?

Cheers,
Arshia
Reply all
Reply to author
Forward
0 new messages