Full Example of CSV data Source

1,474 views
Skip to first unread message

webceo

unread,
Oct 14, 2010, 9:53:59 PM10/14/10
to Google Visualization API
Can someone show me a FULL example of using a CSV datasource for an
annotated timeline?

i am trying to use my own csv file located at http://69.41.184.10/~admin/leadsytd.csv


webceo

unread,
Oct 15, 2010, 7:37:59 PM10/15/10
to Google Visualization API
Anyone?

webceo

unread,
Oct 15, 2010, 7:42:49 PM10/15/10
to Google Visualization API
Here is my code. Can ANYBODY help?

Where can I get help for this?


<html>
<head>

<script type='text/javascript' src='http://www.google.com/
jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages':
['annotatedtimeline']});
google.setOnLoadCallback(drawChart);
function drawChart() {

//leadsytd.csv
var data = new google.visualization.Query('csv?url=http://
pragmasol.com/leadsytd.csv');
data.addColumn('date', 'Date');
data.addColumn('string', 'Source Group');
data.addColumn('String', 'LeadSource');
data.addColumn('string', 'text1');
data.addColumn('number', 'TotalforSource');
data.addColumn('string', 'title2');
data.addColumn('string', 'text2');


var chart = new
google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
chart.draw(data, {displayAnnotations: true});
}
</script>
</head>

<body>
<!--// Note how you must specify the size of the container element
explicitly!-->
<div id='chart_div' style='width: 1500px; height: 600px;'></div>
</body>
</html>

VizGuy

unread,
Oct 16, 2010, 4:43:35 PM10/16/10
to google-visua...@googlegroups.com
Hi,

The Query function should get a url that returns the data as a js object.
You can't pass a CSV file to it, as it seems like you are doing now.

You should have at your server code something that transpose the csv into a valid Google Visualization data source format.

If you can use java code, you may find almost all that you need by using the Open Source library available at http://code.google.com/p/google-visualization-java/ and explained in details at http://code.google.com/apis/visualization/documentation/dev/dsl_about.html

Hope this helps,
VizGuy



--
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.


Reply all
Reply to author
Forward
0 new messages