I 'cheated' and just fed the CSV data directly into the addRows() method. I converted HTML and Javascript into a template (HTML::Template) and the CSV file is read in from the filesystem. Here's the template (online example: <a href="http://www.bixchange.com/cgi-bin/bixchange/bixchange.cgi?pom=test-gsapi;iid=0001">http://www.bixchange.com/cgi-bin/bixchange/bixchange.cgi?pom=test-gsapi;iid=0001</a> ):<div>
<br></div><div><html> </div><div> <head></div><div> <script type="text/javascript" src="<a href="http://www.google.com/jsapi">http://www.google.com/jsapi</a>"></script> </div>
<div> <script type="text/javascript"> </div><div> </div><div> google.load("visualization", "1", {packages:["corechart"]});</div><div> google.setOnLoadCallback(drawChart);</div>
<div> </div><div> function drawChart() {</div><div> var data = new google.visualization.DataTable();</div><div> data.addColumn('string', 'Year');</div><div> data.addColumn('number', 'Sales');</div>
<div> </div><div> data.addRows([</div><div> //['2004', 1000, 400],</div><div> <TMPL_LOOP NAME="data"></div><div> [<TMPL_VAR NAME="Year">,<TMPL_VAR NAME="Fako_Num">],</div>
<div> </TMPL_LOOP></div><div> ]);</div><div> </div><div> var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));</div><div> </div><div> chart.draw(data, {</div>
<div> width: 400, </div><div> height: 300, </div><div> title: 'Company Performance', </div><div> vAxis: {logScale: 'true'},</div><div> hAxis: {title: 'Year', titleColor:'#FF0000'}</div>
<div> });</div><div> </div><div> }</div><div> </div><div><span class="Apple-tab-span" style="white-space:pre">        </span></script> </div><div> </head></div><div> <body></div><div> <h2>Let's see our data first:</h2></div>
<div> <TABLE summary="fako data" WIDTH="300px" border="1"></div><div> <TMPL_LOOP NAME="data"> </div><div> <tr></div><div> <td></div><div> <TMPL_VAR NAME="Year"></div>
<div> </td></div><div> <td></div><div> <TMPL_VAR NAME="Fako_Num"></div><div> </td></div><div> </tr></div><div> </TMPL_LOOP></div><div> </TABLE></div>
<div><br></div><div><br></div><div> <!-- the chart goes below --></div><div><br></div><div> <div id="chart_div"></div></div><div> </body></div><div></html></div><div> <br>I would imagine the JSON example is pretty much the exact same thing except you just create a separate template to push out JSON and return this back to a static HTML file pointing to its URL. This is pretty elementary stuff, however...perhaps I'm missing the problem here...?</div>
<div><br></div><div><br><div class="gmail_quote">On Sat, Jul 31, 2010 at 6:18 PM, Jay Strauss <span dir="ltr"><<a href="mailto:me@heyjay.com">me@heyjay.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi, I'm double posting (on luni), but since these lists only partially<br>
overlap, I thought someone here might know (hopefully)<br>
<br>
I'm struggling to use a line chart with Google visualization. Its very<br>
possible I don't have a clue as to what I'm doing. I've been reading docs<br>
and searching google but cant find why I can't get this to work.<br>
<br>
I can get a basic example to work where the data table is populated by<br>
javascript within the page.<br>
<br>
<a href="http://luni.heyjay.com:55555/works.html" target="_blank">http://luni.heyjay.com:55555/works.html</a><br>
<br>
But I'd like the data to come from the server in the form of a CSV file<br>
(I'll work on delivering a JSON string for later). Here is the CSV file:<br>
<br>
<a href="http://luni.heyjay.com:55555/data.csv" target="_blank">http://luni.heyjay.com:55555/data.csv</a><br>
<br>
and here is the page that's trying to render the graph using the CSV file:<br>
<br>
<a href="http://luni.heyjay.com:55555/with_csv.html" target="_blank">http://luni.heyjay.com:55555/with_csv.html</a><br>
<br>
All of the above links should work, I figured rather than post a bunch of<br>
source code and make this email huge, you can just "view source" from the<br>
link<br>
<br>
Any help would be very much appreciated.<br>
<br>
Thanks<br>
Jay<br>
_______________________________________________<br>
Chicago-talk mailing list<br>
<a href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/chicago-talk" target="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Sincerely,<br><br><br>Joel Limardo<br>Chief Software Engineer<br>ForwardPhase Technologies, LLC <br>401 N. Michigan Avenue<br>Suite 1200-10<br>Chicago, IL 60611<br><a href="http://www.forwardphase.com">www.forwardphase.com</a><br>
<a href="mailto:joel.limardo@forwardphase.com">joel.limardo@forwardphase.com</a><br>LinkedIn: <a href="http://www.linkedin.com/in/joellimardo">http://www.linkedin.com/in/joellimardo</a><br>Twitter: <a href="http://twitter.com/joellimardo">http://twitter.com/joellimardo</a><br>
Fax: 815-346-9495<br>Ph : 877-321-5467<br>
</div>